From 9e127bfe190a2b25f5894d191a11d59714313bd7 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Mon, 14 Oct 2019 15:13:16 +0900 Subject: [PATCH 1/8] Update: deprecate personal config (fixes #11914, refs eslint/rfcs#32) --- docs/user-guide/configuring.md | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/docs/user-guide/configuring.md b/docs/user-guide/configuring.md index e68294205c1..885ee9d3bff 100644 --- a/docs/user-guide/configuring.md +++ b/docs/user-guide/configuring.md @@ -3,9 +3,7 @@ ESLint is designed to be completely configurable, meaning you can turn off every rule and run only with basic syntax validation, or mix and match the bundled rules and your custom rules to make ESLint perfect for your project. There are two primary ways to configure ESLint: 1. **Configuration Comments** - use JavaScript comments to embed configuration information directly into a file. -1. **Configuration Files** - use a JavaScript, JSON or YAML file to specify configuration information for an entire directory (other than your home directory) and all of its subdirectories. This can be in the form of an [`.eslintrc.*`](#configuration-file-formats) file or an `eslintConfig` field in a [`package.json`](https://docs.npmjs.com/files/package.json) file, both of which ESLint will look for and read automatically, or you can specify a configuration file on the [command line](command-line-interface). - - If you have a configuration file in your home directory (generally `~/`), ESLint uses it **only** if ESLint cannot find any other configuration file. +1. **Configuration Files** - use a JavaScript, JSON or YAML file to specify configuration information for an entire directory and all of its subdirectories. This can be in the form of an [`.eslintrc.*`](#configuration-file-formats) file or an `eslintConfig` field in a [`package.json`](https://docs.npmjs.com/files/package.json) file, both of which ESLint will look for and read automatically, or you can specify a configuration file on the [command line](command-line-interface). There are several pieces of information that can be configured: @@ -711,8 +709,6 @@ your-project If there is an `.eslintrc` and a `package.json` file found in the same directory, `.eslintrc` will take a priority and `package.json` file will not be used. -**Note:** If you have a personal configuration file in your home directory (`~/.eslintrc`), it will only be used if no other configuration files are found. Since a personal configuration would apply to everything inside of a user's directory, including third-party code, this could cause problems when running ESLint. - By default, ESLint will look for configuration files in all parent folders up to the root directory. This can be useful if you want all of your projects to follow a certain convention, but can sometimes lead to unexpected results. To limit ESLint to a specific project, place `"root": true` inside the `eslintConfig` field of the `package.json` file or in the `.eslintrc.*` file at your project's root level. ESLint will stop looking in parent folders once it finds a configuration with `"root": true`. ```js @@ -733,7 +729,6 @@ For example, consider `projectA` which has `"root": true` set in the `.eslintrc` ```text home └── user - ├── .eslintrc <- Always skipped if other configs present └── projectA ├── .eslintrc <- Not used └── lib @@ -756,7 +751,6 @@ The complete configuration hierarchy, from highest precedence to lowest preceden 1. Project-level configuration: 1. `.eslintrc.*` or `package.json` file in same directory as linted file 1. Continue searching for `.eslintrc` and `package.json` files in ancestor directories (parent has highest precedence, then grandparent, etc.), up to and including the root directory or until a config with `"root": true` is found. -1. In the absence of any configuration from (1) through (3), fall back to a personal default configuration in `~/.eslintrc`. ## Extending Configuration Files @@ -1085,3 +1079,23 @@ foo.js ``` This message occurs because ESLint is unsure if you wanted to actually lint the file or not. As the message indicates, you can use `--no-ignore` to omit using the ignore rules. + +## Personal Configuration File (deprecated) + +⚠️ **This feature has been deprecated**. It will start to print deprecation warnings on ESLint `7.0.0` and will be removed on ESLint `8.0.0`. If you want to continue to use personal configuration file, please use [`--config` CLI option](https://eslint.org/docs/user-guide/command-line-interface#-c---config). If you want to know the discussion of this decision, see [RFC 28](https://github.com/eslint/rfcs/pull/28) and [RFC 32](https://github.com/eslint/rfcs/pull/32). + +Here `~/` means [the home directory of the current user on your OS](https://nodejs.org/api/os.html#os_os_homedir). The personal configuration file is `~/.eslintrc.*` file. ESLint handles `~/.eslintrc.*` file in special. + +### How ESLint Finds Personal Configuration File + +If `eslint` could not find any configuration file in the project, `eslint` loads `~/.eslintrc.*` file. + +If `eslint` could find configuration files in the project, `eslint` ignores `~/.eslintrc.*` file even if it's in an ancestor directory of the project directory. + +### How Personal Configuration File Behaves + +`~/.eslintrc.*` file behaves samely as regular configuration files, but there are some notes. + +The `~/.eslintrc.*` file loads shareable configs and custom parsers from `~/node_modules/` as similar to `require()` in home directory. Please mind that it doesn't load global-installed packages. + +The `~/.eslintrc.*` file loads plugins from `$CWD/node_modules` because ESLint loads plugins from `$CWD/node_modules` at all in order to identify plugins uniquely. If you want to use plugins with `~/.eslintrc.*` file, you have to install the plugins into each project. Or you can use [`--resolve-plugins-relative-to` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--resolve-plugins-relative-to) to change the location where ESLint loads plugins from. From 289c278de8e94e9a0ae605c103e13915e73a3c85 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Tue, 29 Oct 2019 18:56:16 +0900 Subject: [PATCH 2/8] Update docs/user-guide/configuring.md Co-Authored-By: Kevin Partington --- docs/user-guide/configuring.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user-guide/configuring.md b/docs/user-guide/configuring.md index 885ee9d3bff..d5efdcce48e 100644 --- a/docs/user-guide/configuring.md +++ b/docs/user-guide/configuring.md @@ -1094,7 +1094,7 @@ If `eslint` could find configuration files in the project, `eslint` ignores `~/. ### How Personal Configuration File Behaves -`~/.eslintrc.*` file behaves samely as regular configuration files, but there are some notes. +`~/.eslintrc.*` file behaves in the same way as regular configuration files, but there are some notes. The `~/.eslintrc.*` file loads shareable configs and custom parsers from `~/node_modules/` as similar to `require()` in home directory. Please mind that it doesn't load global-installed packages. From 18bf1d7794b85e9ebaffd0d8051647ea3b50b033 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Tue, 29 Oct 2019 18:56:25 +0900 Subject: [PATCH 3/8] Update docs/user-guide/configuring.md Co-Authored-By: Kevin Partington --- docs/user-guide/configuring.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user-guide/configuring.md b/docs/user-guide/configuring.md index d5efdcce48e..41382366311 100644 --- a/docs/user-guide/configuring.md +++ b/docs/user-guide/configuring.md @@ -1098,4 +1098,4 @@ If `eslint` could find configuration files in the project, `eslint` ignores `~/. The `~/.eslintrc.*` file loads shareable configs and custom parsers from `~/node_modules/` as similar to `require()` in home directory. Please mind that it doesn't load global-installed packages. -The `~/.eslintrc.*` file loads plugins from `$CWD/node_modules` because ESLint loads plugins from `$CWD/node_modules` at all in order to identify plugins uniquely. If you want to use plugins with `~/.eslintrc.*` file, you have to install the plugins into each project. Or you can use [`--resolve-plugins-relative-to` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--resolve-plugins-relative-to) to change the location where ESLint loads plugins from. +The `~/.eslintrc.*` file loads plugins from `$CWD/node_modules` because ESLint loads plugins from `$CWD/node_modules` by default in order to identify plugins uniquely. If you want to use plugins with `~/.eslintrc.*` file, you have to install the plugins into each project. Or you can use [`--resolve-plugins-relative-to` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--resolve-plugins-relative-to) to change the location where ESLint loads plugins from. From 0425f2e08de9749a46c54088aa65d70e9b467a2f Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Sat, 2 Nov 2019 17:55:13 +0900 Subject: [PATCH 4/8] Update docs/user-guide/configuring.md Co-Authored-By: Kai Cataldo <7041728+kaicataldo@users.noreply.github.com> --- docs/user-guide/configuring.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user-guide/configuring.md b/docs/user-guide/configuring.md index 41382366311..66c3c1c94e0 100644 --- a/docs/user-guide/configuring.md +++ b/docs/user-guide/configuring.md @@ -1084,7 +1084,7 @@ This message occurs because ESLint is unsure if you wanted to actually lint the ⚠️ **This feature has been deprecated**. It will start to print deprecation warnings on ESLint `7.0.0` and will be removed on ESLint `8.0.0`. If you want to continue to use personal configuration file, please use [`--config` CLI option](https://eslint.org/docs/user-guide/command-line-interface#-c---config). If you want to know the discussion of this decision, see [RFC 28](https://github.com/eslint/rfcs/pull/28) and [RFC 32](https://github.com/eslint/rfcs/pull/32). -Here `~/` means [the home directory of the current user on your OS](https://nodejs.org/api/os.html#os_os_homedir). The personal configuration file is `~/.eslintrc.*` file. ESLint handles `~/.eslintrc.*` file in special. +`~/` refers to [the home directory of the current user on your preferred operating system](https://nodejs.org/api/os.html#os_os_homedir). The personal configuration file being referred to here is `~/.eslintrc.*` file, which is currently handled differently than other configuration files. ### How ESLint Finds Personal Configuration File From 35ba49e80184c13cd2e23b326e8965ec8bfb829b Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Sat, 2 Nov 2019 17:55:30 +0900 Subject: [PATCH 5/8] Update docs/user-guide/configuring.md Co-Authored-By: Kai Cataldo <7041728+kaicataldo@users.noreply.github.com> --- docs/user-guide/configuring.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user-guide/configuring.md b/docs/user-guide/configuring.md index 66c3c1c94e0..47962c79678 100644 --- a/docs/user-guide/configuring.md +++ b/docs/user-guide/configuring.md @@ -1094,7 +1094,7 @@ If `eslint` could find configuration files in the project, `eslint` ignores `~/. ### How Personal Configuration File Behaves -`~/.eslintrc.*` file behaves in the same way as regular configuration files, but there are some notes. +`~/.eslintrc.*` files behave similarly to regular configuration files, with some exceptions: The `~/.eslintrc.*` file loads shareable configs and custom parsers from `~/node_modules/` as similar to `require()` in home directory. Please mind that it doesn't load global-installed packages. From dcef6c455f608539b7dc53b58a9d2f9845dd77fa Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Sat, 2 Nov 2019 17:55:40 +0900 Subject: [PATCH 6/8] Update docs/user-guide/configuring.md Co-Authored-By: Kai Cataldo <7041728+kaicataldo@users.noreply.github.com> --- docs/user-guide/configuring.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user-guide/configuring.md b/docs/user-guide/configuring.md index 47962c79678..466fbe2657e 100644 --- a/docs/user-guide/configuring.md +++ b/docs/user-guide/configuring.md @@ -1096,6 +1096,6 @@ If `eslint` could find configuration files in the project, `eslint` ignores `~/. `~/.eslintrc.*` files behave similarly to regular configuration files, with some exceptions: -The `~/.eslintrc.*` file loads shareable configs and custom parsers from `~/node_modules/` as similar to `require()` in home directory. Please mind that it doesn't load global-installed packages. +`~/.eslintrc.*` files load shareable configs and custom parsers from `~/node_modules/` – similarly to `require()` – in the user's home directory. Please note that it doesn't load global-installed packages. The `~/.eslintrc.*` file loads plugins from `$CWD/node_modules` because ESLint loads plugins from `$CWD/node_modules` by default in order to identify plugins uniquely. If you want to use plugins with `~/.eslintrc.*` file, you have to install the plugins into each project. Or you can use [`--resolve-plugins-relative-to` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--resolve-plugins-relative-to) to change the location where ESLint loads plugins from. From 9e4345790d4154facf495edf4bd91d266dfee552 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Sat, 2 Nov 2019 17:55:51 +0900 Subject: [PATCH 7/8] Update docs/user-guide/configuring.md Co-Authored-By: Kai Cataldo <7041728+kaicataldo@users.noreply.github.com> --- docs/user-guide/configuring.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user-guide/configuring.md b/docs/user-guide/configuring.md index 466fbe2657e..25899a1e32d 100644 --- a/docs/user-guide/configuring.md +++ b/docs/user-guide/configuring.md @@ -1098,4 +1098,4 @@ If `eslint` could find configuration files in the project, `eslint` ignores `~/. `~/.eslintrc.*` files load shareable configs and custom parsers from `~/node_modules/` – similarly to `require()` – in the user's home directory. Please note that it doesn't load global-installed packages. -The `~/.eslintrc.*` file loads plugins from `$CWD/node_modules` because ESLint loads plugins from `$CWD/node_modules` by default in order to identify plugins uniquely. If you want to use plugins with `~/.eslintrc.*` file, you have to install the plugins into each project. Or you can use [`--resolve-plugins-relative-to` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--resolve-plugins-relative-to) to change the location where ESLint loads plugins from. +`~/.eslintrc.*` files load plugins from `$CWD/node_modules` by default in order to identify plugins uniquely. If you want to use plugins with `~/.eslintrc.*` files, plugins must be installed locally per project. Alternatively, you can use the [`--resolve-plugins-relative-to` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--resolve-plugins-relative-to) to change the location from which ESLint loads plugins. From 1ce9586ceca7ba41231457e02872c68756f926c2 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Thu, 14 Nov 2019 19:40:43 +0900 Subject: [PATCH 8/8] update the deprecation note --- docs/user-guide/configuring.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user-guide/configuring.md b/docs/user-guide/configuring.md index 25899a1e32d..00d4cfe93f0 100644 --- a/docs/user-guide/configuring.md +++ b/docs/user-guide/configuring.md @@ -1082,7 +1082,7 @@ This message occurs because ESLint is unsure if you wanted to actually lint the ## Personal Configuration File (deprecated) -⚠️ **This feature has been deprecated**. It will start to print deprecation warnings on ESLint `7.0.0` and will be removed on ESLint `8.0.0`. If you want to continue to use personal configuration file, please use [`--config` CLI option](https://eslint.org/docs/user-guide/command-line-interface#-c---config). If you want to know the discussion of this decision, see [RFC 28](https://github.com/eslint/rfcs/pull/28) and [RFC 32](https://github.com/eslint/rfcs/pull/32). +⚠️ **This feature has been deprecated**. ESLint will print deprecation warnings beginning with the 7.0.0 release. This feature will then be removed in the 8.0.0 release. If you want to continue to use personal configuration files, please use the [`--config` CLI option](https://eslint.org/docs/user-guide/command-line-interface#-c---config). For more information regarding this decision, please see [RFC 28](https://github.com/eslint/rfcs/pull/28) and [RFC 32](https://github.com/eslint/rfcs/pull/32). `~/` refers to [the home directory of the current user on your preferred operating system](https://nodejs.org/api/os.html#os_os_homedir). The personal configuration file being referred to here is `~/.eslintrc.*` file, which is currently handled differently than other configuration files.