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.

Installing eslint in a fresh app should give an error

See original GitHub issue

Is this a bug report?

I think so, but I’m not sure.

Did you try recovering your dependencies?

Yes, I did.

$ npm --version
6.4.1

Which terms did you search for in User Guide?

eslint

Environment

Environment:
  OS:  Windows 10
  Node:  10.10.0

  Yarn:
  npm:  6.4.1
  Watchman:  Not Found
  Xcode:  N/A
  Android Studio:  Not Found

Packages: (wanted => installed)
  react: ^16.5.2 => 16.5.2
  react-dom: ^16.5.2 => 16.5.2
  react-scripts: 1.1.5 => 1.1.5

Steps to Reproduce

  1. npm init react-app my-app
  2. cd my-app
  3. npm install eslint --save-dev

Expected Behavior

Eslint should install with the lastest version (currently 5.6.1) without problems and it should show no warnings during installation.

Actual Behavior

Several npm warnings are shown stating that an older version of eslint should be installed by me as it is a peer dependency of several packages which were automatically installed with eslint.

$ npm install eslint --save-dev
npm WARN eslint-config-react-app@2.1.0 requires a peer of eslint@^4.1.1 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-loader@1.9.0 requires a peer of eslint@>=1.6.0 <5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-import@2.8.0 requires a peer of eslint@2.x - 4.x but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-jsx-a11y@5.1.1 requires a peer of eslint@^2.10.2 || ^3 || ^4 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-react@7.4.0 requires a peer of eslint@^3.0.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ eslint@5.6.1
added 30 packages from 33 contributors, updated 6 packages, moved 1 package and audited 14759 packages in 10.093s
found 0 vulnerabilities

Reproducible Demo

Not available.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:18 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
xavierguarchcommented, Oct 1, 2018

FYI, npm start works without problems after installing an older version of ESLint by my own and using the snippet above in my .eslintrc.

Anyway, I understand from your comments @gaearon and @bugzpodder that the preferred route in my case would be to keep using the ESLint version that comes with create-react-app (now that I know that!) and have the plugin simply be upgraded to support it.

Thanks for your comments.

The only real issue here would be then a documentation one to make more clear:

  1. Which packages are already managed by create-react-app
  2. That you cannot install those packages by your own without going into problems…
1reaction
xavierguarchcommented, Oct 1, 2018

I’d also add we don’t really have a supported way to add linter plugins right now.

Well, supposing that I managed to have the ESLint plugin [^1] to work with the last version of ESLint, I understand that these two steps would suffice:

  1. npm install eslint-config-techchange --save-dev
  2. Add the following to my .eslintrc:
{
  "extends": ["techchange/react"]
}

I’ll try it and I’ll let you know.

[^1]: To be more specific, in my case this is a Shareable ESLint Config, not an plugin.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Started with ESLint - Pluggable JavaScript Linter
You can install and configure ESLint using this command: ... The three error levels allow you fine-grained control over how ESLint applies rules...
Read more >
error - ESLint must be installed: yarn add --dev eslint
I just created a new project using
Read more >
Using ESLint to detect errors in NodeJS applications
ESLint is a customizable plugin that corrects your JavaScript and can give you errors or even just suggestions to do better code.
Read more >
Adding ESlint to Your Project - Medium
In this article I will help you to add ESlint to an existing or a new project with a couple of easy steps...
Read more >
Troubleshooting a Next.js app with ESLint - LogRocket Blog
Setting up ESLint with Next.js. Inside your Next.js app, add a new script called lint — its value should be next lint :...
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