我已经尝试过用Google搜索这个工具,但到目前为止还是无济于事...
在标准的React项目中,每个组件通常以import React from 'react'
开头。对我来说,将Eslint v6.0.0配置为扩展:'standard', "eslint:recommended", "plugin:react/recommended"
,我总是在vscode中收到此警告:
Definition for rule 'no-useless-catch' was not foundeslint(no-useless-catch)
..表示JavaScript文件中的第一个import
。
关于为什么会这样的任何想法?我不想禁用该规则,因为它似乎很有用,但是我如何配置eslint在项目中的每个文件中都不要抱怨呢?
这是完整的eslintrc文件:
module.exports = {
env: {
browser: true,
es6: true
},
parser: 'babel-eslint',
extends: [
'standard',
"eslint:recommended",
"plugin:react/recommended"
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly'
},
parserOptions: {
ecmaFeatures: {
jsx: true
},
ecmaVersion: 2018,
sourceType: 'module'
},
plugins: [
'react'
],
rules: {
"quotes": ["warn", "single"],
"indent": ["warn", "tab", { "ignoreComments": true }],
"no-tabs": 0,
"padded-blocks": 0,
"semi": ["warn", "never"],
"no-trailing-spaces": 0,
"spaced-comment": 0,
"no-multiple-empty-lines": 0,
"space-before-function-paren": 0,
"camelcase": 0,
"prefer-const": "warn",
"space-infix-ops": "warn",
"no-case-declarations": 0,
}
}
答案 0 :(得分:2)
没关系,弄清楚了……我使用的是eslint 5.6,no-useless-catch
规则直到5.11才引入,因此出现了错误...