Пытаюсь подключить ESLint к React проекту. Создал конфиг (eslintrc.js):
module.exports = {
env: {
browser: true,
es2020: true,
node: true,
jest: true,
},
extends: [
'plugin:react/recommended',
'airbnb',
],
settings: {
'import/resolver': {
node: {
paths: ['src'],
},
},
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 11,
sourceType: 'module',
},
plugins: [
'react',
'@typescript-eslint',
],
rules: {
'react/prop-types': 'off',
indent: [2, 'tab'],
'react/jsx-indent': [2, 'tab'],
'react/jsx-indent-props': [2, 'tab'],
'no-tabs': 'off',
'import/no-unresolved': 'warn',
'object-curly-spacing': 'off',
'react/jsx-filename-extension': [1, {extensions: ['.js', '.jsx']}],
},
};
Но выпадает ошибка
Error: Plugin "react" was conflicted between ".eslintrc.js" and "../.eslintrc".
Полный лог:
Error: Plugin "react" was conflicted between ".eslintrc.js" and "../.eslintrc".
at mergePlugins (/Users/account/Documents/web-km-client/node_modules/eslint/lib/cli-engine/config-array/config-array.js:202:19)
at createConfig (/Users/account/Documents/web-km-client/node_modules/eslint/lib/cli-engine/config-array/config-array.js:305:9)
at ConfigArray.extractConfig (/Users/account/Documents/web-km-client/node_modules/eslint/lib/cli-engine/config-array/config-array.js:481:33)
at CLIEngine.isPathIgnored (/Users/account/Documents/web-km-client/node_modules/eslint/lib/cli-engine/cli-engine.js:954:18)
at ESLintPlugin.invokeESLint (/Applications/WebStorm.app/Contents/plugins/JavaScriptLanguage/languageService/eslint/bin/eslint-plugin.js:100:23)
at ESLintPlugin.getErrors (/Applications/WebStorm.app/Contents/plugins/JavaScriptLanguage/languageService/eslint/bin/eslint-plugin.js:78:21)
at ESLintPlugin.onMessage (/Applications/WebStorm.app/Contents/plugins/JavaScriptLanguage/languageService/eslint/bin/eslint-plugin.js:52:64)
at Interface.<anonymous> (/Applications/WebStorm.app/Contents/plugins/JavaScriptLanguage/jsLanguageServicesImpl/js-language-service.js:105:39)
at Interface.emit (events.js:315:20)
at Interface._onLine (readline.js:329:10)
Интересно, что в VSCode все работает, а в WebStorm - нет