From eaf4b7c9f6483220c1224f51d6b77541ef97f9d9 Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Thu, 13 Jun 2024 09:21:37 +0200 Subject: [PATCH] tests: Make `ecmaVersion()` compatible with ESLint 9 --- tests/lib/rules/utils.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/lib/rules/utils.js b/tests/lib/rules/utils.js index 3a0349b..93d90f3 100644 --- a/tests/lib/rules/utils.js +++ b/tests/lib/rules/utils.js @@ -1,4 +1,16 @@ +const eslintPkg = require('eslint/package.json'); + +const USE_LANGUAGE_OPTIONS = eslintPkg.version.startsWith('9.'); + function ecmaVersion(version) { + if (USE_LANGUAGE_OPTIONS) { + return { + languageOptions: { + ecmaVersion: version + } + }; + } + return { parserOptions: { ecmaVersion: version