[英]Always getting 'definition for rule 'no-useless-catch' was not found' in Eslint (v 6.0.0) when doing import React
I have tried to google this but to no avail so far...我试过谷歌这个,但到目前为止无济于事......
In a standard React project, every component typically begins with import React from 'react'
.在标准的 React 项目中,每个组件通常都以
import React from 'react'
开头。 For me, with Eslint v6.0.0 configured to extend: 'standard', "eslint:recommended", "plugin:react/recommended"
I always get this warning in vscode:对我来说,将 Eslint v6.0.0 配置为扩展:
'standard', "eslint:recommended", "plugin:react/recommended"
我总是在 vscode 中收到这个警告:
Definition for rule 'no-useless-catch' was not foundeslint(no-useless-catch)
.. for the very first import
in a javascript file. .. 在 javascript 文件中的第一次
import
。
Any ideas on why this is happening?关于为什么会发生这种情况的任何想法? I don't want to disable the rule because it does seem useful but how do I configure eslint to not complain about this in literally every file in the project?
我不想禁用该规则,因为它看起来确实很有用,但是我如何配置 eslint 才不会在项目中的每个文件中都抱怨这个?
Here is the complete eslintrc file:这是完整的 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,
}
}
没关系,弄清楚......我使用的是 eslint 5.6,直到 5.11 才引入no-useless-catch
规则,因此错误......
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.