From 4ddd4130877cb3ff09bd41f90a24ddef98b0989d Mon Sep 17 00:00:00 2001 From: Milos Djermanovic Date: Fri, 30 Jun 2023 15:38:34 +0200 Subject: [PATCH 1/2] feat: add `ecmaVersion: 2024`, regexp `v` flag parsing --- README.md | 2 +- conf/globals.js | 7 ++++++- docs/src/use/configure/language-options.md | 2 +- lib/shared/types.js | 2 +- package.json | 2 +- tests/lib/linter/linter.js | 2 +- 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 16f6513a3b2..2c8b99345be 100644 --- a/README.md +++ b/README.md @@ -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? diff --git a/conf/globals.js b/conf/globals.js index 6018b7af15c..58710e05bc6 100644 --- a/conf/globals.js +++ b/conf/globals.js @@ -128,6 +128,10 @@ const es2023 = { ...es2022 }; +const es2024 = { + ...es2023 +}; + //----------------------------------------------------------------------------- // Exports @@ -145,5 +149,6 @@ module.exports = { es2020, es2021, es2022, - es2023 + es2023, + es2024 }; diff --git a/docs/src/use/configure/language-options.md b/docs/src/use/configure/language-options.md index 4f8fa148bce..90d7ca73131 100644 --- a/docs/src/use/configure/language-options.md +++ b/docs/src/use/configure/language-options.md @@ -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: diff --git a/lib/shared/types.js b/lib/shared/types.js index 5c10462587a..e3a40bc986b 100644 --- a/lib/shared/types.js +++ b/lib/shared/types.js @@ -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. */ diff --git a/package.json b/package.json index f705b0967ff..c3f334499b2 100644 --- a/package.json +++ b/package.json @@ -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": "github:eslint/espree#prepare-9.6.0", "esquery": "^1.4.2", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", diff --git a/tests/lib/linter/linter.js b/tests/lib/linter/linter.js index 3a8a8fe7e6c..1b8f93d410f 100644 --- a/tests/lib/linter/linter.js +++ b/tests/lib/linter/linter.js @@ -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(); From 6d2cf06787706e7221b78cc1b9c25523baca5c51 Mon Sep 17 00:00:00 2001 From: Milos Djermanovic Date: Fri, 30 Jun 2023 23:45:08 +0200 Subject: [PATCH 2/2] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c3f334499b2..4fa2d8c5d5d 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "escape-string-regexp": "^4.0.0", "eslint-scope": "^7.2.0", "eslint-visitor-keys": "^3.4.1", - "espree": "github:eslint/espree#prepare-9.6.0", + "espree": "^9.6.0", "esquery": "^1.4.2", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3",