Javascript: Can I avoid peer dependency warnings for JSX & React?

Created on 2 Dec 2016  ·  4Comments  ·  Source: airbnb/javascript

I've got an .eslintrc setup for server-side Node project that only extends airbnb/base. We don't use any JSX or React.

I'm not including eslint-plugin-jsx-ally nor eslint-plugin-react in my package.json. I get the following warnings when I npm install:
├── UNMET PEER DEPENDENCY eslint-plugin-jsx-a11y@^2.2.3
└── UNMET PEER DEPENDENCY eslint-plugin-react@^6.6.0

npm WARN [email protected] requires a peer of eslint-plugin-jsx-a11y@^2.2.3 but none was installed.
npm WARN [email protected] requires a peer of eslint-plugin-react@^6.6.0 but none was installed.

Are these my only 2 options:

  • include packages in package.json that I won't use
  • see the warning about UNMET PEER DEPENDENCY every time I run npm install

This has been discussed previously in #451 and #366, but I didn't see any mention of the npm warnings. Those discussions were over a year ago, so maybe we did not have the peer dependencies back then?

A snippet of my package.json:

"devDependencies": {
"eslint": "3.11.1",
"eslint-config-airbnb": "13.0.0",
"eslint-html-reporter": "0.5.2",
"eslint-plugin-import": "2.1.0",

Thank you for the wonderful style guide!!

question

Most helpful comment

Got it. New package.json (switched to airbnb-base):

"devDependencies": {
"eslint": "3.11.1",
"eslint-config-airbnb-base": "10.0.1",
"eslint-html-reporter": "0.5.2",
"eslint-plugin-import": "2.1.0",

.eslintrc

Previous:
"extends": "airbnb/base"

Now:
"extends": "airbnb-base"

Thank you!!!

All 4 comments

Correct - airbnb/base is deprecated; use the separate eslint-config-airbnb-base package instead, for just this reason.

(For future reference, the alternative solution is always to add the peer dependencies required, whether you "use" them or not)

Got it. New package.json (switched to airbnb-base):

"devDependencies": {
"eslint": "3.11.1",
"eslint-config-airbnb-base": "10.0.1",
"eslint-html-reporter": "0.5.2",
"eslint-plugin-import": "2.1.0",

.eslintrc

Previous:
"extends": "airbnb/base"

Now:
"extends": "airbnb-base"

Thank you!!!

Was this page helpful?
0 / 5 - 0 ratings