Skip to content

Commit

Permalink
docs: remove outdated info about environments (#19296)
Browse files Browse the repository at this point in the history
  • Loading branch information
fasttime authored Dec 31, 2024
1 parent eec01f0 commit 5d64851
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 16 deletions.
3 changes: 1 addition & 2 deletions docs/src/rules/no-global-assign.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ This rule disallows modifications to read-only global variables.

ESLint has the capability to configure global variables as read-only.

* [Specifying Environments](../use/configure#specifying-environments)
* [Specifying Globals](../use/configure#specifying-globals)
See also: [Specifying Globals](../use/configure#specifying-globals)

Examples of **incorrect** code for this rule:

Expand Down
7 changes: 2 additions & 5 deletions docs/src/rules/no-implicit-globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,9 @@ Bar.prototype.baz = function () {

This rule also disallows redeclarations of read-only global variables and assignments to read-only global variables.

A read-only global variable can be a built-in ES global (e.g. `Array`), an environment specific global
(e.g. `window` in the browser environment), or a global variable defined as `readonly` in the configuration file
or in a `/*global */` comment.
A read-only global variable can be a built-in ES global (e.g. `Array`), or a global variable defined as `readonly` in the configuration file or in a `/*global */` comment.

* [Specifying Environments](../use/configure#specifying-environments)
* [Specifying Globals](../use/configure#specifying-globals)
See also: [Specifying Globals](../use/configure#specifying-globals)

Examples of **incorrect** code for this rule:

Expand Down
3 changes: 1 addition & 2 deletions docs/src/rules/no-native-reassign.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ This rule disallows modifications to read-only global variables.

ESLint has the capability to configure global variables as read-only.

* [Specifying Environments](../use/configure#specifying-environments)
* [Specifying Globals](../use/configure#specifying-globals)
See also: [Specifying Globals](../use/configure#specifying-globals)

Examples of **incorrect** code for this rule:

Expand Down
2 changes: 1 addition & 1 deletion docs/src/rules/no-restricted-globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ related_rules:


Disallowing usage of specific global variables can be useful if you want to allow a set of global
variables by enabling an environment, but still want to disallow some of those.
variables, but still want to disallow some of those.

For instance, early Internet Explorer versions exposed the current DOM event as a global variable
`event`, but using this variable has been considered as a bad practice for a long time. Restricting
Expand Down
5 changes: 2 additions & 3 deletions docs/src/rules/no-unused-vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,8 @@ In environments outside of CommonJS or ECMAScript modules, you may use `var` to

Note that `/* exported */` has no effect for any of the following:

* when the environment is `node` or `commonjs`
* when `parserOptions.sourceType` is `module`
* when `ecmaFeatures.globalReturn` is `true`
* when `languageOptions.sourceType` is `module` (default) or `commonjs`
* when `languageOptions.parserOptions.ecmaFeatures.globalReturn` is `true`

The line comment `// exported variableName` will not work as `exported` is not line-specific.

Expand Down
3 changes: 2 additions & 1 deletion docs/src/rules/strict.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ This rule has a string option:

The `"safe"` option corresponds to the `"global"` option if ESLint considers a file to be a **Node.js** or **CommonJS** module because the configuration specifies either of the following:

* `"sourceType": "commonjs"` in [language options](../use/configure/language-options#specifying-javascript-options)
* `"globalReturn": true` property in the `ecmaFeatures` object of [parser options](../use/configure/language-options#specifying-parser-options)

Otherwise the `"safe"` option corresponds to the `"function"` option. Note that if `"globalReturn": false` is explicitly specified in the configuration, the `"safe"` option will correspond to the `"function"` option regardless of the specified environment.
Otherwise the `"safe"` option corresponds to the `"function"` option.

### global

Expand Down
2 changes: 1 addition & 1 deletion docs/src/use/configure/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Here are some of the options that you can configure in ESLint:

* [**Globals**](./language-options#specifying-globals) - the additional global variables your script accesses during execution.
* [**Rules**](rules) - which rules are enabled and at what error level.
* [**Plugins**](plugins) - which third-party plugins define additional rules, environments, configs, etc. for ESLint to use.
* [**Plugins**](plugins) - which third-party plugins define additional rules, languages, configs, etc. for ESLint to use.

All of these options give you fine-grained control over how ESLint treats your code.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/use/core-concepts/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ For more information, refer to [Using a shareable configuration package](../conf

## Plugins

An ESLint plugin is an npm module that can contain a set of ESLint rules, configurations, processors, and environments. Often plugins include custom rules. Plugins can be used to enforce a style guide and support JavaScript extensions (like TypeScript), libraries (like React), and frameworks (Angular).
An ESLint plugin is an npm module that can contain a set of ESLint rules, configurations, processors, and languages. Often plugins include custom rules. Plugins can be used to enforce a style guide and support JavaScript extensions (like TypeScript), libraries (like React), and frameworks (Angular).

A popular use case for plugins is to enforce best practices for a framework. For example, [@angular-eslint/eslint-plugin](https://www.npmjs.com/package/@angular-eslint/eslint-plugin) contains best practices for using the Angular framework.

Expand Down

0 comments on commit 5d64851

Please sign in to comment.