Eslint 冗余警告
Eslint redundant warnings
我有很多来自 eslint 的冗余和奇怪的输出,我不知道如何禁用它。在下面的屏幕截图中,您可以看到每个文件中有 5 或 6 个与实际代码问题无关的重复问题。
例如每个文件的第一行都包含此警告。
Rule 'no-reserved-keys' was removed and replaced by: quote-props
在 .eslintrc 规则中,quote-props 被禁用。
"quote-props": 0
但是启用了 no-reserverd-keys 规则
"no-reserved-keys": 1
他们在 additionalRuleMetadata 部分定义:
"no-reserved-keys": {
"severity": "w",
"help": "http://eslint.org/docs/rules/no-reserved-keys",
"priority": "major",
"category": "Possible Error"
},
"quote-props": {
"severity": "i",
"help": "http://eslint.org/docs/rules/quote-props",
"category": "Stylistic Issue"
},
那么问题来了。如何摆脱这些多余的警告?
看来您正在定义 ESLint 1.0 规则,但使用的是 ESLint 2.0。
根据 ESLint docs for no-reserved-keys
:
Replacement notice: This rule was removed in ESLint v1.0 and replaced by the quote-props rule.
您可以从 ESLint 配置中删除 no-reserved-keys
规则,但保留 quote-props
原样,多余的警告应该会消失。
同样适用于:
space-return-throw-case
no-wrap-func
global-strict
no-empty-label
每个都已替换为您看到的警告中提到的规则。有关 migrating to ESLint 2.0.
的更多信息
我有很多来自 eslint 的冗余和奇怪的输出,我不知道如何禁用它。在下面的屏幕截图中,您可以看到每个文件中有 5 或 6 个与实际代码问题无关的重复问题。
例如每个文件的第一行都包含此警告。
Rule 'no-reserved-keys' was removed and replaced by: quote-props
在 .eslintrc 规则中,quote-props 被禁用。
"quote-props": 0
但是启用了 no-reserverd-keys 规则
"no-reserved-keys": 1
他们在 additionalRuleMetadata 部分定义:
"no-reserved-keys": {
"severity": "w",
"help": "http://eslint.org/docs/rules/no-reserved-keys",
"priority": "major",
"category": "Possible Error"
},
"quote-props": {
"severity": "i",
"help": "http://eslint.org/docs/rules/quote-props",
"category": "Stylistic Issue"
},
那么问题来了。如何摆脱这些多余的警告?
看来您正在定义 ESLint 1.0 规则,但使用的是 ESLint 2.0。
根据 ESLint docs for no-reserved-keys
:
Replacement notice: This rule was removed in ESLint v1.0 and replaced by the quote-props rule.
您可以从 ESLint 配置中删除 no-reserved-keys
规则,但保留 quote-props
原样,多余的警告应该会消失。
同样适用于:
space-return-throw-case
no-wrap-func
global-strict
no-empty-label
每个都已替换为您看到的警告中提到的规则。有关 migrating to ESLint 2.0.
的更多信息