Solvedjavascript 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.

30 Answers

✔️Accepted Answer

@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:

/Users/user/Documents/GitHub/app/frontend/

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.

Other Answers:

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.

@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:

/Users/user/Documents/GitHub/app/frontend/

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.

Ok, it's worked. Thanks.

@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:

/Users/user/Documents/GitHub/app/frontend/

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.

You sir, just fixed my whole life <3

More Issues: