Home>

WebStorm in open .eslintrc.js file shows error

Initialization error (ESLint). Cannot find module '@ eslint /eslintrc /universal'

I suffered for a long time, but I still didn't understand what it was.
I also tried to deletenode_modulesand reinstall all dependencies, but that didn't help.

p.s. -I do everything exactly as in this lesson https://www.youtube.com/watch?v=z0rkLRLU6Dw

My files:

.eslintrc.js :

module.exports= {
  parser: '@ typescript-eslint /parser',
  parserOptions: {
    ecmaVersion: 2020,
    sourceType: 'module',
  },
  settings: {
    react: {
      version: 'detect',
    },
  },
  extends: [
    'plugin: react /recommended',
    'plugin: react-hooks /recommended',
    'plugin: @ typescript-eslint /recommended',
    'plugin: import /errors',
    'plugin: import /warnings',
    'plugin: import /typescript',
    'plugin: jsx-a11y /recommended',
    'plugin: eslint-comments /recommended',
    'prettier /@ typescript-eslint',
    'plugin: prettier /recommended',
  ],
  rules: {
    'no-unused-vars': 'off',
    '@ typescript-eslint /no-unused-vars': ['error'],
    '@ typescript-eslint /no-var-requires': 'off',
    'react /prop-types': 'off',
    'react /jsx-uses-react': 'off',
    'react /react-in-jsx-scope': 'off',
    '@ typescript-eslint /explicit-module-boundary-types': 'off',
  },
}

Installed dependencies package.json :

"devDependencies": {
    "@ babel /core": "^ 7.15.0",
    "@ babel /preset-env": "^ 7.15.0",
    "@ babel /preset-react": "^ 7.14.5",
    "@ babel /preset-typescript": "^ 7.15.0",
    "@ pmmmwh /react-refresh-webpack-plugin": "^ 0.5.1",
    "@ types /react": "^ 17.0.19",
    "@ types /react-dom": "^ 17.0.9",
    "@ typescript-eslint /eslint-plugin": "^ 5.0.0",
    "@ typescript-eslint /parser": "^ 5.0.0",
    "babel-loader": "^ 8.2.2",
    "css-loader": "^ 6.2.0",
    "eslint": "^ 8.0.0",
    "eslint-plugin-import": "^ 2.25.1",
    "eslint-plugin-jsx-a11y": "^ 6.4.1",
    "eslint-plugin-react": "^ 7.26.1",
    "eslint-plugin-react-hooks": "^ 4.2.0",
    "html-webpack-plugin": "^ 5.3.2",
    "react-refresh": "^ 0.10.0",
    "style-loader": "^ 3.2.1",
    "typescript": "^ 4.4.3",
    "webpack": "^ 5.51.1",
    "webpack-cli": "^ 4.8.0",
    "webpack-dev-server": "^ 4.0.0",
    "webpack-merge": "^ 5.8.0"
  },

Which version of Node.js are you using? Check the settings in Settings | Languages ​​&Frameworks | Node.js and NPM. See github.com/eslint/eslint/issues/14986

lena2021-10-14 02:00:09

@lena (Node v12.14.1) (npm 8.0.0)

HaZcker2021-10-14 02:00:09