From f8f7d2be277a93405f68fd4eeb9932558b1f08fe Mon Sep 17 00:00:00 2001 From: "weiran.zsd" Date: Tue, 25 Jun 2019 23:55:23 +0800 Subject: [PATCH] Docs: add 'stricter rule config validating' in migrating docs --- docs/user-guide/migrating-to-6.0.0.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/user-guide/migrating-to-6.0.0.md b/docs/user-guide/migrating-to-6.0.0.md index dbbd917cf8bc..ccc8ce5a73f6 100644 --- a/docs/user-guide/migrating-to-6.0.0.md +++ b/docs/user-guide/migrating-to-6.0.0.md @@ -10,6 +10,7 @@ The lists below are ordered roughly by the number of users each change is expect 1. [`eslint:recommended` has been updated](#eslint-recommended-changes) 1. [Plugins and shareable configs are no longer affected by ESLint's location](#package-loading-simplification) 1. [The default parser now validates options more strictly](#espree-validation) +1. [Rule configuration are vlidated more strictly](#rule-config-validating) 1. [The `no-redeclare` rule is now more strict by default](#no-redeclare-updates) 1. [The `comma-dangle` rule is now more strict by default](#comma-dangle-updates) 1. [The `no-confusing-arrow` rule is now more lenient by default](#no-confusing-arrow-updates) @@ -17,7 +18,7 @@ The lists below are ordered roughly by the number of users each change is expect 1. [Overrides in an extended config file can now be overridden by a parent config file](#overrides-precedence) 1. [Configuration values for globals are now validated](#globals-validation) 1. [The deprecated `experimentalObjectRestSpread` option has been removed](#experimental-object-rest-spread) -1. [User-provided regular expressions in rule options are parsed with the unicode flag](#unicode-regexes) +1. [User-provided regular expressions in rule options are parsed with the unicode flag](#unicode-regexes) ### Breaking changes for plugin/custom rule developers @@ -111,6 +112,22 @@ If you use a config file located outside of a local project (with the `--config` **Related issue(s):** [eslint/eslint#9687](https://github.com/eslint/eslint/issues/9687), [eslint/espree#384](https://github.com/eslint/espree/issues/384) +## Rule configuration are vlidated more strictly + +To catch config errors eariler, ESLint v6 will report a linting error if you are trying to configure a non-existent rule. + +config | ESLint v5 | ESLint v6 +------------- | ------------- | ------------- +`/*eslint-enable foo*/` | no error | linting error +`/*eslint-disable(-line) foo*/` | no error | linting error +`/*eslint foo: 0*/` | no error | linting error +`{rules: {foo: 0}}` | no error | no error +`{rules: {foo: 1}` | linting warning | linting error + +**To address:** You can remove the non-existent rule in your (inline) config. + +**Related issue(s):** [eslint/eslint#9505](https://github.com/eslint/eslint/issues/9505) + ## The `no-redeclare` rule is now more strict by default The default options for the [`no-redeclare`](https://eslint.org/docs/rules/no-redeclare) rule have changed from `{ builtinGlobals: false }` to `{ builtinGlobals: true }`. Additionally, the `no-redeclare` rule will now report an error for globals enabled by comments like `/* global foo */` if those globals were already enabled through configuration anyway.