javascript: Failed to load plugin 'jsx-a11y' declared '/.eslintrc » eslint-config-airbnb
Hi,
I have problem after installing eslint-config-airbnb
. In output of ESLint I have error:
Failed to load plugin 'jsx-a11y' declared in 'frontend/.eslintrc » eslint-config-airbnb » /Users/user/Documents/GitHub/app/frontend/node_modules/eslint-config-airbnb/rules/react-a11y.js': Cannot find module 'eslint-plugin-jsx-a11y'
Here’s my package.json
devDependecies:
"devDependencies": { "eslint": "^6.1.0", "eslint-config-airbnb": "^18.0.1", "eslint-config-prettier": "^6.1.0", "eslint-plugin-import": "^2.18.2", "eslint-plugin-jsx-a11y": "^6.2.3", "eslint-plugin-react": "^7.14.3", "eslint-plugin-react-hooks": "^1.7.0", "husky": "^3.0.4", "lint-staged": "^9.2.3", "prettier": "^1.18.2", "pretty-quick": "^1.11.1" }
Summary - ESLint is not working on my project. Project was created with create-react-app
.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 13
- Comments: 37 (1 by maintainers)
@kacperborkowski - did you try installing eslint and its dependencies at the top level of the project you’re loading in Code? eg if your structure is:
But you’re loading all of
/app
into VS Code as a project, you’ll need to install ESlint and all the dependencies in/app
. It’s not going to work if you only have ESlint and the deps installed in/frontend
, unless you only load that folder (and sub-folders) in as the top level of the project.For other people not wanting to reinstall all their npm dependencies: Edit the settings.json of your workspace and add
"eslint.workingDirectories":["{YOUR_FOLDER}"]
to the"settings"
object.If anyone else ends up here with this error, I’m embarrassed to say that in my case, I had manually typed a11y as “ally” with the letter “l” in my eslintrc.
You sir, just fixed my whole life ❤️
Ok, it’s worked. Thanks.
I did this and the issue was resolved. Basically, I ran his command in my work directory:
rm -r node_modules/ && rm package-lock.json && npm i -f
and that was all.Hope this helps someone.
-delete node modules and package-lock.json
@ljharb - Ah. Yes, it might be a VS code issue, then. If I manually run eslint, like this:
Then it correctly outputs some lint errors. I’ll set up an auto-linting on save script so I can at least see the output in the console. Hopefully VS Code will fix the issue soon.
eta: Thanks for the info!
I am having the same issue but this solution doesn’t make sense for me. Just working in a simple create-react-app. I have not touched any related to ESLINT and my project was working fine last night but yet when I opened my project this morning this error appeared…
No higher level project folders and I’m opening directly into the CRA through VSCODE
Global configs are deprecated in eslint. Everything should be only installed, and configured, per-project.
Thanks for the answer. After many attempts. I managed to solve the problem.
When I installed the extension esLint and prettier at vsCode, was enabled globally (/Users/macbook/Documents/).
For resolved my problem, I set the parameter root = true in .eslintrc.js. That way eslint started to capture the file correctly. Look:
Wrong Karan 😁 cc: @karanalpe
The same error here. I tried many things
I’m using:
Look this error:
I NEED HELP
I did not get the solution of top level folder and blah blah blah. I mean I did not understand. Anyone please explain a bit more. In my case I have a simple react folder template
E:/react/my app/
and all src, node modules public lies in the given file path.Thank you! I confirm that this worked for me too! just launched a
yarn init
at the root of my repo, copied the code below and then typedyarn