这是我的 eslintrc.js 文件:
module.exports = {
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"react",
"simple-import-sort",
"eslint-plugin-simple-import-sort",
],
"rules": {
/*code removed*/
'sort-imports': 'off',
'lines-between-class-members': [
'error',
'always'
],
'simple-import-sort/sort': [
'error',
// fixed by reporting in https://github.com/lydell/eslint-plugin-simple-import-sort/issues/54
{
groups: [
[
'^@?[a-z]'
], // anything that starts with @ and lowercase
[
'^[^.\\u0000]'
], // anything but a dot and side effect imports
[
'^\\.'
], // starting with dot
[
'^\\u0000'
] // side effect imports
]
}
],
'react/jsx-curly-spacing': [
2,
{
when: 'always',
allowMultiline: false,
children: true
}
],
'max-len': [
'error',
{
code: 150,
ignorePattern: 'logger.'
}
]
},
"parser": "babel-eslint"
};
已经尝试过:Definition for rule 'simple-import-sort/sort' was not found simple-import-sort/sort
和 https://github.com/lydell/eslint-plugin-simple-import-sort#usage
有人可以推荐吗?
谢谢。