From b813a357ecedb99692eed41ec8d1cf275430ba52 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Sun, 12 May 2019 12:27:41 +0900 Subject: [PATCH 01/18] New: The `linterOptions` property in Config Files --- designs/2019-linter-options/README.md | 126 ++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 designs/2019-linter-options/README.md diff --git a/designs/2019-linter-options/README.md b/designs/2019-linter-options/README.md new file mode 100644 index 00000000..5af72dcd --- /dev/null +++ b/designs/2019-linter-options/README.md @@ -0,0 +1,126 @@ +- Start Date: 2019-05-12 +- RFC PR: (leave this empty, to be filled in later) +- Authors: Toru Nagashima ([@mysticatea](https://github.com/mysticatea)) + +# The `linterOptions` property in Config Files + +## Summary + +This RFC adds `linterOptions` property to config files. People can use config files (including shareable configs!) instead of CLI options in order to configure some linter behavior. + +## Motivation + +We cannot configure some linter's behavior with config files, especially, shareable configs. It's convenient if we can configure those in shareable configs. + +## Detailed Design + +This adds `linterOptions` property to config files with three properties. + +```js +// .eslintrc.js +module.exports = { + linterOptions: { + allowInlineConfig: true, // Corresponds to --no-inline-config / `options.allowInlineConfig` + reportUnusedDisableDirectives: "off", // Corresponds to --report-unused-disable-directives / `options.reportUnusedDisableDirectives` + ignorePatterns: [], // Corresponds to --ignore-pattern / `options.ignorePattern` + }, + + overrides: [ + { + files: ["*.ts"], + linterOptions: { + allowInlineConfig: true, + reportUnusedDisableDirectives: "off", + ignorePatterns: [], + }, + }, + ], +} +``` + +Ajv should verify it by JSON Scheme and reject unknown properties in `linterOptions`. + +### allowInlineConfig + +That value can be a boolean value. Default is `true`. + +If `false` then it disables inline directive comments such as `/*eslint-disable*/`. + +
+🚀 Implementation: +

In Linter#_verifyWithoutProcessors method, the linter checks both providedConfig and filenameOrOptions to determine allowInlineConfig option. The filenameOrOptions.allowInlineConfig precedences providedConfig.allowInlineConfig.

+
+ +### reportUnusedDisableDirectives + +That value can be one of `"off"`, `"warn"`, and `"error"`. Default is `"off"`. + +It reports directive comments like `// eslint-disable-line` when no errors would have been reported on that line anyway. + +- If `"warn"` then it doesn't cause to change the exit code of ESLint. +- If `"error"` then it causes to change the exit code of ESLint. + +
+🚀 Implementation: +
    +
  1. Linter and CLIEngine have options.reportUnusedDisableDirectives. This RFC enhances these options to accept "off", "warn", and "error". Existing false is the same as "off" and existing true is the same as "error".
  2. +
  3. In Linter#_verifyWithoutProcessors method, the linter checks both providedConfig and filenameOrOptions to determine reportUnusedDisableDirectives option. The filenameOrOptions.reportUnusedDisableDirectives precedences providedConfig.reportUnusedDisableDirectives.
  4. +
+
+ +### ignorePatterns + +That value can be an array of strings. Default is an empty array. + +This is very similar to `.eslintignore` file. Each value is a file pattern as same as the line of `.eslintignore` file. ESLint compares the path to source code files and the file pattern then it ignores the file if it was matched. The path to source code files is addressed as relative to the entry config file, as same as `files`/`excludedFiles` properties. + +Negative patterns mean unignoring. For example, `!.*.js` makes ESLint checking JavaScript files which start with `.`. This is worthful for shareable configs of some platforms. For example, the config of VuePress can provide the configuration that unignores `.vuepress` directory. + +If this property is in `overrides` entries, ESLint checks only if `files`/`excludedFiles` criteria were matched. + +
+🚀 Implementation: +

At lib/cli-engine/file-enumerator.js#L402, the enumerator checks if the current path should be ignored or not. ESLint merges .eslintignore, --ignore-path, --ignore-pattern, and this ignorePatterns. The --no-ignore CLI option disables this setting.

+
+ +### Other options? + +- `extensions` - This RFC doesn't add `extensions` option that corresponds to `--ext` because [#20 "Configuring Additional Lint Targets with `.eslintrc`"](https://github.com/eslint/rfcs/pull/20) is the good successor of that. +- `rulePaths` - This RFC doesn't add `rulePaths` option that corresponds to `--rulesdir` because [#14 (`localPlugins`)](https://github.com/eslint/rfcs/pull/20) is the good successor of that. Because the `rulePaths` doesn't have namespace, shareable configs should not be able to configure that. (Or but it may be useful for some plugins such as `@typescript-eslint/eslint-plugin` in order to replace core rules. I'd like to discuss the replacement way in another place.) +- `format` - This RFC doesn't add `format` option that corresponds to `--format` because it doesn't fit cascading configs. It needs another mechanism. +- `maxWarnings` - This RFC doesn't add `maxWarnings` option that corresponds to `--max-warnings` because it doesn't fit cascading configs. It needs another mechanism. + +## Documentation + +- [Configuring ESLint](https://eslint.org/docs/user-guide/configuring) page should describe about `linterOptions` setting. +- [`--no-ignore` document](https://eslint.org/docs/user-guide/command-line-interface#--no-ignore) should mention `linterOptions.ignorePatterns` setting. + +## Drawbacks + +- Nothing in particular. + +## Backwards Compatibility Analysis + +- No concerns. Currently, the `linterOptions` top-level property is a fatal error. + +## Alternatives + +- + +## Open Questions + +- + +## Frequently Asked Questions + +- + +## Related Discussions + +- [eslint/eslint#3529](https://github.com/eslint/eslint/issues/3529) - Set ignore path in .eslintrc +- [eslint/eslint#4261](https://github.com/eslint/eslint/issues/4261) - combine .eslintignore with .eslintrc? +- [eslint/eslint#8824](https://github.com/eslint/eslint/issues/8824) - Allow config to ignore comments that disable rules inline +- [eslint/eslint#9382](https://github.com/eslint/eslint/issues/9382) - Proposal: `reportUnusedDisableDirectives` in config files +- [eslint/eslint#10341](https://github.com/eslint/eslint/issues/10341) - do not ignore files started with `.` by default +- [eslint/eslint#10891](https://github.com/eslint/eslint/issues/10891) - Allow setting ignorePatterns in eslintrc +- [eslint/eslint#11665](https://github.com/eslint/eslint/issues/11665) - Add top-level option for noInlineConfig or allowInlineConfig From 7589c389471d1d3ec08d6696a3d6396a7e2a8a12 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Sun, 12 May 2019 12:44:18 +0900 Subject: [PATCH 02/18] fix wrong code --- designs/2019-linter-options/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designs/2019-linter-options/README.md b/designs/2019-linter-options/README.md index 5af72dcd..95e9a4bd 100644 --- a/designs/2019-linter-options/README.md +++ b/designs/2019-linter-options/README.md @@ -48,7 +48,7 @@ If `false` then it disables inline directive comments such as `/*eslint-disable*
🚀 Implementation: -

In Linter#_verifyWithoutProcessors method, the linter checks both providedConfig and filenameOrOptions to determine allowInlineConfig option. The filenameOrOptions.allowInlineConfig precedences providedConfig.allowInlineConfig.

+

In Linter#_verifyWithoutProcessors method, the linter checks both providedConfig and filenameOrOptions to determine allowInlineConfig option. The filenameOrOptions.allowInlineConfig precedences providedConfig.linterOptions.allowInlineConfig.

### reportUnusedDisableDirectives @@ -64,7 +64,7 @@ It reports directive comments like `// eslint-disable-line` when no errors would 🚀 Implementation:
  1. Linter and CLIEngine have options.reportUnusedDisableDirectives. This RFC enhances these options to accept "off", "warn", and "error". Existing false is the same as "off" and existing true is the same as "error".
  2. -
  3. In Linter#_verifyWithoutProcessors method, the linter checks both providedConfig and filenameOrOptions to determine reportUnusedDisableDirectives option. The filenameOrOptions.reportUnusedDisableDirectives precedences providedConfig.reportUnusedDisableDirectives.
  4. +
  5. In Linter#_verifyWithoutProcessors method, the linter checks both providedConfig and filenameOrOptions to determine reportUnusedDisableDirectives option. The filenameOrOptions.reportUnusedDisableDirectives precedences providedConfig.linterOptions.reportUnusedDisableDirectives.
From 6cf4ac566c9dfcdacff478be26f203f8b6d8618e Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Sun, 12 May 2019 12:54:36 +0900 Subject: [PATCH 03/18] tweak a sentence --- designs/2019-linter-options/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designs/2019-linter-options/README.md b/designs/2019-linter-options/README.md index 95e9a4bd..1379f0cf 100644 --- a/designs/2019-linter-options/README.md +++ b/designs/2019-linter-options/README.md @@ -76,7 +76,7 @@ This is very similar to `.eslintignore` file. Each value is a file pattern as sa Negative patterns mean unignoring. For example, `!.*.js` makes ESLint checking JavaScript files which start with `.`. This is worthful for shareable configs of some platforms. For example, the config of VuePress can provide the configuration that unignores `.vuepress` directory. -If this property is in `overrides` entries, ESLint checks only if `files`/`excludedFiles` criteria were matched. +If this property is in `overrides` entries, ESLint uses the `ignorePatterns` property only if `files`/`excludedFiles` criteria were matched.
🚀 Implementation: From 11be4a5cf944fcdead148193d284f8785c008386 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Sun, 12 May 2019 19:56:24 +0900 Subject: [PATCH 04/18] add merge strategy of ignorePatterns --- designs/2019-linter-options/README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/designs/2019-linter-options/README.md b/designs/2019-linter-options/README.md index 1379f0cf..378a0d63 100644 --- a/designs/2019-linter-options/README.md +++ b/designs/2019-linter-options/README.md @@ -74,13 +74,22 @@ That value can be an array of strings. Default is an empty array. This is very similar to `.eslintignore` file. Each value is a file pattern as same as the line of `.eslintignore` file. ESLint compares the path to source code files and the file pattern then it ignores the file if it was matched. The path to source code files is addressed as relative to the entry config file, as same as `files`/`excludedFiles` properties. -Negative patterns mean unignoring. For example, `!.*.js` makes ESLint checking JavaScript files which start with `.`. This is worthful for shareable configs of some platforms. For example, the config of VuePress can provide the configuration that unignores `.vuepress` directory. +ESLint concatenates all ignore patterns from all of `.eslintignore`, `--ignore-path`, `--ignore-pattern`, and `linterOptions.ignorePatterns`. If there are multiple `linterOptions.ignorePatterns`, all of them are concatenated. The order is: + +1. `--ignore-path` or `.eslintignore`. +1. `linterOptions.ignorePatterns` in the appearance order in the config array. +1. `--ignore-pattern` + +Negative patterns mean unignoring. For example, `!.*.js` makes ESLint checking JavaScript files which start with `.`. Negative patterns are used to override parent settings. +Also, negative patterns is worthful for shareable configs of some platforms. For example, the config of VuePress can provide the configuration that unignores `.vuepress` directory. If this property is in `overrides` entries, ESLint uses the `ignorePatterns` property only if `files`/`excludedFiles` criteria were matched. +The `--no-ignore` CLI option disables `linterOptions.ignorePatterns` as well. +
🚀 Implementation: -

At lib/cli-engine/file-enumerator.js#L402, the enumerator checks if the current path should be ignored or not. ESLint merges .eslintignore, --ignore-path, --ignore-pattern, and this ignorePatterns. The --no-ignore CLI option disables this setting.

+

At lib/cli-engine/file-enumerator.js#L402, the enumerator checks if the current path should be ignored or not.

### Other options? From 82c3f59c4cc5ff9303c6e545387a0cdd1e07cca3 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Sun, 12 May 2019 19:57:20 +0900 Subject: [PATCH 05/18] add about `CLIEngine#isPathIgnored(filePath)` --- designs/2019-linter-options/README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/designs/2019-linter-options/README.md b/designs/2019-linter-options/README.md index 378a0d63..e8345684 100644 --- a/designs/2019-linter-options/README.md +++ b/designs/2019-linter-options/README.md @@ -89,7 +89,10 @@ The `--no-ignore` CLI option disables `linterOptions.ignorePatterns` as well.
🚀 Implementation: -

At lib/cli-engine/file-enumerator.js#L402, the enumerator checks if the current path should be ignored or not.

+
### Other options? From 2b8f5c8c925898c2296c8e914db18251848410a4 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Sun, 12 May 2019 19:59:10 +0900 Subject: [PATCH 06/18] =?UTF-8?q?linterOptions=20=E2=86=92=20coreOptions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designs/2019-linter-options/README.md | 30 +++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/designs/2019-linter-options/README.md b/designs/2019-linter-options/README.md index e8345684..41f18af4 100644 --- a/designs/2019-linter-options/README.md +++ b/designs/2019-linter-options/README.md @@ -2,11 +2,11 @@ - RFC PR: (leave this empty, to be filled in later) - Authors: Toru Nagashima ([@mysticatea](https://github.com/mysticatea)) -# The `linterOptions` property in Config Files +# The `coreOptions` property in Config Files ## Summary -This RFC adds `linterOptions` property to config files. People can use config files (including shareable configs!) instead of CLI options in order to configure some linter behavior. +This RFC adds `coreOptions` property to config files. People can use config files (including shareable configs!) instead of CLI options in order to configure some linter behavior. ## Motivation @@ -14,12 +14,12 @@ We cannot configure some linter's behavior with config files, especially, sharea ## Detailed Design -This adds `linterOptions` property to config files with three properties. +This adds `coreOptions` property to config files with three properties. ```js // .eslintrc.js module.exports = { - linterOptions: { + coreOptions: { allowInlineConfig: true, // Corresponds to --no-inline-config / `options.allowInlineConfig` reportUnusedDisableDirectives: "off", // Corresponds to --report-unused-disable-directives / `options.reportUnusedDisableDirectives` ignorePatterns: [], // Corresponds to --ignore-pattern / `options.ignorePattern` @@ -28,7 +28,7 @@ module.exports = { overrides: [ { files: ["*.ts"], - linterOptions: { + coreOptions: { allowInlineConfig: true, reportUnusedDisableDirectives: "off", ignorePatterns: [], @@ -38,7 +38,7 @@ module.exports = { } ``` -Ajv should verify it by JSON Scheme and reject unknown properties in `linterOptions`. +Ajv should verify it by JSON Scheme and reject unknown properties in `coreOptions`. ### allowInlineConfig @@ -48,7 +48,7 @@ If `false` then it disables inline directive comments such as `/*eslint-disable*
🚀 Implementation: -

In Linter#_verifyWithoutProcessors method, the linter checks both providedConfig and filenameOrOptions to determine allowInlineConfig option. The filenameOrOptions.allowInlineConfig precedences providedConfig.linterOptions.allowInlineConfig.

+

In Linter#_verifyWithoutProcessors method, the linter checks both providedConfig and filenameOrOptions to determine allowInlineConfig option. The filenameOrOptions.allowInlineConfig precedences providedConfig.coreOptions.allowInlineConfig.

### reportUnusedDisableDirectives @@ -64,7 +64,7 @@ It reports directive comments like `// eslint-disable-line` when no errors would 🚀 Implementation:
  1. Linter and CLIEngine have options.reportUnusedDisableDirectives. This RFC enhances these options to accept "off", "warn", and "error". Existing false is the same as "off" and existing true is the same as "error".
  2. -
  3. In Linter#_verifyWithoutProcessors method, the linter checks both providedConfig and filenameOrOptions to determine reportUnusedDisableDirectives option. The filenameOrOptions.reportUnusedDisableDirectives precedences providedConfig.linterOptions.reportUnusedDisableDirectives.
  4. +
  5. In Linter#_verifyWithoutProcessors method, the linter checks both providedConfig and filenameOrOptions to determine reportUnusedDisableDirectives option. The filenameOrOptions.reportUnusedDisableDirectives precedences providedConfig.coreOptions.reportUnusedDisableDirectives.
@@ -74,10 +74,10 @@ That value can be an array of strings. Default is an empty array. This is very similar to `.eslintignore` file. Each value is a file pattern as same as the line of `.eslintignore` file. ESLint compares the path to source code files and the file pattern then it ignores the file if it was matched. The path to source code files is addressed as relative to the entry config file, as same as `files`/`excludedFiles` properties. -ESLint concatenates all ignore patterns from all of `.eslintignore`, `--ignore-path`, `--ignore-pattern`, and `linterOptions.ignorePatterns`. If there are multiple `linterOptions.ignorePatterns`, all of them are concatenated. The order is: +ESLint concatenates all ignore patterns from all of `.eslintignore`, `--ignore-path`, `--ignore-pattern`, and `coreOptions.ignorePatterns`. If there are multiple `coreOptions.ignorePatterns`, all of them are concatenated. The order is: 1. `--ignore-path` or `.eslintignore`. -1. `linterOptions.ignorePatterns` in the appearance order in the config array. +1. `coreOptions.ignorePatterns` in the appearance order in the config array. 1. `--ignore-pattern` Negative patterns mean unignoring. For example, `!.*.js` makes ESLint checking JavaScript files which start with `.`. Negative patterns are used to override parent settings. @@ -85,13 +85,13 @@ Also, negative patterns is worthful for shareable configs of some platforms. For If this property is in `overrides` entries, ESLint uses the `ignorePatterns` property only if `files`/`excludedFiles` criteria were matched. -The `--no-ignore` CLI option disables `linterOptions.ignorePatterns` as well. +The `--no-ignore` CLI option disables `coreOptions.ignorePatterns` as well.
🚀 Implementation:
@@ -104,8 +104,8 @@ The `--no-ignore` CLI option disables `linterOptions.ignorePatterns` as well. ## Documentation -- [Configuring ESLint](https://eslint.org/docs/user-guide/configuring) page should describe about `linterOptions` setting. -- [`--no-ignore` document](https://eslint.org/docs/user-guide/command-line-interface#--no-ignore) should mention `linterOptions.ignorePatterns` setting. +- [Configuring ESLint](https://eslint.org/docs/user-guide/configuring) page should describe about `coreOptions` setting. +- [`--no-ignore` document](https://eslint.org/docs/user-guide/command-line-interface#--no-ignore) should mention `coreOptions.ignorePatterns` setting. ## Drawbacks @@ -113,7 +113,7 @@ The `--no-ignore` CLI option disables `linterOptions.ignorePatterns` as well. ## Backwards Compatibility Analysis -- No concerns. Currently, the `linterOptions` top-level property is a fatal error. +- No concerns. Currently, the `coreOptions` top-level property is a fatal error. ## Alternatives From 3a9d2d8b743bd2c0c7d306d926ed402fbca4809d Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Sun, 12 May 2019 20:18:16 +0900 Subject: [PATCH 07/18] add a FAQ: `excludedFiles` and `ignorePatterns` --- designs/2019-linter-options/README.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/designs/2019-linter-options/README.md b/designs/2019-linter-options/README.md index 41f18af4..aa6bcce2 100644 --- a/designs/2019-linter-options/README.md +++ b/designs/2019-linter-options/README.md @@ -125,7 +125,30 @@ The `--no-ignore` CLI option disables `coreOptions.ignorePatterns` as well. ## Frequently Asked Questions -- +### What is different between `excludedFiles` and `coreOptions.ignorePatterns` in `overrides`? + +For example: + +```js +// .eslintrc.js +module.exports = { + overrides: [ + // (A) + { + files: ["*.js"], + excludedFiles: ["_*"], + }, + // (B) + { + files: ["*.js"], + coreOptions: { ignorePatterns: ["_*"] }, + }, + ], +} +``` + +- The `(A)`, `excludedFiles` affects ESLint to adopt the override entry or not. In that case, this override entry doesn't apply to the files which start with `_`. But ESLint verifies the files with other parts of the config. +- The `(B)`, `coreOptions.ignorePatterns` affects ESLint to ignore the file. In that case, this override entry applies to the files which start with `_`. Then ESLint ignores (doesn't verify) the files. ## Related Discussions From 3a9567ec5690f1c1947245602694aafd18fef4ac Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Sun, 12 May 2019 20:21:41 +0900 Subject: [PATCH 08/18] add about default ignoring --- designs/2019-linter-options/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/designs/2019-linter-options/README.md b/designs/2019-linter-options/README.md index aa6bcce2..c0f270ce 100644 --- a/designs/2019-linter-options/README.md +++ b/designs/2019-linter-options/README.md @@ -76,6 +76,7 @@ This is very similar to `.eslintignore` file. Each value is a file pattern as sa ESLint concatenates all ignore patterns from all of `.eslintignore`, `--ignore-path`, `--ignore-pattern`, and `coreOptions.ignorePatterns`. If there are multiple `coreOptions.ignorePatterns`, all of them are concatenated. The order is: +1. The default ignoring. (E.g. `node_modules/*`) 1. `--ignore-path` or `.eslintignore`. 1. `coreOptions.ignorePatterns` in the appearance order in the config array. 1. `--ignore-pattern` From 315a1565a40586609fe0a00f896bee5afa85a645 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Sun, 12 May 2019 20:22:53 +0900 Subject: [PATCH 09/18] add RFC PR --- designs/2019-linter-options/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designs/2019-linter-options/README.md b/designs/2019-linter-options/README.md index c0f270ce..350f6b9f 100644 --- a/designs/2019-linter-options/README.md +++ b/designs/2019-linter-options/README.md @@ -1,5 +1,5 @@ - Start Date: 2019-05-12 -- RFC PR: (leave this empty, to be filled in later) +- RFC PR: https://github.com/eslint/rfcs/pull/22 - Authors: Toru Nagashima ([@mysticatea](https://github.com/mysticatea)) # The `coreOptions` property in Config Files From 8b7f6ae32f709ba629c4c1ed6c8c0a9deff62307 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Thu, 23 May 2019 16:38:49 +0900 Subject: [PATCH 10/18] make `reportUnusedDisableDirectives` cannot fail CI --- designs/2019-linter-options/README.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/designs/2019-linter-options/README.md b/designs/2019-linter-options/README.md index 350f6b9f..070ae77f 100644 --- a/designs/2019-linter-options/README.md +++ b/designs/2019-linter-options/README.md @@ -21,7 +21,7 @@ This adds `coreOptions` property to config files with three properties. module.exports = { coreOptions: { allowInlineConfig: true, // Corresponds to --no-inline-config / `options.allowInlineConfig` - reportUnusedDisableDirectives: "off", // Corresponds to --report-unused-disable-directives / `options.reportUnusedDisableDirectives` + reportUnusedDisableDirectives: false, // Corresponds to --report-unused-disable-directives / `options.reportUnusedDisableDirectives` ignorePatterns: [], // Corresponds to --ignore-pattern / `options.ignorePattern` }, @@ -30,7 +30,7 @@ module.exports = { files: ["*.ts"], coreOptions: { allowInlineConfig: true, - reportUnusedDisableDirectives: "off", + reportUnusedDisableDirectives: false, ignorePatterns: [], }, }, @@ -53,12 +53,11 @@ If `false` then it disables inline directive comments such as `/*eslint-disable* ### reportUnusedDisableDirectives -That value can be one of `"off"`, `"warn"`, and `"error"`. Default is `"off"`. +That value can be a boolean value. Default is `false`. -It reports directive comments like `// eslint-disable-line` when no errors would have been reported on that line anyway. +It reports directive comments like `//eslint-disable-line` when no errors would have been reported on that line anyway. -- If `"warn"` then it doesn't cause to change the exit code of ESLint. -- If `"error"` then it causes to change the exit code of ESLint. +This option is different a bit from `--report-unused-disable-directives` CLI option. The `--report-unused-disable-directives` CLI option fails the linting with non-zero exit code (i.e., it's the same behavior as `severity=2`), but this `coreOptions.reportUnusedDisableDirectives` setting doesn't fail the linting (i.e., it's the same behavior as `severity=1`). This is for the concern https://github.com/eslint/rfcs/pull/22#discussion_r283118349.
🚀 Implementation: From dfa1432ef531b163b2990b2011eb18667208f194 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Thu, 23 May 2019 16:53:19 +0900 Subject: [PATCH 11/18] =?UTF-8?q?allowInlineConfig=20=E2=86=92=20disableIn?= =?UTF-8?q?lineConfig:=20make=20the=20default=20false.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designs/2019-linter-options/README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/designs/2019-linter-options/README.md b/designs/2019-linter-options/README.md index 070ae77f..09d36823 100644 --- a/designs/2019-linter-options/README.md +++ b/designs/2019-linter-options/README.md @@ -20,7 +20,7 @@ This adds `coreOptions` property to config files with three properties. // .eslintrc.js module.exports = { coreOptions: { - allowInlineConfig: true, // Corresponds to --no-inline-config / `options.allowInlineConfig` + disableInlineConfig: false, // Corresponds to --no-inline-config / `options.allowInlineConfig` reportUnusedDisableDirectives: false, // Corresponds to --report-unused-disable-directives / `options.reportUnusedDisableDirectives` ignorePatterns: [], // Corresponds to --ignore-pattern / `options.ignorePattern` }, @@ -29,7 +29,7 @@ module.exports = { { files: ["*.ts"], coreOptions: { - allowInlineConfig: true, + disableInlineConfig: false, reportUnusedDisableDirectives: false, ignorePatterns: [], }, @@ -40,22 +40,22 @@ module.exports = { Ajv should verify it by JSON Scheme and reject unknown properties in `coreOptions`. -### allowInlineConfig +### disableInlineConfig -That value can be a boolean value. Default is `true`. +That value can be a boolean value. Default is `false`. -If `false` then it disables inline directive comments such as `/*eslint-disable*/`. +If `true` then it disables inline directive comments such as `/*eslint-disable*/`.
🚀 Implementation: -

In Linter#_verifyWithoutProcessors method, the linter checks both providedConfig and filenameOrOptions to determine allowInlineConfig option. The filenameOrOptions.allowInlineConfig precedences providedConfig.coreOptions.allowInlineConfig.

+

In Linter#_verifyWithoutProcessors method, the linter checks both providedConfig and filenameOrOptions to determine allowInlineConfig option. The filenameOrOptions.allowInlineConfig precedences providedConfig.coreOptions.disableInlineConfig.

### reportUnusedDisableDirectives That value can be a boolean value. Default is `false`. -It reports directive comments like `//eslint-disable-line` when no errors would have been reported on that line anyway. +If `true` then it reports directive comments like `//eslint-disable-line` when no errors would have been reported on that line anyway. This option is different a bit from `--report-unused-disable-directives` CLI option. The `--report-unused-disable-directives` CLI option fails the linting with non-zero exit code (i.e., it's the same behavior as `severity=2`), but this `coreOptions.reportUnusedDisableDirectives` setting doesn't fail the linting (i.e., it's the same behavior as `severity=1`). This is for the concern https://github.com/eslint/rfcs/pull/22#discussion_r283118349. From 55612c08bd449c90c60639e57ea7e787104f2fea Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Thu, 23 May 2019 16:53:42 +0900 Subject: [PATCH 12/18] add warnings about disableInlineConfig --- designs/2019-linter-options/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/designs/2019-linter-options/README.md b/designs/2019-linter-options/README.md index 09d36823..efc3b1f6 100644 --- a/designs/2019-linter-options/README.md +++ b/designs/2019-linter-options/README.md @@ -46,6 +46,8 @@ That value can be a boolean value. Default is `false`. If `true` then it disables inline directive comments such as `/*eslint-disable*/`. +If `coreOptions.disableInlineConfig` is `true`, `--no-inline-config` was not given, and there are one or more directive comments, then ESLint reports each directive comment as a warning message (`severify=1`). For example, `"'eslint-disable' comment was ignored because your config file has 'coreOptions.disableInlineConfig' setting."`. This is for the concern https://github.com/eslint/rfcs/pull/22#discussion_r283118349. +
🚀 Implementation:

In Linter#_verifyWithoutProcessors method, the linter checks both providedConfig and filenameOrOptions to determine allowInlineConfig option. The filenameOrOptions.allowInlineConfig precedences providedConfig.coreOptions.disableInlineConfig.

From 621c2e7ae032186cbb69b146a29a205882348740 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Fri, 7 Jun 2019 19:11:40 +0900 Subject: [PATCH 13/18] move file --- designs/{2019-linter-options => 2019-core-options}/README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename designs/{2019-linter-options => 2019-core-options}/README.md (100%) diff --git a/designs/2019-linter-options/README.md b/designs/2019-core-options/README.md similarity index 100% rename from designs/2019-linter-options/README.md rename to designs/2019-core-options/README.md From 6eae6df7a37e48f86504ef270dfde01ee4317d3f Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Fri, 7 Jun 2019 19:31:11 +0900 Subject: [PATCH 14/18] add about verifyOnRecoverableParsingErrors --- designs/2019-core-options/README.md | 39 ++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/designs/2019-core-options/README.md b/designs/2019-core-options/README.md index efc3b1f6..f7072cc0 100644 --- a/designs/2019-core-options/README.md +++ b/designs/2019-core-options/README.md @@ -20,9 +20,10 @@ This adds `coreOptions` property to config files with three properties. // .eslintrc.js module.exports = { coreOptions: { - disableInlineConfig: false, // Corresponds to --no-inline-config / `options.allowInlineConfig` - reportUnusedDisableDirectives: false, // Corresponds to --report-unused-disable-directives / `options.reportUnusedDisableDirectives` - ignorePatterns: [], // Corresponds to --ignore-pattern / `options.ignorePattern` + disableInlineConfig: false, // Corresponds to --no-inline-config + reportUnusedDisableDirectives: false, // Corresponds to --report-unused-disable-directives + verifyOnRecoverableParsingErrors: false, // Corresponds to --verify-on-recoverable-parsing-errors in https://github.com/eslint/rfcs/pull/19 + ignorePatterns: [], // Corresponds to --ignore-pattern }, overrides: [ @@ -31,6 +32,7 @@ module.exports = { coreOptions: { disableInlineConfig: false, reportUnusedDisableDirectives: false, + verifyOnRecoverableParsingErrors: false, ignorePatterns: [], }, }, @@ -40,36 +42,49 @@ module.exports = { Ajv should verify it by JSON Scheme and reject unknown properties in `coreOptions`. -### disableInlineConfig +### § disableInlineConfig That value can be a boolean value. Default is `false`. If `true` then it disables inline directive comments such as `/*eslint-disable*/`. -If `coreOptions.disableInlineConfig` is `true`, `--no-inline-config` was not given, and there are one or more directive comments, then ESLint reports each directive comment as a warning message (`severify=1`). For example, `"'eslint-disable' comment was ignored because your config file has 'coreOptions.disableInlineConfig' setting."`. This is for the concern https://github.com/eslint/rfcs/pull/22#discussion_r283118349. +If `coreOptions.disableInlineConfig` is `true`, `--no-inline-config` was not given, and there are one or more directive comments, then ESLint reports each directive comment as a warning message (`severify=1`). For example, `"'eslint-disable' comment was ignored because your config file has 'coreOptions.disableInlineConfig' setting."`. Therefore, end-users can know why directive comments didn't work.
-🚀 Implementation: +Implementation:

In Linter#_verifyWithoutProcessors method, the linter checks both providedConfig and filenameOrOptions to determine allowInlineConfig option. The filenameOrOptions.allowInlineConfig precedences providedConfig.coreOptions.disableInlineConfig.

-### reportUnusedDisableDirectives +### § reportUnusedDisableDirectives That value can be a boolean value. Default is `false`. If `true` then it reports directive comments like `//eslint-disable-line` when no errors would have been reported on that line anyway. -This option is different a bit from `--report-unused-disable-directives` CLI option. The `--report-unused-disable-directives` CLI option fails the linting with non-zero exit code (i.e., it's the same behavior as `severity=2`), but this `coreOptions.reportUnusedDisableDirectives` setting doesn't fail the linting (i.e., it's the same behavior as `severity=1`). This is for the concern https://github.com/eslint/rfcs/pull/22#discussion_r283118349. +This option is different a bit from `--report-unused-disable-directives` CLI option. The `--report-unused-disable-directives` CLI option fails the linting with non-zero exit code (i.e., it's the same behavior as `severity=2`), but this `coreOptions.reportUnusedDisableDirectives` setting doesn't fail the linting (i.e., it's the same behavior as `severity=1`). Therefore, we cannot configure ESLint with `coreOptions.reportUnusedDisableDirectives` as failed by patch releases.
-🚀 Implementation: +Implementation:
  1. Linter and CLIEngine have options.reportUnusedDisableDirectives. This RFC enhances these options to accept "off", "warn", and "error". Existing false is the same as "off" and existing true is the same as "error".
  2. In Linter#_verifyWithoutProcessors method, the linter checks both providedConfig and filenameOrOptions to determine reportUnusedDisableDirectives option. The filenameOrOptions.reportUnusedDisableDirectives precedences providedConfig.coreOptions.reportUnusedDisableDirectives.
-### ignorePatterns +### § verifyOnRecoverableParsingErrors + +> This section is valid only if [#19](https://github.com/eslint/rfcs/pull/19) was accepted. + +That value can be a boolean value. Default is `false`. + +If `true` then it runs rules even if recoverable errors existed. Then it shows both results. + +
+Implementation: +

In Linter#_verifyWithoutProcessors method, the linter checks both providedConfig and filenameOrOptions to determine verifyOnRecoverableParsingErrors option. The filenameOrOptions.verifyOnRecoverableParsingErrors precedences providedConfig.coreOptions.verifyOnRecoverableParsingErrors.

+
+ +### § ignorePatterns That value can be an array of strings. Default is an empty array. @@ -90,14 +105,14 @@ If this property is in `overrides` entries, ESLint uses the `ignorePatterns` pro The `--no-ignore` CLI option disables `coreOptions.ignorePatterns` as well.
-🚀 Implementation: +Implementation:
-### Other options? +### § Other options? - `extensions` - This RFC doesn't add `extensions` option that corresponds to `--ext` because [#20 "Configuring Additional Lint Targets with `.eslintrc`"](https://github.com/eslint/rfcs/pull/20) is the good successor of that. - `rulePaths` - This RFC doesn't add `rulePaths` option that corresponds to `--rulesdir` because [#14 (`localPlugins`)](https://github.com/eslint/rfcs/pull/20) is the good successor of that. Because the `rulePaths` doesn't have namespace, shareable configs should not be able to configure that. (Or but it may be useful for some plugins such as `@typescript-eslint/eslint-plugin` in order to replace core rules. I'd like to discuss the replacement way in another place.) From 55706c142c84aa460aaea36e7083381300d807d4 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Mon, 17 Jun 2019 17:00:28 +0900 Subject: [PATCH 15/18] unwrap `coreOptions` property --- designs/2019-core-options/README.md | 101 +++++++++------------------- 1 file changed, 31 insertions(+), 70 deletions(-) diff --git a/designs/2019-core-options/README.md b/designs/2019-core-options/README.md index f7072cc0..49c9f779 100644 --- a/designs/2019-core-options/README.md +++ b/designs/2019-core-options/README.md @@ -2,11 +2,11 @@ - RFC PR: https://github.com/eslint/rfcs/pull/22 - Authors: Toru Nagashima ([@mysticatea](https://github.com/mysticatea)) -# The `coreOptions` property in Config Files +# Configuring core opsions in Config Files ## Summary -This RFC adds `coreOptions` property to config files. People can use config files (including shareable configs!) instead of CLI options in order to configure some linter behavior. +This RFC adds several properties into config files to configure core options. People can use config files (including shareable configs!) instead of CLI options in order to configure some linter behavior. ## Motivation @@ -14,45 +14,39 @@ We cannot configure some linter's behavior with config files, especially, sharea ## Detailed Design -This adds `coreOptions` property to config files with three properties. +This RFC adds four properties to config files. ```js // .eslintrc.js module.exports = { - coreOptions: { - disableInlineConfig: false, // Corresponds to --no-inline-config - reportUnusedDisableDirectives: false, // Corresponds to --report-unused-disable-directives - verifyOnRecoverableParsingErrors: false, // Corresponds to --verify-on-recoverable-parsing-errors in https://github.com/eslint/rfcs/pull/19 - ignorePatterns: [], // Corresponds to --ignore-pattern - }, + disableInlineConfig: false, // Corresponds to --no-inline-config + reportUnusedDisableDirectives: false, // Corresponds to --report-unused-disable-directives + verifyOnRecoverableParsingErrors: false, // Corresponds to --verify-on-recoverable-parsing-errors + ignorePatterns: [], // Corresponds to --ignore-pattern overrides: [ { files: ["*.ts"], - coreOptions: { - disableInlineConfig: false, - reportUnusedDisableDirectives: false, - verifyOnRecoverableParsingErrors: false, - ignorePatterns: [], - }, + disableInlineConfig: false, + reportUnusedDisableDirectives: false, + verifyOnRecoverableParsingErrors: false, + // ignorePatterns: [], // Forbid this to avoid confusion with 'excludedFiles' property. }, ], } ``` -Ajv should verify it by JSON Scheme and reject unknown properties in `coreOptions`. - ### § disableInlineConfig That value can be a boolean value. Default is `false`. If `true` then it disables inline directive comments such as `/*eslint-disable*/`. -If `coreOptions.disableInlineConfig` is `true`, `--no-inline-config` was not given, and there are one or more directive comments, then ESLint reports each directive comment as a warning message (`severify=1`). For example, `"'eslint-disable' comment was ignored because your config file has 'coreOptions.disableInlineConfig' setting."`. Therefore, end-users can know why directive comments didn't work. +If `disableInlineConfig` is `true`, `--no-inline-config` was not given, and there are one or more directive comments, then ESLint reports each directive comment as a warning message (`severify=1`). For example, `"'eslint-disable' comment was ignored because your config file has 'disableInlineConfig' setting."`. Therefore, end-users can know why directive comments didn't work.
-Implementation: -

In Linter#_verifyWithoutProcessors method, the linter checks both providedConfig and filenameOrOptions to determine allowInlineConfig option. The filenameOrOptions.allowInlineConfig precedences providedConfig.coreOptions.disableInlineConfig.

+💠Implementation: +

In Linter#_verifyWithoutProcessors method, the linter checks both providedConfig and filenameOrOptions to determine disableInlineConfig option. The filenameOrOptions.allowInlineConfig precedences providedConfig.disableInlineConfig.

### § reportUnusedDisableDirectives @@ -61,54 +55,52 @@ That value can be a boolean value. Default is `false`. If `true` then it reports directive comments like `//eslint-disable-line` when no errors would have been reported on that line anyway. -This option is different a bit from `--report-unused-disable-directives` CLI option. The `--report-unused-disable-directives` CLI option fails the linting with non-zero exit code (i.e., it's the same behavior as `severity=2`), but this `coreOptions.reportUnusedDisableDirectives` setting doesn't fail the linting (i.e., it's the same behavior as `severity=1`). Therefore, we cannot configure ESLint with `coreOptions.reportUnusedDisableDirectives` as failed by patch releases. +This option is different a bit from `--report-unused-disable-directives` CLI option. The `--report-unused-disable-directives` CLI option fails the linting with non-zero exit code (i.e., it's the same behavior as `severity=2`), but this `reportUnusedDisableDirectives` setting doesn't fail the linting (i.e., it's the same behavior as `severity=1`). Therefore, we cannot configure ESLint with `reportUnusedDisableDirectives` as failed by patch releases.
-Implementation: +💠Implementation:
  1. Linter and CLIEngine have options.reportUnusedDisableDirectives. This RFC enhances these options to accept "off", "warn", and "error". Existing false is the same as "off" and existing true is the same as "error".
  2. -
  3. In Linter#_verifyWithoutProcessors method, the linter checks both providedConfig and filenameOrOptions to determine reportUnusedDisableDirectives option. The filenameOrOptions.reportUnusedDisableDirectives precedences providedConfig.coreOptions.reportUnusedDisableDirectives.
  4. +
  5. In Linter#_verifyWithoutProcessors method, the linter checks both providedConfig and filenameOrOptions to determine reportUnusedDisableDirectives option. The filenameOrOptions.reportUnusedDisableDirectives precedences providedConfig.reportUnusedDisableDirectives.
### § verifyOnRecoverableParsingErrors -> This section is valid only if [#19](https://github.com/eslint/rfcs/pull/19) was accepted. - That value can be a boolean value. Default is `false`. If `true` then it runs rules even if recoverable errors existed. Then it shows both results.
-Implementation: -

In Linter#_verifyWithoutProcessors method, the linter checks both providedConfig and filenameOrOptions to determine verifyOnRecoverableParsingErrors option. The filenameOrOptions.verifyOnRecoverableParsingErrors precedences providedConfig.coreOptions.verifyOnRecoverableParsingErrors.

+💠Implementation: +

In Linter#_verifyWithoutProcessors method, the linter checks both providedConfig and filenameOrOptions to determine verifyOnRecoverableParsingErrors option. The filenameOrOptions.verifyOnRecoverableParsingErrors precedences providedConfig.verifyOnRecoverableParsingErrors.

### § ignorePatterns That value can be an array of strings. Default is an empty array. -This is very similar to `.eslintignore` file. Each value is a file pattern as same as the line of `.eslintignore` file. ESLint compares the path to source code files and the file pattern then it ignores the file if it was matched. The path to source code files is addressed as relative to the entry config file, as same as `files`/`excludedFiles` properties. +This is very similar to `.eslintignore` file. Each value is a file pattern as same as each line of `.eslintignore` file. ESLint compares the path to source code files and the file pattern then it ignores the file if it was matched. The path to source code files is addressed as relative to the entry config file, as same as `files`/`excludedFiles` properties. -ESLint concatenates all ignore patterns from all of `.eslintignore`, `--ignore-path`, `--ignore-pattern`, and `coreOptions.ignorePatterns`. If there are multiple `coreOptions.ignorePatterns`, all of them are concatenated. The order is: +ESLint concatenates all ignore patterns from all of `.eslintignore`, `--ignore-path`, `--ignore-pattern`, and `ignorePatterns`. If there are multiple `ignorePatterns` in a `ConfigArray`, all of them are concatenated. The order is: -1. The default ignoring. (E.g. `node_modules/*`) +1. The default ignoring. (I.e. `.*`, `node_modules/*`, and `bower_components/*`) 1. `--ignore-path` or `.eslintignore`. -1. `coreOptions.ignorePatterns` in the appearance order in the config array. +1. `ignorePatterns` in the appearance order in the config array. 1. `--ignore-pattern` Negative patterns mean unignoring. For example, `!.*.js` makes ESLint checking JavaScript files which start with `.`. Negative patterns are used to override parent settings. Also, negative patterns is worthful for shareable configs of some platforms. For example, the config of VuePress can provide the configuration that unignores `.vuepress` directory. -If this property is in `overrides` entries, ESLint uses the `ignorePatterns` property only if `files`/`excludedFiles` criteria were matched. +It disallows `ignorePatterns` property in `overrides` entries in order to avoid confusion with `excludedFiles`. And if a `ignorePatterns` property came from shareable configs in `overrides` entries, ESLint ignores it. This is the same behavior as `root` property. -The `--no-ignore` CLI option disables `coreOptions.ignorePatterns` as well. +The `--no-ignore` CLI option disables `ignorePatterns` as well.
-Implementation: +💠Implementation:
@@ -121,52 +113,21 @@ The `--no-ignore` CLI option disables `coreOptions.ignorePatterns` as well. ## Documentation -- [Configuring ESLint](https://eslint.org/docs/user-guide/configuring) page should describe about `coreOptions` setting. -- [`--no-ignore` document](https://eslint.org/docs/user-guide/command-line-interface#--no-ignore) should mention `coreOptions.ignorePatterns` setting. +- [Configuring ESLint](https://eslint.org/docs/user-guide/configuring) page should describe new top-level properties. +- [`--no-ignore` document](https://eslint.org/docs/user-guide/command-line-interface#--no-ignore) should mention `ignorePatterns` setting. ## Drawbacks -- Nothing in particular. +Nothing in particular. ## Backwards Compatibility Analysis -- No concerns. Currently, the `coreOptions` top-level property is a fatal error. +No concerns. Currently, unknown top-level properties are a fatal error. ## Alternatives - -## Open Questions - -- - -## Frequently Asked Questions - -### What is different between `excludedFiles` and `coreOptions.ignorePatterns` in `overrides`? - -For example: - -```js -// .eslintrc.js -module.exports = { - overrides: [ - // (A) - { - files: ["*.js"], - excludedFiles: ["_*"], - }, - // (B) - { - files: ["*.js"], - coreOptions: { ignorePatterns: ["_*"] }, - }, - ], -} -``` - -- The `(A)`, `excludedFiles` affects ESLint to adopt the override entry or not. In that case, this override entry doesn't apply to the files which start with `_`. But ESLint verifies the files with other parts of the config. -- The `(B)`, `coreOptions.ignorePatterns` affects ESLint to ignore the file. In that case, this override entry applies to the files which start with `_`. Then ESLint ignores (doesn't verify) the files. - ## Related Discussions - [eslint/eslint#3529](https://github.com/eslint/eslint/issues/3529) - Set ignore path in .eslintrc From fdb0bf6fd66af1177a3f2d95fcbd4500f98dc0a0 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Mon, 17 Jun 2019 17:11:34 +0900 Subject: [PATCH 16/18] fix typo --- designs/2019-core-options/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designs/2019-core-options/README.md b/designs/2019-core-options/README.md index 49c9f779..60bd2344 100644 --- a/designs/2019-core-options/README.md +++ b/designs/2019-core-options/README.md @@ -2,7 +2,7 @@ - RFC PR: https://github.com/eslint/rfcs/pull/22 - Authors: Toru Nagashima ([@mysticatea](https://github.com/mysticatea)) -# Configuring core opsions in Config Files +# Configuring core options in Config Files ## Summary From db98bdcfec9473db27e191aad67f1abccb10307f Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Fri, 28 Jun 2019 20:03:28 +0900 Subject: [PATCH 17/18] =?UTF-8?q?disableInlineConfig=20=E2=86=92=20noInlin?= =?UTF-8?q?eConfig?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designs/2019-core-options/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/designs/2019-core-options/README.md b/designs/2019-core-options/README.md index 60bd2344..95f62835 100644 --- a/designs/2019-core-options/README.md +++ b/designs/2019-core-options/README.md @@ -19,7 +19,7 @@ This RFC adds four properties to config files. ```js // .eslintrc.js module.exports = { - disableInlineConfig: false, // Corresponds to --no-inline-config + noInlineConfig: false, // Corresponds to --no-inline-config reportUnusedDisableDirectives: false, // Corresponds to --report-unused-disable-directives verifyOnRecoverableParsingErrors: false, // Corresponds to --verify-on-recoverable-parsing-errors ignorePatterns: [], // Corresponds to --ignore-pattern @@ -27,7 +27,7 @@ module.exports = { overrides: [ { files: ["*.ts"], - disableInlineConfig: false, + noInlineConfig: false, reportUnusedDisableDirectives: false, verifyOnRecoverableParsingErrors: false, // ignorePatterns: [], // Forbid this to avoid confusion with 'excludedFiles' property. @@ -36,17 +36,17 @@ module.exports = { } ``` -### § disableInlineConfig +### § noInlineConfig That value can be a boolean value. Default is `false`. If `true` then it disables inline directive comments such as `/*eslint-disable*/`. -If `disableInlineConfig` is `true`, `--no-inline-config` was not given, and there are one or more directive comments, then ESLint reports each directive comment as a warning message (`severify=1`). For example, `"'eslint-disable' comment was ignored because your config file has 'disableInlineConfig' setting."`. Therefore, end-users can know why directive comments didn't work. +If `noInlineConfig` is `true`, `--no-inline-config` was not given, and there are one or more directive comments, then ESLint reports each directive comment as a warning message (`severify=1`). For example, `"'eslint-disable' comment was ignored because your config file has 'noInlineConfig' setting."`. Therefore, end-users can know why directive comments didn't work.
💠Implementation: -

In Linter#_verifyWithoutProcessors method, the linter checks both providedConfig and filenameOrOptions to determine disableInlineConfig option. The filenameOrOptions.allowInlineConfig precedences providedConfig.disableInlineConfig.

+

In Linter#_verifyWithoutProcessors method, the linter checks both providedConfig and filenameOrOptions to determine noInlineConfig option. The filenameOrOptions.allowInlineConfig precedences providedConfig.noInlineConfig.

### § reportUnusedDisableDirectives From dec010073c26220c4b4510a2cd9069aa058ba8ac Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Fri, 28 Jun 2019 20:04:13 +0900 Subject: [PATCH 18/18] reorder ignorePatterns concatenation --- designs/2019-core-options/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designs/2019-core-options/README.md b/designs/2019-core-options/README.md index 95f62835..b4c36717 100644 --- a/designs/2019-core-options/README.md +++ b/designs/2019-core-options/README.md @@ -85,8 +85,8 @@ This is very similar to `.eslintignore` file. Each value is a file pattern as sa ESLint concatenates all ignore patterns from all of `.eslintignore`, `--ignore-path`, `--ignore-pattern`, and `ignorePatterns`. If there are multiple `ignorePatterns` in a `ConfigArray`, all of them are concatenated. The order is: 1. The default ignoring. (I.e. `.*`, `node_modules/*`, and `bower_components/*`) -1. `--ignore-path` or `.eslintignore`. 1. `ignorePatterns` in the appearance order in the config array. +1. `--ignore-path` or `.eslintignore`. 1. `--ignore-pattern` Negative patterns mean unignoring. For example, `!.*.js` makes ESLint checking JavaScript files which start with `.`. Negative patterns are used to override parent settings.