question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with eslint --init

See original GitHub issue

Tell 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:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:27 (11 by maintainers)

github_iconTop GitHub Comments

3reactions
not-an-aardvarkcommented, May 13, 2019

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.

3reactions
getifycommented, Nov 17, 2018

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, ran npm init it, then eslint --init, then copied out the generated eslintrc.json file and deleted the temp directory. What a silly set of work-arounds. Annoying to put it mildly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bug: (Error running eslint init) · Issue #15512 - GitHub
Environment Node version: v14.17.3 npm version: 6.14.8 Local ESLint version: installed by eslint --init Global ESLint version: Installed via ...
Read more >
Getting Started with ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Command eslint --init not found, why? - Stack Overflow
If you install a tool globally, it places it in a specific location. If that location is not in your PATH environment variable,...
Read more >
eslint/eslint - Gitter
hi, I'm having some issues with eslint and eslint-config-airbnb when running in gitlab- ... Whenever I try to run eslint --init , I...
Read more >
ESLint 8.0: doesn't work with YarnPnP : WEB-52594 - YouTrack
Relates to 2 issues (0 unresolved) ... Initialization error (ESLint). ... I am experiencing the same issue with ESLint 8.2.0 on WebStorm 2021.2.3....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found