diff --git a/configs/base.js b/configs/base.js index 8071bb108c..0a6b7bf164 100644 --- a/configs/base.js +++ b/configs/base.js @@ -4,7 +4,7 @@ module.exports = { es6: true, }, parserOptions: { - ecmaVersion: 2021, + ecmaVersion: 'latest', sourceType: 'module', }, plugins: [ diff --git a/package.json b/package.json index 68dc99f4cf..420b191b40 100644 --- a/package.json +++ b/package.json @@ -57,9 +57,9 @@ "devDependencies": { "@babel/code-frame": "^7.14.5", "@babel/core": "^7.15.5", - "@babel/eslint-parser": "^7.15.4", + "@babel/eslint-parser": "^7.15.7", "@lubien/fixture-beta-package": "^1.0.0-beta.1", - "@typescript-eslint/parser": "^4.31.0", + "@typescript-eslint/parser": "^4.32.0", "ava": "^3.15.0", "chalk": "^4.1.2", "enquirer": "2.3.6", diff --git a/readme.md b/readme.md index 9069dea413..38a8e72eda 100644 --- a/readme.md +++ b/readme.md @@ -28,7 +28,7 @@ Configure it in `package.json`. "es6": true }, "parserOptions": { - "ecmaVersion": 2021, + "ecmaVersion": "latest", "sourceType": "module" }, "plugins": [ diff --git a/test/consistent-function-scoping.mjs b/test/consistent-function-scoping.mjs index cc089e2fb7..a08deef7fa 100644 --- a/test/consistent-function-scoping.mjs +++ b/test/consistent-function-scoping.mjs @@ -16,8 +16,6 @@ const createError = (functionNameWithKind, loc) => ({ test({ testerOptions: { parserOptions: { - sourceType: 'module', - ecmaVersion: 2021, ecmaFeatures: { jsx: true, }, diff --git a/test/integration/config.js b/test/integration/config.js index 69b6b44e85..d9af78bf98 100644 --- a/test/integration/config.js +++ b/test/integration/config.js @@ -4,10 +4,6 @@ module.exports = { root: true, parser: '@babel/eslint-parser', parserOptions: { - ecmaVersion: 2021, - ecmaFeatures: { - jsx: true, - }, requireConfigFile: false, babelOptions: { babelrc: false, diff --git a/test/integration/projects.mjs b/test/integration/projects.mjs index c27baa88ef..3883e33faf 100644 --- a/test/integration/projects.mjs +++ b/test/integration/projects.mjs @@ -88,8 +88,8 @@ export default [ // 'build/**' // ] // }, - 'https://github.com/ElemeFE/element', - 'https://github.com/iview/iview', + // 'https://github.com/ElemeFE/element', + // 'https://github.com/iview/iview', 'https://github.com/sindresorhus/create-dmg', 'https://github.com/sindresorhus/cp-file', 'https://github.com/sindresorhus/capture-website', diff --git a/test/no-for-loop.mjs b/test/no-for-loop.mjs index 145ee8ae93..424b73ad62 100644 --- a/test/no-for-loop.mjs +++ b/test/no-for-loop.mjs @@ -731,6 +731,7 @@ test({ test(avoidTestTitleConflict({ testerOptions: { parserOptions: { + sourceType: 'script', ecmaVersion: 5, }, }, diff --git a/test/no-keyword-prefix.mjs b/test/no-keyword-prefix.mjs index cfce5742d3..e51ad3928d 100644 --- a/test/no-keyword-prefix.mjs +++ b/test/no-keyword-prefix.mjs @@ -228,12 +228,10 @@ test({ }, { code: 'function foo({ newBar = \'default value\' }) {};', - parserOptions: {ecmaVersion: 6}, errors: [errorNew], }, { code: 'const newFoo = 0; function foo({ newBar = newFoo}) {}', - parserOptions: {ecmaVersion: 6}, errors: [errorNew, errorNew], }, { diff --git a/test/prevent-abbreviations.mjs b/test/prevent-abbreviations.mjs index 91fc984136..913625f268 100644 --- a/test/prevent-abbreviations.mjs +++ b/test/prevent-abbreviations.mjs @@ -1271,6 +1271,7 @@ test.typescript(avoidTestTitleConflict(tests, 'typescript')); test({ testerOptions: { parserOptions: { + sourceType: 'script', ecmaVersion: 5, }, env: { diff --git a/test/smoke/eslint-remote-tester.config.js b/test/smoke/eslint-remote-tester.config.js index fe942813be..0666d87355 100644 --- a/test/smoke/eslint-remote-tester.config.js +++ b/test/smoke/eslint-remote-tester.config.js @@ -29,7 +29,7 @@ module.exports = { }, parser: '@typescript-eslint/parser', parserOptions: { - ecmaVersion: 2020, + ecmaVersion: 'latest', sourceType: 'module', ecmaFeatures: { jsx: true, diff --git a/test/utils/parsers.mjs b/test/utils/parsers.mjs index 1924e91634..5d4b0dde8c 100644 --- a/test/utils/parsers.mjs +++ b/test/utils/parsers.mjs @@ -59,10 +59,18 @@ const vue = { return require.resolve(this.name); }, mergeParserOptions(options) { - return { + options = { ...defaultParserOptions, ...options, }; + + // The `espree` version in `vue-eslint-parser` does not understand `'latest'` yet. + // https://github.com/vuejs/vue-eslint-parser/pull/113 + if (options.ecmaVersion === 'latest') { + options.ecmaVersion = require('espree').latestEcmaVersion; + } + + return options; }, }; diff --git a/test/utils/test.mjs b/test/utils/test.mjs index 0fcc5a318e..303844d562 100644 --- a/test/utils/test.mjs +++ b/test/utils/test.mjs @@ -59,10 +59,13 @@ class Tester { } runTest(tests) { - const {beforeAll, testerOptions, valid, invalid} = tests; + const {beforeAll, testerOptions = {}, valid, invalid} = tests; const tester = avaRuleTester(test, { - parserOptions: defaultParserOptions, ...testerOptions, + parserOptions: { + ...defaultParserOptions, + ...testerOptions.parserOptions, + }, }); if (beforeAll) {