Skip to content

Commit 34c05a7

Browse files
bpmuttersnitin315amareshsm
authored
docs: Language Options page intro and tweaks (#16511)
* docs: language options intro + tweaks Partial fix to #16473 * Apply suggestions from code review Co-authored-by: Nitin Kumar <[email protected]> Co-authored-by: Amaresh S M <[email protected]> * Apply suggestions from code review Co-authored-by: Nitin Kumar <[email protected]> Co-authored-by: Amaresh S M <[email protected]>
1 parent 3e66387 commit 34c05a7

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

docs/src/user-guide/configuring/language-options.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ eleventyNavigation:
88

99
---
1010

11+
The JavaScript ecosystem has a variety of runtimes, versions, extensions, and frameworks. Each of these can have different supported syntax and global variables. ESLint lets you configure language options specific to the JavaScript used in your project, like custom global variables. You can also use plugins to extend ESLint to support your project's language options.
12+
1113
## Specifying Environments
1214

1315
An environment provides predefined global variables. The available environments are:
@@ -51,7 +53,7 @@ Environments can be specified inside of a file, in configuration files or using
5153

5254
### Using configuration comments
5355

54-
To specify environments using a comment inside of your JavaScript file, use the following format:
56+
To specify environments with a comment inside of a JavaScript file, use the following format:
5557

5658
```js
5759
/* eslint-env node, mocha */
@@ -61,7 +63,7 @@ This enables Node.js and Mocha environments.
6163

6264
### Using configuration files
6365

64-
To specify environments in a configuration file, use the `env` key and specify which environments you want to enable by setting each to `true`. For example, the following enables the browser and Node.js environments:
66+
To specify environments in a configuration file, use the `env` key. Specify which environments you want to enable by setting each to `true`. For example, the following enables the browser and Node.js environments:
6567

6668
```json
6769
{
@@ -166,7 +168,7 @@ And in YAML:
166168

167169
These examples allow `var1` to be overwritten in your code, but disallow it for `var2`.
168170

169-
Globals can be disabled with the string `"off"`. For example, in an environment where most ES2015 globals are available but `Promise` is unavailable, you might use this config:
171+
Globals can be disabled by setting their value to `"off"`. For example, in an environment where most ES2015 globals are available but `Promise` is unavailable, you might use this config:
170172

171173
```json
172174
{
@@ -179,21 +181,19 @@ Globals can be disabled with the string `"off"`. For example, in an environment
179181
}
180182
```
181183

182-
For historical reasons, the boolean value `false` and the string value `"readable"` are equivalent to `"readonly"`. Similarly, the boolean value `true` and the string value `"writeable"` are equivalent to `"writable"`. However, the use of older values is deprecated.
184+
For historical reasons, the boolean value `false` and the string value `"readable"` are equivalent to `"readonly"`. Similarly, the boolean value `true` and the string value `"writeable"` are equivalent to `"writable"`. However, the use of these older values is deprecated.
183185

184186
## Specifying Parser Options
185187

186-
ESLint allows you to specify the JavaScript language options you want to support. By default, ESLint expects ECMAScript 5 syntax. You can override that setting to enable support for other ECMAScript versions as well as JSX by using parser options.
188+
ESLint allows you to specify the JavaScript language options you want to support. By default, ESLint expects ECMAScript 5 syntax. You can override that setting to enable support for other ECMAScript versions and JSX using parser options.
189+
190+
Please note that supporting JSX syntax is not the same as supporting React. React applies specific semantics to JSX syntax that ESLint doesn't recognize. We recommend using [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) if you are using React.
187191

188-
Please note that supporting JSX syntax is not the same as supporting React. React applies specific semantics to JSX syntax that ESLint doesn't recognize. We recommend using [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) if you are using React and want React semantics.
189-
By the same token, supporting ES6 syntax is not the same as supporting new ES6 globals (e.g., new types such as
190-
`Set`).
191-
For ES6 syntax, use `{ "parserOptions": { "ecmaVersion": 6 } }`; for new ES6 global variables, use `{ "env":
192-
{ "es6": true } }`. `{ "env": { "es6": true } }` enables ES6 syntax automatically, but `{ "parserOptions": { "ecmaVersion": 6 } }` does not enable ES6 globals automatically.
192+
By the same token, supporting ES6 syntax is not the same as supporting new ES6 globals (e.g., new types such as `Set`). For ES6 syntax, use `{ "parserOptions": { "ecmaVersion": 6 } }`; for new ES6 global variables, use `{ "env": { "es6": true } }`. Setting `{ "env": { "es6": true } }` enables ES6 syntax automatically, but `{ "parserOptions": { "ecmaVersion": 6 } }` does not enable ES6 globals automatically.
193193

194-
Parser options are set in your `.eslintrc.*` file by using the `parserOptions` property. The available options are:
194+
Parser options are set in your `.eslintrc.*` file with the `parserOptions` property. The available options are:
195195

196-
* `ecmaVersion` - set to 3, 5 (default), 6, 7, 8, 9, 10, 11, 12, 13, or 14 to specify the version of ECMAScript syntax you want to use. You can also set to 2015 (same as 6), 2016 (same as 7), 2017 (same as 8), 2018 (same as 9), 2019 (same as 10), 2020 (same as 11), 2021 (same as 12), 2022 (same as 13), or 2023 (same as 14) to use the year-based naming. You can also set "latest" to use the most recently supported version.
196+
* `ecmaVersion` - set to 3, 5 (default), 6, 7, 8, 9, 10, 11, 12, 13, or 14 to specify the version of ECMAScript syntax you want to use. You can also set it to 2015 (same as 6), 2016 (same as 7), 2017 (same as 8), 2018 (same as 9), 2019 (same as 10), 2020 (same as 11), 2021 (same as 12), 2022 (same as 13), or 2023 (same as 14) to use the year-based naming. You can also set `"latest"` to use the most recently supported version.
197197
* `sourceType` - set to `"script"` (default) or `"module"` if your code is in ECMAScript modules.
198198
* `allowReserved` - allow the use of reserved words as identifiers (if `ecmaVersion` is 3).
199199
* `ecmaFeatures` - an object indicating which additional language features you'd like to use:

0 commit comments

Comments
 (0)