9

I have eslint (of Airbnb coding style) setup for my React project, which has dependency of "eslint-plugin-jsx-a11y", which I do not want for my current project.

My question how to remove this specific plugin "eslint-plugin-jsx-a11y".

When I uninstall "eslint-plugin-jsx-a11y" it gives error following error:

"Failed to load plugin jsx-a11y: Cannot find module 'eslint-plugin-jsx-a11y'"

Is there any way to solve above issue ?

4
  • go to '/path-to/node_modules' and check "eslint-plugin" is there are not?? in "package.json" alsoo. This link might help. stackoverflow.com/questions/13066532/… Commented Apr 1, 2019 at 6:36
  • 2
    eslint-disable plugin you can find here. npmjs.com/package/eslint-plugin-disable Commented Apr 1, 2019 at 6:40
  • 1
    First install package eslint-config-airbnb-base which will give you the base eslint airbnb package and then install eslint-plugin-react. This way you don't have to install eslint-plugin-jsx-a11y. Hope that helps!! Commented Apr 1, 2019 at 6:42
  • Sure I will try this, Thanks !! Commented Apr 1, 2019 at 7:57

3 Answers 3

7

First of all, you will need to remove the references to the plugin (eslint-plugin-jsx-a11y) on your .eslintrc (That's why when you uninstall it you eslint config is giving you an error):

  1. Search and delete in extends (if you have it) plugin:jsx-a11y/recommended.
  2. Search and delete in plugins: jsx-a11y.
  3. Then in rules delete every rule that involes jsx-a11y (Eg: "jsx-a11y/rule-name": 2).
  4. Finally you can delete it from the project: npm uninstall eslint-plugin-jsx-a11y --save-dev.

PS: If you have any disable statement for eslint-plugin-jsx-a11y, remember to delete it (they won't be necessary anymore)

Sign up to request clarification or add additional context in comments.

Comments

6

The answer of Alberto Perez is valid if you include jsx-a11y plugin explicitly. But if you extend another plugin that contains jsx-a11y his approach doesn't work.

If so you can use this:

1st solution

https://github.com/mradionov/eslint-plugin-disable

At the moment it doesn't support eslint@8. See the issue.

2nd solution

https://github.com/airbnb/javascript/issues/2032#issuecomment-568934232

const a11yOff = Object.keys(require('eslint-plugin-jsx-a11y').rules) .reduce((acc, rule) => { acc[`jsx-a11y/${rule}`] = 'off'; return acc }, {}) module.exports = { rules: { ...a11yOff, // your rules }, } 

1 Comment

awesome, good to find this
-4

Try to install the latest version of react-scripts

If this doesn't work, try updating all the way to the latest one 1.0.10, updated the react and react-dom in my package.json, deleted the package-lock.json and re-installed node_modules.

2 Comments

I think this is not really the solution that he is looking for (At least is not the scope of the question).
How does this address the question? OP is trying to remove the eslint-plugin-jsx-a11y.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.