找不到规则'simple-import-sort/sort'的定义simple-import-sort/sort [英] Definition for rule 'simple-import-sort/sort' was not found simple-import-sort/sort
本文介绍了找不到规则'simple-import-sort/sort'的定义simple-import-sort/sort的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用simple-import-sort eslint插件进行反应.我认为我的 .eslintrc.js
是正确的,但是我无法使此特定插件正常工作.我在文件的第一行出现以下错误:
I'm using react with the simple-import-sort eslint plugin. I think my .eslintrc.js
is right, but I'm not able to make this specific plugin work. I get the following errors at the first line of my files:
找不到规则'simple-import-sort/sort'的定义
这是我的配置:
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'eslint:recommended',
'airbnb-typescript',
'airbnb/hooks',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:import/recommended',
'plugin:jest/recommended',
'plugin:jsx-a11y/recommended',
'plugin:prettier/recommended',
'plugin:react/recommended',
'prettier',
'prettier/@typescript-eslint',
'prettier/react',
],
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
project: './tsconfig.json',
},
ignorePatterns: ['*.js'],
plugins: ['react', 'prettier', 'import', 'simple-import-sort'],
rules: {
'prettier/prettier': ['error'],
'no-underscore-dangle': 'off',
'no-async-promise-executor': 'warn',
'no-unused-vars': 'error',
'object-shorthand': ["error", "always"],
'react/destructuring-assignment': ['off', 'never'],
'react/jsx-filename-extension': ['warn', { extensions: ['.tsx', '.js', '.jsx'] }],
'react/jsx-uses-react': 'error',
'react/jsx-uses-vars': 'error',
'react/no-unescaped-entities': 'off',
'react/jsx-no-undef': ['error', { allowGlobals: true }],
'react/jsx-props-no-spreading': 'warn',
'react/prop-types': 'off',
'react-hooks/exhaustive-deps': 'off',
'sort-imports': 'off',
'simple-import-sort/sort': 'error',
'import/order': 'off',
'import/prefer-default-export': 'off',
'import/extensions': 'off',
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
// '@typescript-eslint/camelcase': ['error', { properties: 'never' }],
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'jsx-a11y/anchor-is-valid': 'off',
'jsx-a11y/no-static-element-interactions': 'off',
},
};
推荐答案
可能是您使用的是v6.
It may be that you're using v6.
v6似乎没有 simple-import-sort/sort
规则,请参见从11月15日的v5更改.
It looks like v6 doesn't have a simple-import-sort/sort
rule, see usage in the README. This was a change from v5 on Nov 15.
您可能需要进行以下更改:
You probably need to make the following change:
- 'simple-import-sort/sort': 'error',
+ 'simple-import-sort/imports': 'error',
这篇关于找不到规则'simple-import-sort/sort'的定义simple-import-sort/sort的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文