Issue with eslint --init
See original GitHub issueTell us about your environment
ESLint Version: v5.1.0 Node Version: v8.11.2 npm Version: v5.6.0
What parser (default, Babel-ESLint, etc.) are you using?
Please show your full configuration:
Configuration
I installed eslint globally and then I’m doing eslint, providing all the questions asked when its going to create eslintrc.js file its failed saying package.json is not there. As I am running it globally I dont require a Package.json file.
sudo npm install -g eslint
eslint --init
? How would you like to configure ESLint? Answer questions about your style ? Which version of ECMAScript do you use? ES5 ? Where will your code run? Browser, Node ? Do you use CommonJS? Yes ? Do you use JSX? Yes ? Do you use React? Yes ? What style of indentation do you use? Tabs ? What quotes do you use for strings? Single ? What line endings do you use? Unix ? Do you require semicolons? Yes ? What format do you want your config file to be in? JavaScript Could not find a package.json file. Run ‘npm init’ to create one. Error: Could not find a package.json file. Run ‘npm init’ to create one.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:27 (11 by maintainers)
Top GitHub Comments
I think the suggestion is to document the fact that
eslint --init
only supports local installations of ESLint. (In fact, if the user is running a global installation, we intentionally try to install a local version and tell them to use that instead.) Personally, I would recommend always using a local ESLint installation/config rather than a global installation/config.This also bothered me when I was running
eslint --init
inside my home directory to great my user-wide config setting. I just made a/tmp/foo
directory, rannpm init
it, theneslint --init
, then copied out the generatedeslintrc.json
file and deleted the temp directory. What a silly set of work-arounds. Annoying to put it mildly.