Skip to content

Commit

Permalink
docs: update with "Specifying Parser Options" (#17435)
Browse files Browse the repository at this point in the history
* docs: update with "Specifying Parser Options"

* docs : reapply lint

* Update docs/src/use/configure/language-options.md

* docs : reapply lint

---------

Co-authored-by: Francesco Trotta <github@fasttime.org>
  • Loading branch information
Ryan-Dia and fasttime committed Aug 2, 2023
1 parent d743ed3 commit 2a92b6c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/src/use/configure/language-options.md
Expand Up @@ -191,7 +191,7 @@ ESLint allows you to specify the JavaScript language options you want to support

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/jsx-eslint/eslint-plugin-react) if you are using React.

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.
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. In summary, to support only ES6 syntax, use `{ "parserOptions": { "ecmaVersion": 6 } }`, and to support both ES6 syntax and new ES6 global variables, such as `Set` and others, use `{ "env": { "es6": true } }`.

Parser options are set in your `.eslintrc.*` file with the `parserOptions` property. The available options are:

Expand Down

0 comments on commit 2a92b6c

Please sign in to comment.