Skip to content

Commit

Permalink
feat: add ecmaVersion: 2024, regexp v flag parsing (#17324)
Browse files Browse the repository at this point in the history
* feat: add `ecmaVersion: 2024`, regexp `v` flag parsing

* Update package.json
  • Loading branch information
mdjermanovic committed Jun 30, 2023
1 parent 4d411e4 commit 4c50400
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -117,7 +117,7 @@ Yes, ESLint natively supports parsing JSX syntax (this must be enabled in [confi

### What ECMAScript versions does ESLint support?

ESLint has full support for ECMAScript 3, 5 (default), 2015, 2016, 2017, 2018, 2019, 2020, 2021 and 2022. You can set your desired ECMAScript syntax (and other settings, like global variables or your target environments) through [configuration](https://eslint.org/docs/latest/use/configure).
ESLint has full support for ECMAScript 3, 5 (default), 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, and 2023. You can set your desired ECMAScript syntax (and other settings, like global variables or your target environments) through [configuration](https://eslint.org/docs/latest/use/configure).

### What about experimental features?

Expand Down
7 changes: 6 additions & 1 deletion conf/globals.js
Expand Up @@ -128,6 +128,10 @@ const es2023 = {
...es2022
};

const es2024 = {
...es2023
};


//-----------------------------------------------------------------------------
// Exports
Expand All @@ -145,5 +149,6 @@ module.exports = {
es2020,
es2021,
es2022,
es2023
es2023,
es2024
};
2 changes: 1 addition & 1 deletion docs/src/use/configure/language-options.md
Expand Up @@ -193,7 +193,7 @@ By the same token, supporting ES6 syntax is not the same as supporting new ES6 g

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

* `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.
* `ecmaVersion` - set to 3, 5 (default), 6, 7, 8, 9, 10, 11, 12, 13, 14, or 15 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), 2023 (same as 14), or 2024 (same as 15) to use the year-based naming. You can also set `"latest"` to use the most recently supported version.
* `sourceType` - set to `"script"` (default) or `"module"` if your code is in ECMAScript modules.
* `allowReserved` - allow the use of reserved words as identifiers (if `ecmaVersion` is 3).
* `ecmaFeatures` - an object indicating which additional language features you'd like to use:
Expand Down
2 changes: 1 addition & 1 deletion lib/shared/types.js
Expand Up @@ -21,7 +21,7 @@ module.exports = {};
/**
* @typedef {Object} ParserOptions
* @property {EcmaFeatures} [ecmaFeatures] The optional features.
* @property {3|5|6|7|8|9|10|11|12|13|14|2015|2016|2017|2018|2019|2020|2021|2022|2023} [ecmaVersion] The ECMAScript version (or revision number).
* @property {3|5|6|7|8|9|10|11|12|13|14|15|2015|2016|2017|2018|2019|2020|2021|2022|2023|2024} [ecmaVersion] The ECMAScript version (or revision number).
* @property {"script"|"module"} [sourceType] The source code type.
* @property {boolean} [allowReserved] Allowing the use of reserved words as identifiers in ES3.
*/
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -75,7 +75,7 @@
"escape-string-regexp": "^4.0.0",
"eslint-scope": "^7.2.0",
"eslint-visitor-keys": "^3.4.1",
"espree": "^9.5.2",
"espree": "^9.6.0",
"esquery": "^1.4.2",
"esutils": "^2.0.2",
"fast-deep-equal": "^3.1.3",
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/linter/linter.js
Expand Up @@ -4938,7 +4938,7 @@ var a = "test2";
});

it("supports ECMAScript version 'latest'", () => {
const messages = linter.verify("let x = 5 ** 7;", {
const messages = linter.verify("let x = /[\\q{abc|d}&&[A--B]]/v;", {
parserOptions: { ecmaVersion: "latest" }
});
const suppressedMessages = linter.getSuppressedMessages();
Expand Down

0 comments on commit 4c50400

Please sign in to comment.