Ошибка eslint: ошибка при загрузке правила 'react/jsx-key'
При настройке линтинга для моего проекта next.js/typescript я столкнулся с этой проблемой. Всякий раз, когда я пытаюсь бежать
npx eslint . --ext .ts,.tsx
или плагин eslint в VS Code, я получаю эту ошибку:
Error: Error while loading rule 'react/jsx-key': Fragment pragma React.Fragment is not a valid identifier
Occurred while linting ...
Google, а также поиск stackru ничего мне не дали (насколько я могу судить).
я бегу
eslint@7.10.0
и
eslint-plugin-react@7.20.6
. Оба устанавливались локально (но я пробовал и глобальную установку).
Также я попытался переустановить свой
node_modules
.
Мой
eslintrc
выглядит следующим образом:
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
"ecmaFeatures": {
"jsx": true
},
},
plugins: ['@typescript-eslint', 'react'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'prettier',
'prettier/@typescript-eslint',
],
settings: {
react: {
createClass: 'createReactClass', // Regex for Component Factory to use,
// default to "createReactClass"
pragma: 'React', // Pragma to use, default to "React"
fragment: 'React.Fragment', // Fragment to use, default to "React.Fragment"
version: 'detect', // React version. "detect" automatically picks the version you have installed.
// You can also use `16.0`, `16.3`, etc, if you want to override the detected value.
// default to latest and warns if missing
// It will default to "detect" in the future
flowVersion: '0.53', // Flow version
},
propWrapperFunctions: [
// The names of any function used to wrap propTypes, e.g. `forbidExtraProps`. If this isn't set, any propTypes wrapped in a function will be skipped.
'forbidExtraProps',
{
property: 'freeze',
object: 'Object',
},
{
property: 'myFavoriteWrapper',
},
],
linkComponents: [
// Components used as alternatives to <a> for linking, eg. <Link to={ url } />
'Hyperlink',
{
name: 'Link',
linkAttribute: 'to',
},
],
},
};
Я чувствую, что у меня довольно стандартная установка, так что кто-нибудь знает, где может быть проблема?
Спасибо всем заранее!