将 "eslint:recommended" 更改为警告
Change "eslint:recommended" to warnings
我正在使用
"extends": "eslint:recommended",
在我的 .eslintrc
文件中。默认情况下,这些规则会使 lint 失败。有没有办法让我将它们全部更改为警告而不必单独指定每个警告?那么,有没有办法集体更改扩展规则集的规则级别?
例如,我希望能够做如下事情:
"extends": [
["eslint:recommended", 1]
],
如@Gyandeep 所述,不:http://eslint.org/docs/user-guide/configuring.html#configuring-rules
我写了一个脚本来减轻你的痛苦:
#!/bin/sh
list=$(curl -silent http://eslint.org/docs/rules/ | grep '(recommended)' | sed -e 's,.*<a .*>\([^<]*\)</a>.*,,g' | grep -v 'configuration documentation')
for rule in ${list}; do
echo \"$rule\": 1,
done;
这将导致:
"comma-dangle": 1,
"no-cond-assign": 1,
"no-console": 1,
"no-constant-condition": 1,
"no-control-regex": 1,
"no-debugger": 1,
"no-dupe-args": 1,
"no-dupe-keys": 1,
"no-duplicate-case": 1,
"no-empty-character-class": 1,
"no-empty": 1,
"no-ex-assign": 1,
"no-extra-boolean-cast": 1,
"no-extra-semi": 1,
"no-func-assign": 1,
"no-inner-declarations": 1,
"no-invalid-regexp": 1,
"no-irregular-whitespace": 1,
"no-negated-in-lhs": 1,
"no-obj-calls": 1,
"no-regex-spaces": 1,
"no-sparse-arrays": 1,
"no-unreachable": 1,
"use-isnan": 1,
"valid-typeof": 1,
"no-fallthrough": 1,
"no-octal": 1,
"no-redeclare": 1,
"no-delete-var": 1,
"no-undef": 1,
"no-unused-vars": 1,
"no-mixed-spaces-and-tabs": 1,
如果您查看此处:http://eslint.org/docs/rules/,您会注意到 eslint:recommended
包含的规则后跟 (recommended)
。该脚本拉取网站,使用 (recommended)
对行进行 geps,然后使用 sed
执行一些正则表达式魔术,从锚标记中提取规则。
别忘了取出最后一个 ,
- 我必须留点东西给你做 ;) - 并将其插入你的 .eslintrc
文件中:
"rules": {
...output of script goes here...
}
如果您不熟悉 bash 脚本,请不要忘记使其可执行...更简单,只需复制我在上面粘贴的输出即可! :)
希望对您有所帮助。
我知道聚会迟到了,但由于 eslint
网站的结构更改,接受的答案已过期,我创建了一个新列表,所有规则都设置为 warn
//React ESLint
"react/boolean-prop-naming": "warn",
"react/button-has-type": "warn",
"react/default-props-match-prop-types": "warn",
"react/destructuring-assignment": "warn",
"react/display-name": "warn",
"react/forbid-component-props": "warn",
"react/forbid-dom-props": "warn",
"react/forbid-elements": "warn",
"react/forbid-prop-types": "warn",
"react/forbid-foreign-prop-types": "warn",
"react/no-access-state-in-setstate": "warn",
"react/no-array-index-key": "warn",
"react/no-children-prop": "warn",
"react/no-danger": "warn",
"react/no-danger-with-children": "warn",
"react/no-deprecated": "warn",
"react/no-did-mount-set-state": "warn",
"react/no-did-update-set-state": "warn",
"react/no-direct-mutation-state": "warn",
"react/no-find-dom-node": "warn",
"react/no-is-mounted": "warn",
"react/no-multi-comp": "warn",
"react/no-redundant-should-component-update": "warn",
"react/no-render-return-value": "warn",
"react/no-set-state": "warn",
"react/no-typos": "warn",
"react/no-string-refs": "warn",
"react/no-this-in-sfc": "warn",
"react/no-unescaped-entities": "warn",
"react/no-unknown-property": "warn",
"react/no-unused-prop-types": "warn",
"react/no-unused-state": "warn",
"react/no-will-update-set-state": "warn",
"react/prefer-es6-class": "warn",
"react/prop-types": "warn",
"react/react-in-jsx-scope": "warn",
"react/require-default-props": "warn",
"react/require-optimization": "warn",
"react/require-render-return": "warn",
"react/self-closing-comp": "warn",
"react/sort-comp": "warn",
"react/sort-prop-types": "warn",
"react/style-prop-object": "warn",
"react/void-dom-elements-no-children": "warn",
"react/jsx-boolean-value": "warn",
"react/jsx-child-element-spacing": "warn",
"react/jsx-closing-bracket-location": "warn",
"react/jsx-closing-tag-location": "warn",
"react/jsx-curly-spacing": "warn",
"react/jsx-equals-spacing": "warn",
"react/jsx-first-prop-new-line": "warn",
"react/jsx-handler-names": "warn",
"react/jsx-indent": "warn",
"react/jsx-indent-props": "warn",
"react/jsx-key": "warn",
"react/jsx-max-depth": "warn",
"react/jsx-max-props-per-line": "warn",
"react/jsx-no-bind": "warn",
"react/jsx-no-comment-textnodes": "warn",
"react/jsx-no-duplicate-props": "warn",
"react/jsx-no-literals": "warn",
"react/jsx-no-target-blank": "warn",
"react/jsx-no-undef": "warn",
"react/jsx-one-expression-per-line": "warn",
"react/jsx-curly-brace-presence": "warn",
"react/jsx-pascal-case": "warn",
"react/jsx-props-no-multi-spaces": "warn",
"react/jsx-sort-default-props": "warn",
"react/jsx-sort-props": "warn",
"react/jsx-space-before-closing": "warn",
"react/jsx-tag-spacing": "warn",
"react/jsx-uses-react": "warn",
"react/jsx-uses-vars": "warn",
"react/jsx-wrap-multilines": "warn",
// Default ESLint
"for-direction": "warn",
"getter-return": "warn",
"no-await-in-loop": "warn",
"no-compare-neg-zero": "warn",
"no-cond-assign": "warn",
"no-console": "warn",
"no-constant-condition": "warn",
"no-control-regex": "warn",
"no-debugger": "warn",
"no-dupe-args": "warn",
"no-dupe-keys": "warn",
"no-duplicate-case": "warn",
"no-empty": "warn",
"no-empty-character-class": "warn",
"no-ex-assign": "warn",
"no-extra-boolean-cast": "warn",
"no-extra-parens": "warn",
"no-extra-semi": "warn",
"no-func-assign": "warn",
"no-inner-declarations": "warn",
"no-invalid-regexp": "warn",
"no-irregular-whitespace": "warn",
"no-obj-calls": "warn",
"no-prototype-builtins": "warn",
"no-regex-spaces": "warn",
"no-sparse-arrays": "warn",
"no-template-curly-in-string": "warn",
"no-unexpected-multiline": "warn",
"no-unreachable": "warn",
"no-unsafe-finally": "warn",
"no-unsafe-negation": "warn",
"use-isnan": "warn",
"valid-jsdoc": "warn",
"valid-typeof": "warn",
"accessor-pairs": "warn",
"array-callback-return": "warn",
"block-scoped-var": "warn",
"class-methods-use-this": "warn",
"complexity": "warn",
"consistent-return": "warn",
"curly": "warn",
"default-case": "warn",
"dot-location": "warn",
"dot-notation": "warn",
"eqeqeq": "warn",
"guard-for-in": "warn",
"max-classes-per-file": "warn",
"no-alert": "warn",
"no-caller": "warn",
"no-case-declarations": "warn",
"no-div-regex": "warn",
"no-else-return": "warn",
"no-empty-function": "warn",
"no-empty-pattern": "warn",
"no-eq-null": "warn",
"no-eval": "warn",
"no-extend-native": "warn",
"no-extra-bind": "warn",
"no-extra-label": "warn",
"no-fallthrough": "warn",
"no-floating-decimal": "warn",
"no-global-assign": "warn",
"no-implicit-coercion": "warn",
"no-implicit-globals": "warn",
"no-implied-eval": "warn",
"no-invalid-this": "warn",
"no-iterator": "warn",
"no-labels": "warn",
"no-lone-blocks": "warn",
"no-loop-func": "warn",
"no-magic-numbers": "warn",
"no-multi-spaces": "warn",
"no-multi-str": "warn",
"no-new": "warn",
"no-new-func": "warn",
"no-new-wrappers": "warn",
"no-octal": "warn",
"no-octal-escape": "warn",
"no-param-reassign": "warn",
"no-proto": "warn",
"no-redeclare": "warn",
"no-restricted-properties": "warn",
"no-return-assign": "warn",
"no-return-await": "warn",
"no-script-url": "warn",
"no-self-assign": "warn",
"no-self-compare": "warn",
"no-sequences": "warn",
"no-throw-literal": "warn",
"no-unmodified-loop-condition": "warn",
"no-unused-expressions": "warn",
"no-unused-labels": "warn",
"no-useless-call": "warn",
"no-useless-concat": "warn",
"no-useless-escape": "warn",
"no-useless-return": "warn",
"no-void": "warn",
"no-warning-comments": "warn",
"no-with": "warn",
"prefer-promise-reject-errors": "warn",
"radix": "warn",
"require-await": "warn",
"vars-on-top": "warn",
"wrap-iife": "warn",
"yoda": "warn",
"strict": "warn",
"init-declarations": "warn",
"no-catch-shadow": "warn",
"no-delete-var": "warn",
"no-label-var": "warn",
"no-restricted-globals": "warn",
"no-shadow": "warn",
"no-shadow-restricted-names": "warn",
"no-undef": "warn",
"no-undef-init": "warn",
"no-undefined": "warn",
"no-unused-vars": "warn",
"no-use-before-define": "warn",
"callback-return": "warn",
"global-require": "warn",
"handle-callback-err": "warn",
"no-buffer-constructor": "warn",
"no-mixed-requires": "warn",
"no-new-require": "warn",
"no-path-concat": "warn",
"no-process-env": "warn",
"no-process-exit": "warn",
"no-restricted-modules": "warn",
"no-sync": "warn",
"array-bracket-newline": "warn",
"array-bracket-spacing": "warn",
"array-element-newline": "warn",
"block-spacing": "warn",
"brace-style": "warn",
"camelcase": "warn",
"capitalized-comments": "warn",
"comma-dangle": "warn",
"comma-spacing": "warn",
"comma-style": "warn",
"computed-property-spacing": "warn",
"consistent-this": "warn",
"eol-last": "warn",
"func-call-spacing": "warn",
"func-name-matching": "warn",
"func-names": "warn",
"func-style": "warn",
"function-paren-newline": "warn",
"id-blacklist": "warn",
"id-length": "warn",
"id-match": "warn",
"implicit-arrow-linebreak": "warn",
"indent": "warn",
"jsx-quotes": "warn",
"key-spacing": "warn",
"keyword-spacing": "warn",
"line-comment-position": "warn",
"linebreak-style": "warn",
"lines-around-comment": "warn",
"lines-between-class-members": "warn",
"max-depth": "warn",
"max-len": "warn",
"max-lines": "warn",
"max-nested-callbacks": "warn",
"max-params": "warn",
"max-statements": "warn",
"max-statements-per-line": "warn",
"multiline-comment-style": "warn",
"multiline-ternary": "warn",
"new-cap": "warn",
"new-parens": "warn",
"newline-per-chained-call": "warn",
"no-array-constructor": "warn",
"no-bitwise": "warn",
"no-continue": "warn",
"no-inline-comments": "off",
"no-lonely-if": "warn",
"no-mixed-operators": "warn",
"no-mixed-spaces-and-tabs": "warn",
"no-multi-assign": "warn",
"no-multiple-empty-lines": "warn",
"no-negated-condition": "warn",
"no-nested-ternary": "warn",
"no-new-object": "warn",
"no-plusplus": "warn",
"no-restricted-syntax": "warn",
"no-tabs": "warn",
"no-ternary": "warn",
"no-trailing-spaces": "warn",
"no-underscore-dangle": "warn",
"no-unneeded-ternary": "warn",
"no-whitespace-before-property": "warn",
"nonblock-statement-body-position": "warn",
"object-curly-newline": "warn",
"object-curly-spacing": "warn",
"object-property-newline": "warn",
"one-var": "warn",
"one-var-declaration-per-line": "warn",
"operator-assignment": "warn",
"operator-linebreak": "warn",
"padded-blocks": "warn",
"padding-line-between-statements": "warn",
"prefer-object-spread": "warn",
"quote-props": "warn",
"quotes": "warn",
"require-jsdoc": "warn",
"semi": "warn",
"semi-spacing": "warn",
"semi-style": "warn",
"sort-keys": "warn",
"sort-vars": "warn",
"space-before-blocks": "warn",
"space-before-function-paren": "warn",
"space-in-parens": "warn",
"space-infix-ops": "warn",
"space-unary-ops": "warn",
"spaced-comment": "warn",
"switch-colon-spacing": "warn",
"template-tag-spacing": "warn",
"unicode-bom": "warn",
"wrap-regex": "warn",
"arrow-body-style": "warn",
"arrow-parens": "warn",
"arrow-spacing": "warn",
"constructor-super": "warn",
"generator-star-spacing": "warn",
"no-class-assign": "warn",
"no-confusing-arrow": "warn",
"no-const-assign": "warn",
"no-dupe-class-members": "warn",
"no-duplicate-imports": "warn",
"no-new-symbol": "warn",
"no-restricted-imports": "warn",
"no-this-before-super": "warn",
"no-useless-computed-key": "warn",
"no-useless-constructor": "warn",
"no-useless-rename": "warn",
"no-var": "warn",
"object-shorthand": "warn",
"prefer-arrow-callback": "warn",
"prefer-const": "warn",
"prefer-destructuring": "warn",
"prefer-numeric-literals": "warn",
"prefer-rest-params": "warn",
"prefer-spread": "warn",
"prefer-template": "warn",
"require-yield": "warn",
"rest-spread-spacing": "warn",
"sort-imports": "warn",
"symbol-description": "warn",
"template-curly-spacing": "warn",
"yield-star-spacing": "warn"
如果您需要将所有 ESLint 错误更改为警告,可以使用 eslint 插件 eslint-plugin-only-warn。
如果你仍然需要一些规则来触发一个完整的错误,你可以试试这个 only-warn 的分支,
eslint-plugin-switch-error-warn(免责声明 - 我是叉子作者)。它将错误转换为警告,反之亦然,因此您可以将特定规则设置为 "warn" 以使它们再次触发错误。这将为您提供指定异常的附加功能,尽管它可能会变得相当混乱!
您还需要将所有默认为警告的规则(例如 'no-console')显式设置为 'error' 模式,让它们仅通过切换器插件发出警告。
我正在使用
"extends": "eslint:recommended",
在我的 .eslintrc
文件中。默认情况下,这些规则会使 lint 失败。有没有办法让我将它们全部更改为警告而不必单独指定每个警告?那么,有没有办法集体更改扩展规则集的规则级别?
例如,我希望能够做如下事情:
"extends": [
["eslint:recommended", 1]
],
如@Gyandeep 所述,不:http://eslint.org/docs/user-guide/configuring.html#configuring-rules
我写了一个脚本来减轻你的痛苦:
#!/bin/sh
list=$(curl -silent http://eslint.org/docs/rules/ | grep '(recommended)' | sed -e 's,.*<a .*>\([^<]*\)</a>.*,,g' | grep -v 'configuration documentation')
for rule in ${list}; do
echo \"$rule\": 1,
done;
这将导致:
"comma-dangle": 1,
"no-cond-assign": 1,
"no-console": 1,
"no-constant-condition": 1,
"no-control-regex": 1,
"no-debugger": 1,
"no-dupe-args": 1,
"no-dupe-keys": 1,
"no-duplicate-case": 1,
"no-empty-character-class": 1,
"no-empty": 1,
"no-ex-assign": 1,
"no-extra-boolean-cast": 1,
"no-extra-semi": 1,
"no-func-assign": 1,
"no-inner-declarations": 1,
"no-invalid-regexp": 1,
"no-irregular-whitespace": 1,
"no-negated-in-lhs": 1,
"no-obj-calls": 1,
"no-regex-spaces": 1,
"no-sparse-arrays": 1,
"no-unreachable": 1,
"use-isnan": 1,
"valid-typeof": 1,
"no-fallthrough": 1,
"no-octal": 1,
"no-redeclare": 1,
"no-delete-var": 1,
"no-undef": 1,
"no-unused-vars": 1,
"no-mixed-spaces-and-tabs": 1,
如果您查看此处:http://eslint.org/docs/rules/,您会注意到 eslint:recommended
包含的规则后跟 (recommended)
。该脚本拉取网站,使用 (recommended)
对行进行 geps,然后使用 sed
执行一些正则表达式魔术,从锚标记中提取规则。
别忘了取出最后一个 ,
- 我必须留点东西给你做 ;) - 并将其插入你的 .eslintrc
文件中:
"rules": {
...output of script goes here...
}
如果您不熟悉 bash 脚本,请不要忘记使其可执行...更简单,只需复制我在上面粘贴的输出即可! :)
希望对您有所帮助。
我知道聚会迟到了,但由于 eslint
网站的结构更改,接受的答案已过期,我创建了一个新列表,所有规则都设置为 warn
//React ESLint
"react/boolean-prop-naming": "warn",
"react/button-has-type": "warn",
"react/default-props-match-prop-types": "warn",
"react/destructuring-assignment": "warn",
"react/display-name": "warn",
"react/forbid-component-props": "warn",
"react/forbid-dom-props": "warn",
"react/forbid-elements": "warn",
"react/forbid-prop-types": "warn",
"react/forbid-foreign-prop-types": "warn",
"react/no-access-state-in-setstate": "warn",
"react/no-array-index-key": "warn",
"react/no-children-prop": "warn",
"react/no-danger": "warn",
"react/no-danger-with-children": "warn",
"react/no-deprecated": "warn",
"react/no-did-mount-set-state": "warn",
"react/no-did-update-set-state": "warn",
"react/no-direct-mutation-state": "warn",
"react/no-find-dom-node": "warn",
"react/no-is-mounted": "warn",
"react/no-multi-comp": "warn",
"react/no-redundant-should-component-update": "warn",
"react/no-render-return-value": "warn",
"react/no-set-state": "warn",
"react/no-typos": "warn",
"react/no-string-refs": "warn",
"react/no-this-in-sfc": "warn",
"react/no-unescaped-entities": "warn",
"react/no-unknown-property": "warn",
"react/no-unused-prop-types": "warn",
"react/no-unused-state": "warn",
"react/no-will-update-set-state": "warn",
"react/prefer-es6-class": "warn",
"react/prop-types": "warn",
"react/react-in-jsx-scope": "warn",
"react/require-default-props": "warn",
"react/require-optimization": "warn",
"react/require-render-return": "warn",
"react/self-closing-comp": "warn",
"react/sort-comp": "warn",
"react/sort-prop-types": "warn",
"react/style-prop-object": "warn",
"react/void-dom-elements-no-children": "warn",
"react/jsx-boolean-value": "warn",
"react/jsx-child-element-spacing": "warn",
"react/jsx-closing-bracket-location": "warn",
"react/jsx-closing-tag-location": "warn",
"react/jsx-curly-spacing": "warn",
"react/jsx-equals-spacing": "warn",
"react/jsx-first-prop-new-line": "warn",
"react/jsx-handler-names": "warn",
"react/jsx-indent": "warn",
"react/jsx-indent-props": "warn",
"react/jsx-key": "warn",
"react/jsx-max-depth": "warn",
"react/jsx-max-props-per-line": "warn",
"react/jsx-no-bind": "warn",
"react/jsx-no-comment-textnodes": "warn",
"react/jsx-no-duplicate-props": "warn",
"react/jsx-no-literals": "warn",
"react/jsx-no-target-blank": "warn",
"react/jsx-no-undef": "warn",
"react/jsx-one-expression-per-line": "warn",
"react/jsx-curly-brace-presence": "warn",
"react/jsx-pascal-case": "warn",
"react/jsx-props-no-multi-spaces": "warn",
"react/jsx-sort-default-props": "warn",
"react/jsx-sort-props": "warn",
"react/jsx-space-before-closing": "warn",
"react/jsx-tag-spacing": "warn",
"react/jsx-uses-react": "warn",
"react/jsx-uses-vars": "warn",
"react/jsx-wrap-multilines": "warn",
// Default ESLint
"for-direction": "warn",
"getter-return": "warn",
"no-await-in-loop": "warn",
"no-compare-neg-zero": "warn",
"no-cond-assign": "warn",
"no-console": "warn",
"no-constant-condition": "warn",
"no-control-regex": "warn",
"no-debugger": "warn",
"no-dupe-args": "warn",
"no-dupe-keys": "warn",
"no-duplicate-case": "warn",
"no-empty": "warn",
"no-empty-character-class": "warn",
"no-ex-assign": "warn",
"no-extra-boolean-cast": "warn",
"no-extra-parens": "warn",
"no-extra-semi": "warn",
"no-func-assign": "warn",
"no-inner-declarations": "warn",
"no-invalid-regexp": "warn",
"no-irregular-whitespace": "warn",
"no-obj-calls": "warn",
"no-prototype-builtins": "warn",
"no-regex-spaces": "warn",
"no-sparse-arrays": "warn",
"no-template-curly-in-string": "warn",
"no-unexpected-multiline": "warn",
"no-unreachable": "warn",
"no-unsafe-finally": "warn",
"no-unsafe-negation": "warn",
"use-isnan": "warn",
"valid-jsdoc": "warn",
"valid-typeof": "warn",
"accessor-pairs": "warn",
"array-callback-return": "warn",
"block-scoped-var": "warn",
"class-methods-use-this": "warn",
"complexity": "warn",
"consistent-return": "warn",
"curly": "warn",
"default-case": "warn",
"dot-location": "warn",
"dot-notation": "warn",
"eqeqeq": "warn",
"guard-for-in": "warn",
"max-classes-per-file": "warn",
"no-alert": "warn",
"no-caller": "warn",
"no-case-declarations": "warn",
"no-div-regex": "warn",
"no-else-return": "warn",
"no-empty-function": "warn",
"no-empty-pattern": "warn",
"no-eq-null": "warn",
"no-eval": "warn",
"no-extend-native": "warn",
"no-extra-bind": "warn",
"no-extra-label": "warn",
"no-fallthrough": "warn",
"no-floating-decimal": "warn",
"no-global-assign": "warn",
"no-implicit-coercion": "warn",
"no-implicit-globals": "warn",
"no-implied-eval": "warn",
"no-invalid-this": "warn",
"no-iterator": "warn",
"no-labels": "warn",
"no-lone-blocks": "warn",
"no-loop-func": "warn",
"no-magic-numbers": "warn",
"no-multi-spaces": "warn",
"no-multi-str": "warn",
"no-new": "warn",
"no-new-func": "warn",
"no-new-wrappers": "warn",
"no-octal": "warn",
"no-octal-escape": "warn",
"no-param-reassign": "warn",
"no-proto": "warn",
"no-redeclare": "warn",
"no-restricted-properties": "warn",
"no-return-assign": "warn",
"no-return-await": "warn",
"no-script-url": "warn",
"no-self-assign": "warn",
"no-self-compare": "warn",
"no-sequences": "warn",
"no-throw-literal": "warn",
"no-unmodified-loop-condition": "warn",
"no-unused-expressions": "warn",
"no-unused-labels": "warn",
"no-useless-call": "warn",
"no-useless-concat": "warn",
"no-useless-escape": "warn",
"no-useless-return": "warn",
"no-void": "warn",
"no-warning-comments": "warn",
"no-with": "warn",
"prefer-promise-reject-errors": "warn",
"radix": "warn",
"require-await": "warn",
"vars-on-top": "warn",
"wrap-iife": "warn",
"yoda": "warn",
"strict": "warn",
"init-declarations": "warn",
"no-catch-shadow": "warn",
"no-delete-var": "warn",
"no-label-var": "warn",
"no-restricted-globals": "warn",
"no-shadow": "warn",
"no-shadow-restricted-names": "warn",
"no-undef": "warn",
"no-undef-init": "warn",
"no-undefined": "warn",
"no-unused-vars": "warn",
"no-use-before-define": "warn",
"callback-return": "warn",
"global-require": "warn",
"handle-callback-err": "warn",
"no-buffer-constructor": "warn",
"no-mixed-requires": "warn",
"no-new-require": "warn",
"no-path-concat": "warn",
"no-process-env": "warn",
"no-process-exit": "warn",
"no-restricted-modules": "warn",
"no-sync": "warn",
"array-bracket-newline": "warn",
"array-bracket-spacing": "warn",
"array-element-newline": "warn",
"block-spacing": "warn",
"brace-style": "warn",
"camelcase": "warn",
"capitalized-comments": "warn",
"comma-dangle": "warn",
"comma-spacing": "warn",
"comma-style": "warn",
"computed-property-spacing": "warn",
"consistent-this": "warn",
"eol-last": "warn",
"func-call-spacing": "warn",
"func-name-matching": "warn",
"func-names": "warn",
"func-style": "warn",
"function-paren-newline": "warn",
"id-blacklist": "warn",
"id-length": "warn",
"id-match": "warn",
"implicit-arrow-linebreak": "warn",
"indent": "warn",
"jsx-quotes": "warn",
"key-spacing": "warn",
"keyword-spacing": "warn",
"line-comment-position": "warn",
"linebreak-style": "warn",
"lines-around-comment": "warn",
"lines-between-class-members": "warn",
"max-depth": "warn",
"max-len": "warn",
"max-lines": "warn",
"max-nested-callbacks": "warn",
"max-params": "warn",
"max-statements": "warn",
"max-statements-per-line": "warn",
"multiline-comment-style": "warn",
"multiline-ternary": "warn",
"new-cap": "warn",
"new-parens": "warn",
"newline-per-chained-call": "warn",
"no-array-constructor": "warn",
"no-bitwise": "warn",
"no-continue": "warn",
"no-inline-comments": "off",
"no-lonely-if": "warn",
"no-mixed-operators": "warn",
"no-mixed-spaces-and-tabs": "warn",
"no-multi-assign": "warn",
"no-multiple-empty-lines": "warn",
"no-negated-condition": "warn",
"no-nested-ternary": "warn",
"no-new-object": "warn",
"no-plusplus": "warn",
"no-restricted-syntax": "warn",
"no-tabs": "warn",
"no-ternary": "warn",
"no-trailing-spaces": "warn",
"no-underscore-dangle": "warn",
"no-unneeded-ternary": "warn",
"no-whitespace-before-property": "warn",
"nonblock-statement-body-position": "warn",
"object-curly-newline": "warn",
"object-curly-spacing": "warn",
"object-property-newline": "warn",
"one-var": "warn",
"one-var-declaration-per-line": "warn",
"operator-assignment": "warn",
"operator-linebreak": "warn",
"padded-blocks": "warn",
"padding-line-between-statements": "warn",
"prefer-object-spread": "warn",
"quote-props": "warn",
"quotes": "warn",
"require-jsdoc": "warn",
"semi": "warn",
"semi-spacing": "warn",
"semi-style": "warn",
"sort-keys": "warn",
"sort-vars": "warn",
"space-before-blocks": "warn",
"space-before-function-paren": "warn",
"space-in-parens": "warn",
"space-infix-ops": "warn",
"space-unary-ops": "warn",
"spaced-comment": "warn",
"switch-colon-spacing": "warn",
"template-tag-spacing": "warn",
"unicode-bom": "warn",
"wrap-regex": "warn",
"arrow-body-style": "warn",
"arrow-parens": "warn",
"arrow-spacing": "warn",
"constructor-super": "warn",
"generator-star-spacing": "warn",
"no-class-assign": "warn",
"no-confusing-arrow": "warn",
"no-const-assign": "warn",
"no-dupe-class-members": "warn",
"no-duplicate-imports": "warn",
"no-new-symbol": "warn",
"no-restricted-imports": "warn",
"no-this-before-super": "warn",
"no-useless-computed-key": "warn",
"no-useless-constructor": "warn",
"no-useless-rename": "warn",
"no-var": "warn",
"object-shorthand": "warn",
"prefer-arrow-callback": "warn",
"prefer-const": "warn",
"prefer-destructuring": "warn",
"prefer-numeric-literals": "warn",
"prefer-rest-params": "warn",
"prefer-spread": "warn",
"prefer-template": "warn",
"require-yield": "warn",
"rest-spread-spacing": "warn",
"sort-imports": "warn",
"symbol-description": "warn",
"template-curly-spacing": "warn",
"yield-star-spacing": "warn"
如果您需要将所有 ESLint 错误更改为警告,可以使用 eslint 插件 eslint-plugin-only-warn。
如果你仍然需要一些规则来触发一个完整的错误,你可以试试这个 only-warn 的分支, eslint-plugin-switch-error-warn(免责声明 - 我是叉子作者)。它将错误转换为警告,反之亦然,因此您可以将特定规则设置为 "warn" 以使它们再次触发错误。这将为您提供指定异常的附加功能,尽管它可能会变得相当混乱!
您还需要将所有默认为警告的规则(例如 'no-console')显式设置为 'error' 模式,让它们仅通过切换器插件发出警告。