From 77de80903c01b1c4e9a9c4bb04983e8f5f5f3f04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=AF=E7=84=B6?= Date: Thu, 22 Feb 2024 17:54:51 +0800 Subject: [PATCH] build: run test on eslint pre-releases (#171) * build: run test on eslint alpha releases * Update CI.yml * Update CI.yml * chore: fix failing tests refactor the unsupported/* rules tests to make the tests passing. since eslint v9, it starts checking dulp tests; --- .github/workflows/CI.yml | 2 +- .../no-unsupported-features/es-builtins.js | 4766 +++++++------- .../no-unsupported-features/es-syntax.js | 5456 ++++++++--------- 3 files changed, 5085 insertions(+), 5139 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index fb9d73c5..a449c6ed 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -33,7 +33,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macOS-latest] - eslint: [8.x, "9.0.0-alpha.0"] + eslint: [8.x, "next"] node: [18.x, 20.x] include: - os: ubuntu-latest diff --git a/tests/lib/rules/no-unsupported-features/es-builtins.js b/tests/lib/rules/no-unsupported-features/es-builtins.js index 870698d6..a98ca5f9 100644 --- a/tests/lib/rules/no-unsupported-features/es-builtins.js +++ b/tests/lib/rules/no-unsupported-features/es-builtins.js @@ -41,2397 +41,2389 @@ function ignores(keyword) { } } -/** - * Concatenate patterns. - * @param {Array<{valid:Array,invalid:Array}>} patterns The patterns to concat. - * @returns {{valid:Array,invalid:Array}} The concatenated patterns. - */ -function concat(patterns) { - const ret = { - valid: [], - invalid: [], - } +function runTests(patterns) { + for (const pattern of patterns) { + const ruleTester = new RuleTester({ + languageOptions: { + ecmaVersion: "latest", + globals: globals.builtin, + }, + }) - for (const { keyword, valid, invalid } of patterns) { - ret.valid.push(...valid) - ret.invalid.push(...invalid) + const tests = { + valid: pattern.valid, + invalid: pattern.invalid, + } // Add the invalid patterns with `ignores` option into the valid patterns. - ret.valid.push(...invalid.map(ignores(keyword))) - } + tests.valid.push(...pattern.invalid.map(ignores(pattern.keyword))) - return ret + ruleTester.run("no-unsupported-features/es-builtins", rule, tests) + } } -const ruleTester = new RuleTester({ - languageOptions: { ecmaVersion: 2018, globals: globals.builtin }, -}) -ruleTester.run( - "no-unsupported-features/es-builtins", - rule, - concat([ - { - keyword: "AggregateError", - valid: [ - { - code: "if (error instanceof AggregateError) {}", - options: [{ version: "15.0.0" }], - }, - ], - invalid: [ - { - code: "if (error instanceof AggregateError) {}", - options: [{ version: "14.0.0" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "AggregateError", - supported: "15.0.0", - version: "14.0.0", - }, - }, - ], - }, - ], - }, - { - keyword: "Array.from", - valid: [ - { - code: "Array.foo(a)", - options: [{ version: "3.9.9" }], - }, - { - code: "(function(Array) { Array.from(a) }(b))", - options: [{ version: "3.9.9" }], - }, - { - code: "Array.from(a)", - options: [{ version: "4.0.0" }], - }, - ], - invalid: [ - { - code: "Array.from(a)", - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Array.from", - supported: "4.0.0", - version: "3.9.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Array.of", - valid: [ - { - code: "Array.foo(a)", - options: [{ version: "3.9.9" }], - }, - { - code: "(function(Array) { Array.of(a) }(b))", - options: [{ version: "3.9.9" }], - }, - { - code: "Array.of(a)", - options: [{ version: "4.0.0" }], - }, - ], - invalid: [ - { - code: "Array.of(a)", - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Array.of", - supported: "4.0.0", - version: "3.9.9", - }, - }, - ], - }, - ], - }, - { - keyword: "BigInt", - valid: [ - { - code: "bigint", - options: [{ version: "10.3.0" }], - }, - { - code: "(function(BigInt) { BigInt }(b))", - options: [{ version: "10.3.0" }], - }, - { - code: "BigInt", - options: [{ version: "10.4.0" }], - }, - ], - invalid: [ - { - code: "BigInt", - options: [{ version: "10.3.0" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "BigInt", - supported: "10.4.0", - version: "10.3.0", - }, - }, - ], - }, - { - code: "(function() { BigInt })()", - options: [{ version: "10.3.0" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "BigInt", - supported: "10.4.0", - version: "10.3.0", - }, - }, - ], - }, - ], - }, - { - keyword: "FinalizationRegistry", - valid: [ - { - code: "new FinalizationRegistry(() => {})", - options: [{ version: "14.6.0" }], - }, - ], - invalid: [ - { - code: "new FinalizationRegistry(() => {})", - options: [{ version: "14.5.0" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "FinalizationRegistry", - supported: "14.6.0", - version: "14.5.0", - }, - }, - ], - }, - ], - }, - { - keyword: "Map", - valid: [ - { - code: "map", - options: [{ version: "0.11.9" }], - }, - { - code: "(function(Map) { Map }(b))", - options: [{ version: "0.11.9" }], - }, - { - code: "Map", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "Map", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Map", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - { - code: "(function() { Map })()", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Map", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Math.acosh", - valid: [ - { - code: "Math.foo(a)", - options: [{ version: "0.11.9" }], - }, - { - code: "(function(Math) { Math.acosh(a) }(b))", - options: [{ version: "0.11.9" }], - }, - { - code: "Math.acosh(a)", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "Math.acosh(a)", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Math.acosh", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Math.asinh", - valid: [ - { - code: "Math.foo(a)", - options: [{ version: "0.11.9" }], - }, - { - code: "(function(Math) { Math.asinh(a) }(b))", - options: [{ version: "0.11.9" }], - }, - { - code: "Math.asinh(a)", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "Math.asinh(a)", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Math.asinh", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Math.atanh", - valid: [ - { - code: "Math.foo(a)", - options: [{ version: "0.11.9" }], - }, - { - code: "(function(Math) { Math.atanh(a) }(b))", - options: [{ version: "0.11.9" }], - }, - { - code: "Math.atanh(a)", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "Math.atanh(a)", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Math.atanh", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Math.cbrt", - valid: [ - { - code: "Math.foo(a)", - options: [{ version: "0.11.9" }], - }, - { - code: "(function(Math) { Math.cbrt(a) }(b))", - options: [{ version: "0.11.9" }], - }, - { - code: "Math.cbrt(a)", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "Math.cbrt(a)", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Math.cbrt", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Math.clz32", - valid: [ - { - code: "Math.foo(a)", - options: [{ version: "0.11.9" }], - }, - { - code: "(function(Math) { Math.clz32(a) }(b))", - options: [{ version: "0.11.9" }], - }, - { - code: "Math.clz32(a)", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "Math.clz32(a)", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Math.clz32", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Math.cosh", - valid: [ - { - code: "Math.foo(a)", - options: [{ version: "0.11.9" }], - }, - { - code: "(function(Math) { Math.cosh(a) }(b))", - options: [{ version: "0.11.9" }], - }, - { - code: "Math.cosh(a)", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "Math.cosh(a)", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Math.cosh", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Math.expm1", - valid: [ - { - code: "Math.foo(a)", - options: [{ version: "0.11.9" }], - }, - { - code: "(function(Math) { Math.expm1(a) }(b))", - options: [{ version: "0.11.9" }], - }, - { - code: "Math.expm1(a)", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "Math.expm1(a)", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Math.expm1", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Math.fround", - valid: [ - { - code: "Math.foo(a)", - options: [{ version: "0.11.9" }], - }, - { - code: "(function(Math) { Math.fround(a) }(b))", - options: [{ version: "0.11.9" }], - }, - { - code: "Math.fround(a)", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "Math.fround(a)", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Math.fround", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Math.hypot", - valid: [ - { - code: "Math.foo(a)", - options: [{ version: "0.11.9" }], - }, - { - code: "(function(Math) { Math.hypot(a) }(b))", - options: [{ version: "0.11.9" }], - }, - { - code: "Math.hypot(a)", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "Math.hypot(a)", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Math.hypot", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Math.imul", - valid: [ - { - code: "Math.foo(a)", - options: [{ version: "0.11.9" }], - }, - { - code: "(function(Math) { Math.imul(a) }(b))", - options: [{ version: "0.11.9" }], - }, - { - code: "Math.imul(a)", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "Math.imul(a)", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Math.imul", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Math.log10", - valid: [ - { - code: "Math.foo(a)", - options: [{ version: "0.11.9" }], - }, - { - code: "(function(Math) { Math.log10(a) }(b))", - options: [{ version: "0.11.9" }], - }, - { - code: "Math.log10(a)", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "Math.log10(a)", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Math.log10", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Math.log1p", - valid: [ - { - code: "Math.foo(a)", - options: [{ version: "0.11.9" }], - }, - { - code: "(function(Math) { Math.log1p(a) }(b))", - options: [{ version: "0.11.9" }], - }, - { - code: "Math.log1p(a)", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "Math.log1p(a)", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Math.log1p", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Math.log2", - valid: [ - { - code: "Math.foo(a)", - options: [{ version: "0.11.9" }], - }, - { - code: "(function(Math) { Math.log2(a) }(b))", - options: [{ version: "0.11.9" }], - }, - { - code: "Math.log2(a)", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "Math.log2(a)", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Math.log2", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Math.sign", - valid: [ - { - code: "Math.foo(a)", - options: [{ version: "0.11.9" }], - }, - { - code: "(function(Math) { Math.sign(a) }(b))", - options: [{ version: "0.11.9" }], - }, - { - code: "Math.sign(a)", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "Math.sign(a)", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Math.sign", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Math.sinh", - valid: [ - { - code: "Math.foo(a)", - options: [{ version: "0.11.9" }], - }, - { - code: "(function(Math) { Math.sinh(a) }(b))", - options: [{ version: "0.11.9" }], - }, - { - code: "Math.sinh(a)", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "Math.sinh(a)", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Math.sinh", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Math.tanh", - valid: [ - { - code: "Math.foo(a)", - options: [{ version: "0.11.9" }], - }, - { - code: "(function(Math) { Math.tanh(a) }(b))", - options: [{ version: "0.11.9" }], - }, - { - code: "Math.tanh(a)", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "Math.tanh(a)", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Math.tanh", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Math.trunc", - valid: [ - { - code: "Math.foo(a)", - options: [{ version: "0.11.9" }], - }, - { - code: "(function(Math) { Math.trunc(a) }(b))", - options: [{ version: "0.11.9" }], - }, - { - code: "Math.trunc(a)", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "Math.trunc(a)", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Math.trunc", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Number.isFinite", - valid: [ - { - code: "Number.foo(a)", - options: [{ version: "0.9.9" }], - }, - { - code: "(function(Number) { Number.isFinite(a) }(b))", - options: [{ version: "0.9.9" }], - }, - { - code: "Number.isFinite(a)", - options: [{ version: "0.10.0" }], - }, - ], - invalid: [ - { - code: "Number.isFinite(a)", - options: [{ version: "0.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Number.isFinite", - supported: "0.10.0", - version: "0.9.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Number.isInteger", - valid: [ - { - code: "Number.foo(a)", - options: [{ version: "0.11.9" }], - }, - { - code: "(function(Number) { Number.isInteger(a) }(b))", - options: [{ version: "0.11.9" }], - }, - { - code: "Number.isInteger(a)", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "Number.isInteger(a)", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Number.isInteger", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Number.isNaN", - valid: [ - { - code: "Number.foo(a)", - options: [{ version: "0.9.9" }], - }, - { - code: "(function(Number) { Number.isNaN(a) }(b))", - options: [{ version: "0.9.9" }], - }, - { - code: "Number.isNaN(a)", - options: [{ version: "0.10.0" }], - }, - ], - invalid: [ - { - code: "Number.isNaN(a)", - options: [{ version: "0.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Number.isNaN", - supported: "0.10.0", - version: "0.9.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Number.isSafeInteger", - valid: [ - { - code: "Number.foo(a)", - options: [{ version: "0.11.9" }], - }, - { - code: "(function(Number) { Number.isSafeInteger(a) }(b))", - options: [{ version: "0.11.9" }], - }, - { - code: "Number.isSafeInteger(a)", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "Number.isSafeInteger(a)", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Number.isSafeInteger", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Number.parseFloat", - valid: [ - { - code: "Number.foo(a)", - options: [{ version: "0.11.9" }], - }, - { - code: "(function(Number) { Number.parseFloat(a) }(b))", - options: [{ version: "0.11.9" }], - }, - { - code: "Number.parseFloat(a)", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "Number.parseFloat(a)", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Number.parseFloat", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Number.parseInt", - valid: [ - { - code: "Number.foo(a)", - options: [{ version: "0.11.9" }], - }, - { - code: "(function(Number) { Number.parseInt(a) }(b))", - options: [{ version: "0.11.9" }], - }, - { - code: "Number.parseInt(a)", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "Number.parseInt(a)", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Number.parseInt", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Object.assign", - valid: [ - { - code: "Object.foo(a)", - options: [{ version: "3.9.9" }], - }, - { - code: "(function(Object) { Object.assign(a) }(b))", - options: [{ version: "3.9.9" }], - }, - { - code: "Object.assign(a)", - options: [{ version: "4.0.0" }], - }, - ], - invalid: [ - { - code: "Object.assign(a)", - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Object.assign", - supported: "4.0.0", - version: "3.9.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Object.getOwnPropertySymbols", - valid: [ - { - code: "Object.foo(a)", - options: [{ version: "0.11.9" }], - }, - { - code: "(function(Object) { Object.getOwnPropertySymbols(a) }(b))", - options: [{ version: "0.11.9" }], - }, - { - code: "Object.getOwnPropertySymbols(a)", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "Object.getOwnPropertySymbols(a)", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Object.getOwnPropertySymbols", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Object.is", - valid: [ - { - code: "Object.foo(a)", - options: [{ version: "0.9.9" }], - }, - { - code: "(function(Object) { Object.is(a) }(b))", - options: [{ version: "0.9.9" }], - }, - { - code: "Object.is(a)", - options: [{ version: "0.10.0" }], - }, - ], - invalid: [ - { - code: "Object.is(a)", - options: [{ version: "0.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Object.is", - supported: "0.10.0", - version: "0.9.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Object.setPrototypeOf", - valid: [ - { - code: "Object.foo(a)", - options: [{ version: "0.11.9" }], - }, - { - code: "(function(Object) { Object.setPrototypeOf(a) }(b))", - options: [{ version: "0.11.9" }], - }, - { - code: "Object.setPrototypeOf(a)", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "Object.setPrototypeOf(a)", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Object.setPrototypeOf", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Promise", - valid: [ - { - code: "(function(Promise) { Promise }(a))", - options: [{ version: "0.11.9" }], - }, - { - code: "Promise", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "Promise", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Promise", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - { - code: "function wrap() { Promise }", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Promise", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Promise.allSettled", - valid: [ - { - code: "(function(Promise) { Promise.allSettled }(a))", - options: [{ version: "12.8.1" }], - }, - { - code: "Promise.allSettled", - options: [{ version: "12.9.0" }], - }, - ], - invalid: [ - { - code: "Promise.allSettled", - options: [{ version: "12.8.1" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Promise.allSettled", - supported: "12.9.0", - version: "12.8.1", - }, - }, - ], - }, - { - code: "function wrap() { Promise.allSettled }", - options: [{ version: "12.8.1" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Promise.allSettled", - supported: "12.9.0", - version: "12.8.1", - }, - }, - ], - }, - ], - }, - { - keyword: "Promise.any", - valid: [ - { - code: "(function(Promise) { Promise.any }(a))", - options: [{ version: "14.0.0" }], - }, - { - code: "Promise.any", - options: [{ version: "15.0.0" }], - }, - ], - invalid: [ - { - code: "Promise.any", - options: [{ version: "14.0.0" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Promise.any", - supported: "15.0.0", - version: "14.0.0", - }, - }, - ], - }, - { - code: "function wrap() { Promise.any }", - options: [{ version: "14.0.0" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Promise.any", - supported: "15.0.0", - version: "14.0.0", - }, - }, - ], - }, - ], - }, - { - keyword: "Proxy", - valid: [ - { - code: "(function(Proxy) { Proxy }(a))", - options: [{ version: "5.9.9" }], - }, - { - code: "Proxy", - options: [{ version: "6.0.0" }], - }, - ], - invalid: [ - { - code: "Proxy", - options: [{ version: "5.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Proxy", - supported: "6.0.0", - version: "5.9.9", - }, - }, - ], - }, - { - code: "function wrap() { Proxy }", - options: [{ version: "5.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Proxy", - supported: "6.0.0", - version: "5.9.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Reflect", - valid: [ - { - code: "(function(Reflect) { Reflect }(a))", - options: [{ version: "5.9.9" }], - }, - { - code: "Reflect", - options: [{ version: "6.0.0" }], - }, - ], - invalid: [ - { - code: "Reflect", - options: [{ version: "5.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Reflect", - supported: "6.0.0", - version: "5.9.9", - }, - }, - ], - }, - { - code: "function wrap() { Reflect }", - options: [{ version: "5.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Reflect", - supported: "6.0.0", - version: "5.9.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Set", - valid: [ - { - code: "(function(Set) { Set }(a))", - options: [{ version: "0.11.9" }], - }, - { - code: "Set", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "Set", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Set", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - { - code: "function wrap() { Set }", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Set", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "String.fromCodePoint", - valid: [ - { - code: "String.foo(a)", - options: [{ version: "3.9.9" }], - }, - { - code: "(function(String) { String.fromCodePoint(a) }(b))", - options: [{ version: "3.9.9" }], - }, - { - code: "String.fromCodePoint(a)", - options: [{ version: "4.0.0" }], - }, - ], - invalid: [ - { - code: "String.fromCodePoint(a)", - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "String.fromCodePoint", - supported: "4.0.0", - version: "3.9.9", - }, - }, - ], - }, - ], - }, - { - keyword: "String.raw", - valid: [ - { - code: "String.foo(a)", - options: [{ version: "3.9.9" }], - }, - { - code: "(function(String) { String.raw(a) }(b))", - options: [{ version: "3.9.9" }], - }, - { - code: "String.raw(a)", - options: [{ version: "4.0.0" }], - }, - ], - invalid: [ - { - code: "String.raw(a)", - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "String.raw", - supported: "4.0.0", - version: "3.9.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Symbol", - valid: [ - { - code: "(function(Symbol) { Symbol }(a))", - options: [{ version: "0.11.9" }], - }, - { - code: "Symbol", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "Symbol", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Symbol", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - { - code: "function wrap() { Symbol }", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Symbol", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Int8Array", - valid: [ - { - code: "(function(Int8Array) { Int8Array }(a))", - options: [{ version: "0.9.9" }], - }, - { - code: "Int8Array", - options: [{ version: "0.10.0" }], - }, - ], - invalid: [ - { - code: "Int8Array", - options: [{ version: "0.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Int8Array", - supported: "0.10.0", - version: "0.9.9", - }, - }, - ], - }, - { - code: "function wrap() { Int8Array }", - options: [{ version: "0.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Int8Array", - supported: "0.10.0", - version: "0.9.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Uint8Array", - valid: [ - { - code: "(function(Uint8Array) { Uint8Array }(a))", - options: [{ version: "0.9.9" }], - }, - { - code: "Uint8Array", - options: [{ version: "0.10.0" }], - }, - ], - invalid: [ - { - code: "Uint8Array", - options: [{ version: "0.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Uint8Array", - supported: "0.10.0", - version: "0.9.9", - }, - }, - ], - }, - { - code: "function wrap() { Uint8Array }", - options: [{ version: "0.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Uint8Array", - supported: "0.10.0", - version: "0.9.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Uint8ClampedArray", - valid: [ - { - code: "(function(Uint8ClampedArray) { Uint8ClampedArray }(a))", - options: [{ version: "0.9.9" }], - }, - { - code: "Uint8ClampedArray", - options: [{ version: "0.10.0" }], - }, - ], - invalid: [ - { - code: "Uint8ClampedArray", - options: [{ version: "0.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Uint8ClampedArray", - supported: "0.10.0", - version: "0.9.9", - }, - }, - ], - }, - { - code: "function wrap() { Uint8ClampedArray }", - options: [{ version: "0.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Uint8ClampedArray", - supported: "0.10.0", - version: "0.9.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Int16Array", - valid: [ - { - code: "(function(Int16Array) { Int16Array }(a))", - options: [{ version: "0.9.9" }], - }, - { - code: "Int16Array", - options: [{ version: "0.10.0" }], - }, - ], - invalid: [ - { - code: "Int16Array", - options: [{ version: "0.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Int16Array", - supported: "0.10.0", - version: "0.9.9", - }, - }, - ], - }, - { - code: "function wrap() { Int16Array }", - options: [{ version: "0.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Int16Array", - supported: "0.10.0", - version: "0.9.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Uint16Array", - valid: [ - { - code: "(function(Uint16Array) { Uint16Array }(a))", - options: [{ version: "0.9.9" }], - }, - { - code: "Uint16Array", - options: [{ version: "0.10.0" }], - }, - ], - invalid: [ - { - code: "Uint16Array", - options: [{ version: "0.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Uint16Array", - supported: "0.10.0", - version: "0.9.9", - }, - }, - ], - }, - { - code: "function wrap() { Uint16Array }", - options: [{ version: "0.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Uint16Array", - supported: "0.10.0", - version: "0.9.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Int32Array", - valid: [ - { - code: "(function(Int32Array) { Int32Array }(a))", - options: [{ version: "0.9.9" }], - }, - { - code: "Int32Array", - options: [{ version: "0.10.0" }], - }, - ], - invalid: [ - { - code: "Int32Array", - options: [{ version: "0.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Int32Array", - supported: "0.10.0", - version: "0.9.9", - }, - }, - ], - }, - { - code: "function wrap() { Int32Array }", - options: [{ version: "0.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Int32Array", - supported: "0.10.0", - version: "0.9.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Uint32Array", - valid: [ - { - code: "(function(Uint32Array) { Uint32Array }(a))", - options: [{ version: "0.9.9" }], - }, - { - code: "Uint32Array", - options: [{ version: "0.10.0" }], - }, - ], - invalid: [ - { - code: "Uint32Array", - options: [{ version: "0.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Uint32Array", - supported: "0.10.0", - version: "0.9.9", - }, - }, - ], - }, - { - code: "function wrap() { Uint32Array }", - options: [{ version: "0.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Uint32Array", - supported: "0.10.0", - version: "0.9.9", - }, - }, - ], - }, - ], - }, - { - keyword: "BigInt64Array", - valid: [ - { - code: "(function(BigInt64Array) { BigInt64Array }(b))", - options: [{ version: "10.3.0" }], - }, - { - code: "BigInt64Array", - options: [{ version: "10.4.0" }], - }, - ], - invalid: [ - { - code: "BigInt64Array", - options: [{ version: "10.3.0" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "BigInt64Array", - supported: "10.4.0", - version: "10.3.0", - }, - }, - ], - }, - { - code: "(function() { BigInt64Array })()", - options: [{ version: "10.3.0" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "BigInt64Array", - supported: "10.4.0", - version: "10.3.0", - }, - }, - ], - }, - ], - }, - { - keyword: "BigUint64Array", - valid: [ - { - code: "(function(BigUint64Array) { BigUint64Array }(b))", - options: [{ version: "10.3.0" }], - }, - { - code: "BigUint64Array", - options: [{ version: "10.4.0" }], - }, - ], - invalid: [ - { - code: "BigUint64Array", - options: [{ version: "10.3.0" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "BigUint64Array", - supported: "10.4.0", - version: "10.3.0", - }, - }, - ], - }, - { - code: "(function() { BigUint64Array })()", - options: [{ version: "10.3.0" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "BigUint64Array", - supported: "10.4.0", - version: "10.3.0", - }, - }, - ], - }, - ], - }, - { - keyword: "Float32Array", - valid: [ - { - code: "(function(Float32Array) { Float32Array }(a))", - options: [{ version: "0.9.9" }], - }, - { - code: "Float32Array", - options: [{ version: "0.10.0" }], - }, - ], - invalid: [ - { - code: "Float32Array", - options: [{ version: "0.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Float32Array", - supported: "0.10.0", - version: "0.9.9", - }, - }, - ], - }, - { - code: "function wrap() { Float32Array }", - options: [{ version: "0.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Float32Array", - supported: "0.10.0", - version: "0.9.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Float64Array", - valid: [ - { - code: "(function(Float64Array) { Float64Array }(a))", - options: [{ version: "0.9.9" }], - }, - { - code: "Float64Array", - options: [{ version: "0.10.0" }], - }, - ], - invalid: [ - { - code: "Float64Array", - options: [{ version: "0.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Float64Array", - supported: "0.10.0", - version: "0.9.9", - }, - }, - ], - }, - { - code: "function wrap() { Float64Array }", - options: [{ version: "0.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Float64Array", - supported: "0.10.0", - version: "0.9.9", - }, - }, - ], - }, - ], - }, - { - keyword: "DataView", - valid: [ - { - code: "(function(DataView) { DataView }(a))", - options: [{ version: "0.9.9" }], - }, - { - code: "DataView", - options: [{ version: "0.10.0" }], - }, - ], - invalid: [ - { - code: "DataView", - options: [{ version: "0.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "DataView", - supported: "0.10.0", - version: "0.9.9", - }, - }, - ], - }, - { - code: "function wrap() { DataView }", - options: [{ version: "0.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "DataView", - supported: "0.10.0", - version: "0.9.9", - }, - }, - ], - }, - ], - }, - { - keyword: "WeakMap", - valid: [ - { - code: "(function(WeakMap) { WeakMap }(a))", - options: [{ version: "0.11.9" }], - }, - { - code: "WeakMap", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "WeakMap", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "WeakMap", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - { - code: "function wrap() { WeakMap }", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "WeakMap", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "WeakRef", - valid: [ - { - code: "(function(WeakRef) { WeakRef }(a))", - options: [{ version: "14.5.0" }], - }, - { - code: "WeakRef", - options: [{ version: "14.6.0" }], - }, - ], - invalid: [ - { - code: "WeakRef", - options: [{ version: "14.5.0" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "WeakRef", - supported: "14.6.0", - version: "14.5.0", - }, - }, - ], - }, - { - code: "function wrap() { WeakRef }", - options: [{ version: "14.5.0" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "WeakRef", - supported: "14.6.0", - version: "14.5.0", - }, - }, - ], - }, - ], - }, - { - keyword: "WeakSet", - valid: [ - { - code: "(function(WeakSet) { WeakSet }(a))", - options: [{ version: "0.11.9" }], - }, - { - code: "WeakSet", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "WeakSet", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "WeakSet", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - { - code: "function wrap() { WeakSet }", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "WeakSet", - supported: "0.12.0", - version: "0.11.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Atomics", - valid: [ - { - code: "(function(Atomics) { Atomics }(a))", - options: [{ version: "8.9.9" }], - }, - { - code: "Atomics", - options: [{ version: "8.10.0" }], - }, - ], - invalid: [ - { - code: "Atomics", - options: [{ version: "8.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Atomics", - supported: "8.10.0", - version: "8.9.9", - }, - }, - ], - }, - { - code: "function wrap() { Atomics }", - options: [{ version: "8.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Atomics", - supported: "8.10.0", - version: "8.9.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Object.values", - valid: [ - { - code: "Object.foo(a)", - options: [{ version: "6.9.9" }], - }, - { - code: "(function(Object) { Object.values(a) }(b))", - options: [{ version: "6.9.9" }], - }, - { - code: "Object.values(a)", - options: [{ version: "7.0.0" }], - }, - ], - invalid: [ - { - code: "Object.values(a)", - options: [{ version: "6.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Object.values", - supported: "7.0.0", - version: "6.9.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Object.entries", - valid: [ - { - code: "Object.foo(a)", - options: [{ version: "6.9.9" }], - }, - { - code: "(function(Object) { Object.entries(a) }(b))", - options: [{ version: "6.9.9" }], - }, - { - code: "Object.entries(a)", - options: [{ version: "7.0.0" }], - }, - ], - invalid: [ - { - code: "Object.entries(a)", - options: [{ version: "6.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Object.entries", - supported: "7.0.0", - version: "6.9.9", - }, - }, - ], - }, - ], - }, - { - keyword: "Object.getOwnPropertyDescriptors", - valid: [ - { - code: "Object.foo(a)", - options: [{ version: "6.9.9" }], - }, - { - code: "(function(Object) { Object.getOwnPropertyDescriptors(a) }(b))", - options: [{ version: "6.9.9" }], - }, - { - code: "Object.getOwnPropertyDescriptors(a)", - options: [{ version: "7.0.0" }], - }, - ], - invalid: [ - { - code: "Object.getOwnPropertyDescriptors(a)", - options: [{ version: "6.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "Object.getOwnPropertyDescriptors", - supported: "7.0.0", - version: "6.9.9", - }, - }, - ], - }, - ], - }, - { - keyword: "SharedArrayBuffer", - valid: [ - { - code: "(function(SharedArrayBuffer) { SharedArrayBuffer }(a))", - options: [{ version: "8.9.9" }], - }, - { - code: "SharedArrayBuffer", - options: [{ version: "8.10.0" }], - }, - ], - invalid: [ - { - code: "SharedArrayBuffer", - options: [{ version: "8.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "SharedArrayBuffer", - supported: "8.10.0", - version: "8.9.9", - }, - }, - ], - }, - { - code: "function wrap() { SharedArrayBuffer }", - options: [{ version: "8.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "SharedArrayBuffer", - supported: "8.10.0", - version: "8.9.9", - }, - }, - ], - }, - ], - }, - { - keyword: "globalThis", - valid: [ - { - code: "(function(globalThis) { globalThis }(a))", - options: [{ version: "12.0.0" }], - }, - { - code: "globalThis", - options: [{ version: "12.0.0" }], - }, - { - code: "globalThis", - settings: { - node: { version: "12.0.0" }, +runTests([ + { + keyword: "AggregateError", + valid: [ + { + code: "if (error instanceof AggregateError) {}", + options: [{ version: "15.0.0" }], + }, + ], + invalid: [ + { + code: "if (error instanceof AggregateError) {}", + options: [{ version: "14.0.0" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "AggregateError", + supported: "15.0.0", + version: "14.0.0", + }, }, - }, - ], - invalid: [ - { - code: "globalThis", - options: [{ version: "11.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "globalThis", - supported: "12.0.0", - version: "11.9.9", - }, - }, - ], - }, - { - code: "function wrap() { globalThis }", - options: [{ version: "11.9.9" }], - errors: [ - { - messageId: "unsupported", - data: { - name: "globalThis", - supported: "12.0.0", - version: "11.9.9", - }, - }, - ], - }, - { - code: "function wrap() { globalThis }", - settings: { - node: { version: "11.9.9" }, - }, - errors: [ - { - messageId: "unsupported", - data: { - name: "globalThis", - supported: "12.0.0", - version: "11.9.9", - }, - }, - ], - }, - ], - }, - ]) -) + ], + }, + ], + }, + { + keyword: "Array.from", + valid: [ + { + code: "Array.foo(a)", + options: [{ version: "3.9.9" }], + }, + { + code: "(function(Array) { Array.from(a) }(b))", + options: [{ version: "3.9.9" }], + }, + { + code: "Array.from(a)", + options: [{ version: "4.0.0" }], + }, + ], + invalid: [ + { + code: "Array.from(a)", + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Array.from", + supported: "4.0.0", + version: "3.9.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Array.of", + valid: [ + { + code: "Array.foo(a)", + options: [{ version: "3.9.9" }], + }, + { + code: "(function(Array) { Array.of(a) }(b))", + options: [{ version: "3.9.9" }], + }, + { + code: "Array.of(a)", + options: [{ version: "4.0.0" }], + }, + ], + invalid: [ + { + code: "Array.of(a)", + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Array.of", + supported: "4.0.0", + version: "3.9.9", + }, + }, + ], + }, + ], + }, + { + keyword: "BigInt", + valid: [ + { + code: "bigint", + options: [{ version: "10.3.0" }], + }, + { + code: "(function(BigInt) { BigInt }(b))", + options: [{ version: "10.3.0" }], + }, + { + code: "BigInt", + options: [{ version: "10.4.0" }], + }, + ], + invalid: [ + { + code: "BigInt", + options: [{ version: "10.3.0" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "BigInt", + supported: "10.4.0", + version: "10.3.0", + }, + }, + ], + }, + { + code: "(function() { BigInt })()", + options: [{ version: "10.3.0" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "BigInt", + supported: "10.4.0", + version: "10.3.0", + }, + }, + ], + }, + ], + }, + { + keyword: "FinalizationRegistry", + valid: [ + { + code: "new FinalizationRegistry(() => {})", + options: [{ version: "14.6.0" }], + }, + ], + invalid: [ + { + code: "new FinalizationRegistry(() => {})", + options: [{ version: "14.5.0" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "FinalizationRegistry", + supported: "14.6.0", + version: "14.5.0", + }, + }, + ], + }, + ], + }, + { + keyword: "Map", + valid: [ + { + code: "map", + options: [{ version: "0.11.9" }], + }, + { + code: "(function(Map) { Map }(b))", + options: [{ version: "0.11.9" }], + }, + { + code: "Map", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "Map", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Map", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + { + code: "(function() { Map })()", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Map", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Math.acosh", + valid: [ + { + code: "Math.foo(a)", + options: [{ version: "0.11.9" }], + }, + { + code: "(function(Math) { Math.acosh(a) }(b))", + options: [{ version: "0.11.9" }], + }, + { + code: "Math.acosh(a)", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "Math.acosh(a)", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Math.acosh", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Math.asinh", + valid: [ + { + code: "Math.foo(a)", + options: [{ version: "0.11.9" }], + }, + { + code: "(function(Math) { Math.asinh(a) }(b))", + options: [{ version: "0.11.9" }], + }, + { + code: "Math.asinh(a)", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "Math.asinh(a)", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Math.asinh", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Math.atanh", + valid: [ + { + code: "Math.foo(a)", + options: [{ version: "0.11.9" }], + }, + { + code: "(function(Math) { Math.atanh(a) }(b))", + options: [{ version: "0.11.9" }], + }, + { + code: "Math.atanh(a)", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "Math.atanh(a)", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Math.atanh", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Math.cbrt", + valid: [ + { + code: "Math.foo(a)", + options: [{ version: "0.11.9" }], + }, + { + code: "(function(Math) { Math.cbrt(a) }(b))", + options: [{ version: "0.11.9" }], + }, + { + code: "Math.cbrt(a)", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "Math.cbrt(a)", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Math.cbrt", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Math.clz32", + valid: [ + { + code: "Math.foo(a)", + options: [{ version: "0.11.9" }], + }, + { + code: "(function(Math) { Math.clz32(a) }(b))", + options: [{ version: "0.11.9" }], + }, + { + code: "Math.clz32(a)", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "Math.clz32(a)", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Math.clz32", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Math.cosh", + valid: [ + { + code: "Math.foo(a)", + options: [{ version: "0.11.9" }], + }, + { + code: "(function(Math) { Math.cosh(a) }(b))", + options: [{ version: "0.11.9" }], + }, + { + code: "Math.cosh(a)", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "Math.cosh(a)", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Math.cosh", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Math.expm1", + valid: [ + { + code: "Math.foo(a)", + options: [{ version: "0.11.9" }], + }, + { + code: "(function(Math) { Math.expm1(a) }(b))", + options: [{ version: "0.11.9" }], + }, + { + code: "Math.expm1(a)", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "Math.expm1(a)", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Math.expm1", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Math.fround", + valid: [ + { + code: "Math.foo(a)", + options: [{ version: "0.11.9" }], + }, + { + code: "(function(Math) { Math.fround(a) }(b))", + options: [{ version: "0.11.9" }], + }, + { + code: "Math.fround(a)", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "Math.fround(a)", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Math.fround", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Math.hypot", + valid: [ + { + code: "Math.foo(a)", + options: [{ version: "0.11.9" }], + }, + { + code: "(function(Math) { Math.hypot(a) }(b))", + options: [{ version: "0.11.9" }], + }, + { + code: "Math.hypot(a)", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "Math.hypot(a)", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Math.hypot", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Math.imul", + valid: [ + { + code: "Math.foo(a)", + options: [{ version: "0.11.9" }], + }, + { + code: "(function(Math) { Math.imul(a) }(b))", + options: [{ version: "0.11.9" }], + }, + { + code: "Math.imul(a)", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "Math.imul(a)", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Math.imul", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Math.log10", + valid: [ + { + code: "Math.foo(a)", + options: [{ version: "0.11.9" }], + }, + { + code: "(function(Math) { Math.log10(a) }(b))", + options: [{ version: "0.11.9" }], + }, + { + code: "Math.log10(a)", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "Math.log10(a)", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Math.log10", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Math.log1p", + valid: [ + { + code: "Math.foo(a)", + options: [{ version: "0.11.9" }], + }, + { + code: "(function(Math) { Math.log1p(a) }(b))", + options: [{ version: "0.11.9" }], + }, + { + code: "Math.log1p(a)", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "Math.log1p(a)", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Math.log1p", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Math.log2", + valid: [ + { + code: "Math.foo(a)", + options: [{ version: "0.11.9" }], + }, + { + code: "(function(Math) { Math.log2(a) }(b))", + options: [{ version: "0.11.9" }], + }, + { + code: "Math.log2(a)", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "Math.log2(a)", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Math.log2", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Math.sign", + valid: [ + { + code: "Math.foo(a)", + options: [{ version: "0.11.9" }], + }, + { + code: "(function(Math) { Math.sign(a) }(b))", + options: [{ version: "0.11.9" }], + }, + { + code: "Math.sign(a)", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "Math.sign(a)", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Math.sign", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Math.sinh", + valid: [ + { + code: "Math.foo(a)", + options: [{ version: "0.11.9" }], + }, + { + code: "(function(Math) { Math.sinh(a) }(b))", + options: [{ version: "0.11.9" }], + }, + { + code: "Math.sinh(a)", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "Math.sinh(a)", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Math.sinh", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Math.tanh", + valid: [ + { + code: "Math.foo(a)", + options: [{ version: "0.11.9" }], + }, + { + code: "(function(Math) { Math.tanh(a) }(b))", + options: [{ version: "0.11.9" }], + }, + { + code: "Math.tanh(a)", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "Math.tanh(a)", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Math.tanh", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Math.trunc", + valid: [ + { + code: "Math.foo(a)", + options: [{ version: "0.11.9" }], + }, + { + code: "(function(Math) { Math.trunc(a) }(b))", + options: [{ version: "0.11.9" }], + }, + { + code: "Math.trunc(a)", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "Math.trunc(a)", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Math.trunc", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Number.isFinite", + valid: [ + { + code: "Number.foo(a)", + options: [{ version: "0.9.9" }], + }, + { + code: "(function(Number) { Number.isFinite(a) }(b))", + options: [{ version: "0.9.9" }], + }, + { + code: "Number.isFinite(a)", + options: [{ version: "0.10.0" }], + }, + ], + invalid: [ + { + code: "Number.isFinite(a)", + options: [{ version: "0.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Number.isFinite", + supported: "0.10.0", + version: "0.9.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Number.isInteger", + valid: [ + { + code: "Number.foo(a)", + options: [{ version: "0.11.9" }], + }, + { + code: "(function(Number) { Number.isInteger(a) }(b))", + options: [{ version: "0.11.9" }], + }, + { + code: "Number.isInteger(a)", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "Number.isInteger(a)", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Number.isInteger", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Number.isNaN", + valid: [ + { + code: "Number.foo(a)", + options: [{ version: "0.9.9" }], + }, + { + code: "(function(Number) { Number.isNaN(a) }(b))", + options: [{ version: "0.9.9" }], + }, + { + code: "Number.isNaN(a)", + options: [{ version: "0.10.0" }], + }, + ], + invalid: [ + { + code: "Number.isNaN(a)", + options: [{ version: "0.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Number.isNaN", + supported: "0.10.0", + version: "0.9.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Number.isSafeInteger", + valid: [ + { + code: "Number.foo(a)", + options: [{ version: "0.11.9" }], + }, + { + code: "(function(Number) { Number.isSafeInteger(a) }(b))", + options: [{ version: "0.11.9" }], + }, + { + code: "Number.isSafeInteger(a)", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "Number.isSafeInteger(a)", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Number.isSafeInteger", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Number.parseFloat", + valid: [ + { + code: "Number.foo(a)", + options: [{ version: "0.11.9" }], + }, + { + code: "(function(Number) { Number.parseFloat(a) }(b))", + options: [{ version: "0.11.9" }], + }, + { + code: "Number.parseFloat(a)", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "Number.parseFloat(a)", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Number.parseFloat", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Number.parseInt", + valid: [ + { + code: "Number.foo(a)", + options: [{ version: "0.11.9" }], + }, + { + code: "(function(Number) { Number.parseInt(a) }(b))", + options: [{ version: "0.11.9" }], + }, + { + code: "Number.parseInt(a)", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "Number.parseInt(a)", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Number.parseInt", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Object.assign", + valid: [ + { + code: "Object.foo(a)", + options: [{ version: "3.9.9" }], + }, + { + code: "(function(Object) { Object.assign(a) }(b))", + options: [{ version: "3.9.9" }], + }, + { + code: "Object.assign(a)", + options: [{ version: "4.0.0" }], + }, + ], + invalid: [ + { + code: "Object.assign(a)", + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Object.assign", + supported: "4.0.0", + version: "3.9.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Object.getOwnPropertySymbols", + valid: [ + { + code: "Object.foo(a)", + options: [{ version: "0.11.9" }], + }, + { + code: "(function(Object) { Object.getOwnPropertySymbols(a) }(b))", + options: [{ version: "0.11.9" }], + }, + { + code: "Object.getOwnPropertySymbols(a)", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "Object.getOwnPropertySymbols(a)", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Object.getOwnPropertySymbols", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Object.is", + valid: [ + { + code: "Object.foo(a)", + options: [{ version: "0.9.9" }], + }, + { + code: "(function(Object) { Object.is(a) }(b))", + options: [{ version: "0.9.9" }], + }, + { + code: "Object.is(a)", + options: [{ version: "0.10.0" }], + }, + ], + invalid: [ + { + code: "Object.is(a)", + options: [{ version: "0.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Object.is", + supported: "0.10.0", + version: "0.9.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Object.setPrototypeOf", + valid: [ + { + code: "Object.foo(a)", + options: [{ version: "0.11.9" }], + }, + { + code: "(function(Object) { Object.setPrototypeOf(a) }(b))", + options: [{ version: "0.11.9" }], + }, + { + code: "Object.setPrototypeOf(a)", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "Object.setPrototypeOf(a)", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Object.setPrototypeOf", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Promise", + valid: [ + { + code: "(function(Promise) { Promise }(a))", + options: [{ version: "0.11.9" }], + }, + { + code: "Promise", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "Promise", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Promise", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + { + code: "function wrap() { Promise }", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Promise", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Promise.allSettled", + valid: [ + { + code: "(function(Promise) { Promise.allSettled }(a))", + options: [{ version: "12.8.1" }], + }, + { + code: "Promise.allSettled", + options: [{ version: "12.9.0" }], + }, + ], + invalid: [ + { + code: "Promise.allSettled", + options: [{ version: "12.8.1" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Promise.allSettled", + supported: "12.9.0", + version: "12.8.1", + }, + }, + ], + }, + { + code: "function wrap() { Promise.allSettled }", + options: [{ version: "12.8.1" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Promise.allSettled", + supported: "12.9.0", + version: "12.8.1", + }, + }, + ], + }, + ], + }, + { + keyword: "Promise.any", + valid: [ + { + code: "(function(Promise) { Promise.any }(a))", + options: [{ version: "14.0.0" }], + }, + { + code: "Promise.any", + options: [{ version: "15.0.0" }], + }, + ], + invalid: [ + { + code: "Promise.any", + options: [{ version: "14.0.0" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Promise.any", + supported: "15.0.0", + version: "14.0.0", + }, + }, + ], + }, + { + code: "function wrap() { Promise.any }", + options: [{ version: "14.0.0" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Promise.any", + supported: "15.0.0", + version: "14.0.0", + }, + }, + ], + }, + ], + }, + { + keyword: "Proxy", + valid: [ + { + code: "(function(Proxy) { Proxy }(a))", + options: [{ version: "5.9.9" }], + }, + { + code: "Proxy", + options: [{ version: "6.0.0" }], + }, + ], + invalid: [ + { + code: "Proxy", + options: [{ version: "5.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Proxy", + supported: "6.0.0", + version: "5.9.9", + }, + }, + ], + }, + { + code: "function wrap() { Proxy }", + options: [{ version: "5.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Proxy", + supported: "6.0.0", + version: "5.9.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Reflect", + valid: [ + { + code: "(function(Reflect) { Reflect }(a))", + options: [{ version: "5.9.9" }], + }, + { + code: "Reflect", + options: [{ version: "6.0.0" }], + }, + ], + invalid: [ + { + code: "Reflect", + options: [{ version: "5.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Reflect", + supported: "6.0.0", + version: "5.9.9", + }, + }, + ], + }, + { + code: "function wrap() { Reflect }", + options: [{ version: "5.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Reflect", + supported: "6.0.0", + version: "5.9.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Set", + valid: [ + { + code: "(function(Set) { Set }(a))", + options: [{ version: "0.11.9" }], + }, + { + code: "Set", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "Set", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Set", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + { + code: "function wrap() { Set }", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Set", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "String.fromCodePoint", + valid: [ + { + code: "String.foo(a)", + options: [{ version: "3.9.9" }], + }, + { + code: "(function(String) { String.fromCodePoint(a) }(b))", + options: [{ version: "3.9.9" }], + }, + { + code: "String.fromCodePoint(a)", + options: [{ version: "4.0.0" }], + }, + ], + invalid: [ + { + code: "String.fromCodePoint(a)", + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "String.fromCodePoint", + supported: "4.0.0", + version: "3.9.9", + }, + }, + ], + }, + ], + }, + { + keyword: "String.raw", + valid: [ + { + code: "String.foo(a)", + options: [{ version: "3.9.9" }], + }, + { + code: "(function(String) { String.raw(a) }(b))", + options: [{ version: "3.9.9" }], + }, + { + code: "String.raw(a)", + options: [{ version: "4.0.0" }], + }, + ], + invalid: [ + { + code: "String.raw(a)", + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "String.raw", + supported: "4.0.0", + version: "3.9.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Symbol", + valid: [ + { + code: "(function(Symbol) { Symbol }(a))", + options: [{ version: "0.11.9" }], + }, + { + code: "Symbol", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "Symbol", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Symbol", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + { + code: "function wrap() { Symbol }", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Symbol", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Int8Array", + valid: [ + { + code: "(function(Int8Array) { Int8Array }(a))", + options: [{ version: "0.9.9" }], + }, + { + code: "Int8Array", + options: [{ version: "0.10.0" }], + }, + ], + invalid: [ + { + code: "Int8Array", + options: [{ version: "0.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Int8Array", + supported: "0.10.0", + version: "0.9.9", + }, + }, + ], + }, + { + code: "function wrap() { Int8Array }", + options: [{ version: "0.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Int8Array", + supported: "0.10.0", + version: "0.9.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Uint8Array", + valid: [ + { + code: "(function(Uint8Array) { Uint8Array }(a))", + options: [{ version: "0.9.9" }], + }, + { + code: "Uint8Array", + options: [{ version: "0.10.0" }], + }, + ], + invalid: [ + { + code: "Uint8Array", + options: [{ version: "0.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Uint8Array", + supported: "0.10.0", + version: "0.9.9", + }, + }, + ], + }, + { + code: "function wrap() { Uint8Array }", + options: [{ version: "0.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Uint8Array", + supported: "0.10.0", + version: "0.9.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Uint8ClampedArray", + valid: [ + { + code: "(function(Uint8ClampedArray) { Uint8ClampedArray }(a))", + options: [{ version: "0.9.9" }], + }, + { + code: "Uint8ClampedArray", + options: [{ version: "0.10.0" }], + }, + ], + invalid: [ + { + code: "Uint8ClampedArray", + options: [{ version: "0.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Uint8ClampedArray", + supported: "0.10.0", + version: "0.9.9", + }, + }, + ], + }, + { + code: "function wrap() { Uint8ClampedArray }", + options: [{ version: "0.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Uint8ClampedArray", + supported: "0.10.0", + version: "0.9.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Int16Array", + valid: [ + { + code: "(function(Int16Array) { Int16Array }(a))", + options: [{ version: "0.9.9" }], + }, + { + code: "Int16Array", + options: [{ version: "0.10.0" }], + }, + ], + invalid: [ + { + code: "Int16Array", + options: [{ version: "0.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Int16Array", + supported: "0.10.0", + version: "0.9.9", + }, + }, + ], + }, + { + code: "function wrap() { Int16Array }", + options: [{ version: "0.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Int16Array", + supported: "0.10.0", + version: "0.9.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Uint16Array", + valid: [ + { + code: "(function(Uint16Array) { Uint16Array }(a))", + options: [{ version: "0.9.9" }], + }, + { + code: "Uint16Array", + options: [{ version: "0.10.0" }], + }, + ], + invalid: [ + { + code: "Uint16Array", + options: [{ version: "0.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Uint16Array", + supported: "0.10.0", + version: "0.9.9", + }, + }, + ], + }, + { + code: "function wrap() { Uint16Array }", + options: [{ version: "0.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Uint16Array", + supported: "0.10.0", + version: "0.9.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Int32Array", + valid: [ + { + code: "(function(Int32Array) { Int32Array }(a))", + options: [{ version: "0.9.9" }], + }, + { + code: "Int32Array", + options: [{ version: "0.10.0" }], + }, + ], + invalid: [ + { + code: "Int32Array", + options: [{ version: "0.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Int32Array", + supported: "0.10.0", + version: "0.9.9", + }, + }, + ], + }, + { + code: "function wrap() { Int32Array }", + options: [{ version: "0.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Int32Array", + supported: "0.10.0", + version: "0.9.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Uint32Array", + valid: [ + { + code: "(function(Uint32Array) { Uint32Array }(a))", + options: [{ version: "0.9.9" }], + }, + { + code: "Uint32Array", + options: [{ version: "0.10.0" }], + }, + ], + invalid: [ + { + code: "Uint32Array", + options: [{ version: "0.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Uint32Array", + supported: "0.10.0", + version: "0.9.9", + }, + }, + ], + }, + { + code: "function wrap() { Uint32Array }", + options: [{ version: "0.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Uint32Array", + supported: "0.10.0", + version: "0.9.9", + }, + }, + ], + }, + ], + }, + { + keyword: "BigInt64Array", + valid: [ + { + code: "(function(BigInt64Array) { BigInt64Array }(b))", + options: [{ version: "10.3.0" }], + }, + { + code: "BigInt64Array", + options: [{ version: "10.4.0" }], + }, + ], + invalid: [ + { + code: "BigInt64Array", + options: [{ version: "10.3.0" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "BigInt64Array", + supported: "10.4.0", + version: "10.3.0", + }, + }, + ], + }, + { + code: "(function() { BigInt64Array })()", + options: [{ version: "10.3.0" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "BigInt64Array", + supported: "10.4.0", + version: "10.3.0", + }, + }, + ], + }, + ], + }, + { + keyword: "BigUint64Array", + valid: [ + { + code: "(function(BigUint64Array) { BigUint64Array }(b))", + options: [{ version: "10.3.0" }], + }, + { + code: "BigUint64Array", + options: [{ version: "10.4.0" }], + }, + ], + invalid: [ + { + code: "BigUint64Array", + options: [{ version: "10.3.0" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "BigUint64Array", + supported: "10.4.0", + version: "10.3.0", + }, + }, + ], + }, + { + code: "(function() { BigUint64Array })()", + options: [{ version: "10.3.0" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "BigUint64Array", + supported: "10.4.0", + version: "10.3.0", + }, + }, + ], + }, + ], + }, + { + keyword: "Float32Array", + valid: [ + { + code: "(function(Float32Array) { Float32Array }(a))", + options: [{ version: "0.9.9" }], + }, + { + code: "Float32Array", + options: [{ version: "0.10.0" }], + }, + ], + invalid: [ + { + code: "Float32Array", + options: [{ version: "0.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Float32Array", + supported: "0.10.0", + version: "0.9.9", + }, + }, + ], + }, + { + code: "function wrap() { Float32Array }", + options: [{ version: "0.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Float32Array", + supported: "0.10.0", + version: "0.9.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Float64Array", + valid: [ + { + code: "(function(Float64Array) { Float64Array }(a))", + options: [{ version: "0.9.9" }], + }, + { + code: "Float64Array", + options: [{ version: "0.10.0" }], + }, + ], + invalid: [ + { + code: "Float64Array", + options: [{ version: "0.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Float64Array", + supported: "0.10.0", + version: "0.9.9", + }, + }, + ], + }, + { + code: "function wrap() { Float64Array }", + options: [{ version: "0.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Float64Array", + supported: "0.10.0", + version: "0.9.9", + }, + }, + ], + }, + ], + }, + { + keyword: "DataView", + valid: [ + { + code: "(function(DataView) { DataView }(a))", + options: [{ version: "0.9.9" }], + }, + { + code: "DataView", + options: [{ version: "0.10.0" }], + }, + ], + invalid: [ + { + code: "DataView", + options: [{ version: "0.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "DataView", + supported: "0.10.0", + version: "0.9.9", + }, + }, + ], + }, + { + code: "function wrap() { DataView }", + options: [{ version: "0.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "DataView", + supported: "0.10.0", + version: "0.9.9", + }, + }, + ], + }, + ], + }, + { + keyword: "WeakMap", + valid: [ + { + code: "(function(WeakMap) { WeakMap }(a))", + options: [{ version: "0.11.9" }], + }, + { + code: "WeakMap", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "WeakMap", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "WeakMap", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + { + code: "function wrap() { WeakMap }", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "WeakMap", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "WeakRef", + valid: [ + { + code: "(function(WeakRef) { WeakRef }(a))", + options: [{ version: "14.5.0" }], + }, + { + code: "WeakRef", + options: [{ version: "14.6.0" }], + }, + ], + invalid: [ + { + code: "WeakRef", + options: [{ version: "14.5.0" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "WeakRef", + supported: "14.6.0", + version: "14.5.0", + }, + }, + ], + }, + { + code: "function wrap() { WeakRef }", + options: [{ version: "14.5.0" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "WeakRef", + supported: "14.6.0", + version: "14.5.0", + }, + }, + ], + }, + ], + }, + { + keyword: "WeakSet", + valid: [ + { + code: "(function(WeakSet) { WeakSet }(a))", + options: [{ version: "0.11.9" }], + }, + { + code: "WeakSet", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "WeakSet", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "WeakSet", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + { + code: "function wrap() { WeakSet }", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "WeakSet", + supported: "0.12.0", + version: "0.11.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Atomics", + valid: [ + { + code: "(function(Atomics) { Atomics }(a))", + options: [{ version: "8.9.9" }], + }, + { + code: "Atomics", + options: [{ version: "8.10.0" }], + }, + ], + invalid: [ + { + code: "Atomics", + options: [{ version: "8.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Atomics", + supported: "8.10.0", + version: "8.9.9", + }, + }, + ], + }, + { + code: "function wrap() { Atomics }", + options: [{ version: "8.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Atomics", + supported: "8.10.0", + version: "8.9.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Object.values", + valid: [ + { + code: "Object.foo(a)", + options: [{ version: "6.9.9" }], + }, + { + code: "(function(Object) { Object.values(a) }(b))", + options: [{ version: "6.9.9" }], + }, + { + code: "Object.values(a)", + options: [{ version: "7.0.0" }], + }, + ], + invalid: [ + { + code: "Object.values(a)", + options: [{ version: "6.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Object.values", + supported: "7.0.0", + version: "6.9.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Object.entries", + valid: [ + { + code: "Object.foo(a)", + options: [{ version: "6.9.9" }], + }, + { + code: "(function(Object) { Object.entries(a) }(b))", + options: [{ version: "6.9.9" }], + }, + { + code: "Object.entries(a)", + options: [{ version: "7.0.0" }], + }, + ], + invalid: [ + { + code: "Object.entries(a)", + options: [{ version: "6.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Object.entries", + supported: "7.0.0", + version: "6.9.9", + }, + }, + ], + }, + ], + }, + { + keyword: "Object.getOwnPropertyDescriptors", + valid: [ + { + code: "Object.foo(a)", + options: [{ version: "6.9.9" }], + }, + { + code: "(function(Object) { Object.getOwnPropertyDescriptors(a) }(b))", + options: [{ version: "6.9.9" }], + }, + { + code: "Object.getOwnPropertyDescriptors(a)", + options: [{ version: "7.0.0" }], + }, + ], + invalid: [ + { + code: "Object.getOwnPropertyDescriptors(a)", + options: [{ version: "6.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "Object.getOwnPropertyDescriptors", + supported: "7.0.0", + version: "6.9.9", + }, + }, + ], + }, + ], + }, + { + keyword: "SharedArrayBuffer", + valid: [ + { + code: "(function(SharedArrayBuffer) { SharedArrayBuffer }(a))", + options: [{ version: "8.9.9" }], + }, + { + code: "SharedArrayBuffer", + options: [{ version: "8.10.0" }], + }, + ], + invalid: [ + { + code: "SharedArrayBuffer", + options: [{ version: "8.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "SharedArrayBuffer", + supported: "8.10.0", + version: "8.9.9", + }, + }, + ], + }, + { + code: "function wrap() { SharedArrayBuffer }", + options: [{ version: "8.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "SharedArrayBuffer", + supported: "8.10.0", + version: "8.9.9", + }, + }, + ], + }, + ], + }, + { + keyword: "globalThis", + valid: [ + { + code: "(function(globalThis) { globalThis }(a))", + options: [{ version: "12.0.0" }], + }, + { + code: "globalThis", + options: [{ version: "12.0.0" }], + }, + { + code: "globalThis", + settings: { + node: { version: "12.0.0" }, + }, + }, + ], + invalid: [ + { + code: "globalThis", + options: [{ version: "11.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "globalThis", + supported: "12.0.0", + version: "11.9.9", + }, + }, + ], + }, + { + code: "function wrap() { globalThis }", + options: [{ version: "11.9.9" }], + errors: [ + { + messageId: "unsupported", + data: { + name: "globalThis", + supported: "12.0.0", + version: "11.9.9", + }, + }, + ], + }, + { + code: "function wrap() { globalThis }", + settings: { + node: { version: "11.9.9" }, + }, + errors: [ + { + messageId: "unsupported", + data: { + name: "globalThis", + supported: "12.0.0", + version: "11.9.9", + }, + }, + ], + }, + ], + }, +]) diff --git a/tests/lib/rules/no-unsupported-features/es-syntax.js b/tests/lib/rules/no-unsupported-features/es-syntax.js index 17287978..d3042e95 100644 --- a/tests/lib/rules/no-unsupported-features/es-syntax.js +++ b/tests/lib/rules/no-unsupported-features/es-syntax.js @@ -5,25 +5,10 @@ "use strict" const path = require("path") -const { Linter } = require("eslint") const RuleTester = require("#eslint-rule-tester").RuleTester const { Range } = require("semver") const rule = require("../../../../lib/rules/no-unsupported-features/es-syntax") -const ES2021Supported = (() => { - const config = { languageOptions: { ecmaVersion: 2021 } } - const messages = new Linter().verify("0n", config) - return messages.length === 0 -})() -const ES2020Supported = - ES2021Supported || - (() => { - const config = { languageOptions: { ecmaVersion: 2020 } } - const messages = new Linter().verify("0n", config) - return messages.length === 0 - })() -const ecmaVersion = ES2021Supported ? 2021 : ES2020Supported ? 2020 : 2019 - /** * Makes a file path to a fixture. * @param {string} name - A name. @@ -71,2762 +56,2731 @@ function ignores(keyword) { } } -/** - * Concatenate patterns. - * @param {Array<{valid:Array,invalid:Array}>} patterns The patterns to concat. - * @returns {{valid:Array,invalid:Array}} The concatenated patterns. - */ -function concat(patterns) { - const ret = { - valid: [], - invalid: [], - } +function runTests(patterns) { + for (const pattern of patterns) { + const ruleTester = new RuleTester({ + languageOptions: { ecmaVersion: "latest", env: { node: false } }, + }) - for (const { requiredEcmaVersion, keyword, valid, invalid } of patterns) { - if (requiredEcmaVersion && ecmaVersion < requiredEcmaVersion) { - continue + const tests = { + valid: pattern.valid, + invalid: pattern.invalid, } - ret.valid.push(...valid) - ret.invalid.push(...invalid) - // Add the invalid patterns with `ignores` option into the valid patterns. - if (keyword) { - ret.valid.push(...invalid.map(ignores(keyword))) + if (pattern.keyword) { + tests.valid.push(...pattern.invalid.map(ignores(pattern.keyword))) } - } - return ret + ruleTester.run("no-unsupported-features/es-builtins", rule, tests) + } } -const ruleTester = new RuleTester({ - languageOptions: { ecmaVersion, env: { node: false } }, -}) -ruleTester.run( - "no-unsupported-features/es-syntax", - rule, - concat([ - //---------------------------------------------------------------------- - // ES2015 - //---------------------------------------------------------------------- - { - keyword: "arrowFunctions", - valid: [ - { - code: "function f() {}", - options: [{ version: "3.9.9" }], - }, - { - code: "!function f() {}", - options: [{ version: "3.9.9" }], - }, - { - code: "(() => 1)", - options: [{ version: "4.0.0" }], - }, - { - code: "(() => {})", - options: [{ version: "4.0.0" }], - }, - ], - invalid: [ - { - code: "(() => 1)", - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "no-arrow-functions", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - { - code: "(() => {})", - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "no-arrow-functions", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - ], - }, - { - keyword: "binaryNumericLiterals", - valid: [ - { - code: "0x01", - options: [{ version: "3.9.9" }], - }, - { - code: "1", - options: [{ version: "3.9.9" }], - }, - { - code: "0b01", - options: [{ version: "4.0.0" }], - }, - ], - invalid: [ - { - code: "0b01", - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "no-binary-numeric-literals", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - ], - }, - { - keyword: "blockScopedFunctions", - valid: [ - { - code: "'use strict'; if (a) { function f() {} }", - options: [{ version: "4.0.0" }], - }, - { - code: "'use strict'; function wrap() { if (a) { function f() {} } }", - options: [{ version: "4.0.0" }], - }, - { - code: "function wrap() { 'use strict'; if (a) { function f() {} } }", - options: [{ version: "4.0.0" }], - }, - { - code: "if (a) { function f() {} }", - options: [{ version: "6.0.0" }], - }, - ], - invalid: [ - { - code: "'use strict'; if (a) { function f() {} }", - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "no-block-scoped-functions-strict", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - { - code: "if (a) { function f() {} }", - options: [{ version: "5.9.9" }], - errors: [ - { - messageId: "no-block-scoped-functions-sloppy", - data: { supported: "6.0.0", version: "5.9.9" }, - }, - ], - }, - ], - }, - { - keyword: "blockScopedVariables", - valid: [ - { - code: "var a = 0", - options: [{ version: "3.9.9" }], - }, - { - code: "'use strict'; let a = 0", - options: [{ version: "4.0.0" }], - }, - { - code: "'use strict'; const a = 0", - options: [{ version: "4.0.0" }], - }, - { - code: "'use strict'; function wrap() { const a = 0 }", - options: [{ version: "4.0.0" }], - }, - { - code: "function wrap() { 'use strict'; const a = 0 }", - options: [{ version: "4.0.0" }], - }, - { - code: "let a = 0", - options: [{ version: "6.0.0" }], - }, - { - code: "const a = 0", - options: [{ version: "6.0.0" }], - }, - ], - invalid: [ - { - code: "'use strict'; let a = 0", - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "no-block-scoped-variables-strict", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - { - code: "'use strict'; const a = 0", - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "no-block-scoped-variables-strict", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - { - code: "let a = 0", - options: [{ version: "5.9.9" }], - errors: [ - { - messageId: "no-block-scoped-variables-sloppy", - data: { supported: "6.0.0", version: "5.9.9" }, - }, - ], - }, - { - code: "const a = 0", - options: [{ version: "5.9.9" }], - errors: [ - { - messageId: "no-block-scoped-variables-sloppy", - data: { supported: "6.0.0", version: "5.9.9" }, - }, - ], - }, - ], - }, - { - keyword: "classes", - valid: [ - { - code: "'use strict'; class A {}", - options: [{ version: "4.0.0" }], - }, - { - code: "'use strict'; function wrap() { class A {} }", - options: [{ version: "4.0.0" }], - }, - { - code: "function wrap() { 'use strict'; class A {} }", - options: [{ version: "4.0.0" }], - }, - { - code: "class A {}", - options: [{ version: "6.0.0" }], - }, - ], - invalid: [ - { - code: "'use strict'; class A {}", - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "no-classes-strict", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - { - code: "class A {}", - options: [{ version: "5.9.9" }], - errors: [ - { - messageId: "no-classes-sloppy", - data: { supported: "6.0.0", version: "5.9.9" }, - }, - ], - }, - ], - }, - { - keyword: "computedProperties", - valid: [ - { - code: "({ 0: 0, key: 1, 'key2': 2, key3, key4() {} })", - options: [ - { version: "3.9.9", ignores: ["propertyShorthands"] }, - ], - }, - { - code: "({ [key]: 1 })", - options: [{ version: "4.0.0" }], - }, - { - code: "({ [key]() {} })", - options: [{ version: "4.0.0" }], - }, - { - code: "class A { [key]() {} }", - options: [{ version: "4.0.0", ignores: ["classes"] }], - }, - { - code: "(class { [key]() {} })", - options: [{ version: "4.0.0", ignores: ["classes"] }], - }, - ], - invalid: [ - { - code: "({ [key]: 1 })", - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "no-computed-properties", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - { - code: "({ [key]() {} })", - options: [ - { version: "3.9.9", ignores: ["propertyShorthands"] }, - ], - errors: [ - { - messageId: "no-computed-properties", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - { - code: "class A { [key]() {} }", - options: [{ version: "3.9.9", ignores: ["classes"] }], - errors: [ - { - messageId: "no-computed-properties", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - { - code: "(class { [key]() {} })", - options: [{ version: "3.9.9", ignores: ["classes"] }], - errors: [ - { - messageId: "no-computed-properties", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - ], - }, - { - keyword: "defaultParameters", - valid: [ - { - code: "a = 0", - options: [{ version: "5.9.9" }], - }, - { - code: "var a = 0", - options: [{ version: "5.9.9" }], - }, - { - code: "var [a = 0] = []", - options: [{ version: "5.9.9", ignores: ["destructuring"] }], - }, - { - code: "var {a = 0} = {}", - options: [{ version: "5.9.9", ignores: ["destructuring"] }], - }, - { - code: "function f(a = 0) {}", - options: [{ version: "6.0.0" }], - }, - { - code: "(function(a = 0) {})", - options: [{ version: "6.0.0" }], - }, - { - code: "((a = 0) => a)", - options: [{ version: "6.0.0" }], - }, - { - code: "({ key(a = 0) {} })", - options: [{ version: "6.0.0" }], - }, - { - code: "class A { key(a = 0) {} }", - options: [{ version: "6.0.0" }], - }, - { - code: "(class { key(a = 0) {} })", - options: [{ version: "6.0.0" }], - }, - { - code: "function f(a = 0) {}", - options: [ - { version: "5.9.9", ignores: ["defaultParameters"] }, - ], - }, - { - code: "(function(a = 0) {})", - options: [ - { version: "5.9.9", ignores: ["defaultParameters"] }, - ], - }, - { - code: "((a = 0) => a)", - options: [ - { version: "5.9.9", ignores: ["defaultParameters"] }, - ], - }, - { - code: "({ key(a = 0) {} })", - options: [ - { version: "5.9.9", ignores: ["defaultParameters"] }, - ], - }, - { - code: "class A { key(a = 0) {} }", - options: [ - { - version: "5.9.9", - ignores: ["classes", "defaultParameters"], - }, - ], - }, - { - code: "(class { key(a = 0) {} })", - options: [ - { - version: "5.9.9", - ignores: ["classes", "defaultParameters"], - }, - ], - }, - ], - invalid: [ - { - code: "function f(a = 0) {}", - options: [{ version: "5.9.9" }], - errors: [ - { - messageId: "no-default-parameters", - data: { supported: "6.0.0", version: "5.9.9" }, - }, - ], - }, - { - code: "(function(a = 0) {})", - options: [{ version: "5.9.9" }], - errors: [ - { - messageId: "no-default-parameters", - data: { supported: "6.0.0", version: "5.9.9" }, - }, - ], - }, - { - code: "((a = 0) => a)", - options: [{ version: "5.9.9" }], - errors: [ - { - messageId: "no-default-parameters", - data: { supported: "6.0.0", version: "5.9.9" }, - }, - ], - }, - { - code: "({ key(a = 0) {} })", - options: [{ version: "5.9.9" }], - errors: [ - { - messageId: "no-default-parameters", - data: { supported: "6.0.0", version: "5.9.9" }, +runTests([ + //---------------------------------------------------------------------- + // ES2015 + //---------------------------------------------------------------------- + { + keyword: "arrowFunctions", + valid: [ + { + code: "function f() {}", + options: [{ version: "3.9.9" }], + }, + { + code: "!function f() {}", + options: [{ version: "3.9.9" }], + }, + { + code: "(() => 1)", + options: [{ version: "4.0.0" }], + }, + { + code: "(() => {})", + options: [{ version: "4.0.0" }], + }, + ], + invalid: [ + { + code: "(() => 1)", + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "no-arrow-functions", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + { + code: "(() => {})", + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "no-arrow-functions", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + ], + }, + { + keyword: "binaryNumericLiterals", + valid: [ + { + code: "0x01", + options: [{ version: "3.9.9" }], + }, + { + code: "1", + options: [{ version: "3.9.9" }], + }, + { + code: "0b01", + options: [{ version: "4.0.0" }], + }, + ], + invalid: [ + { + code: "0b01", + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "no-binary-numeric-literals", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + ], + }, + { + keyword: "blockScopedFunctions", + valid: [ + { + code: "'use strict'; if (a) { function f() {} }", + options: [{ version: "4.0.0" }], + }, + { + code: "'use strict'; function wrap() { if (a) { function f() {} } }", + options: [{ version: "4.0.0" }], + }, + { + code: "function wrap() { 'use strict'; if (a) { function f() {} } }", + options: [{ version: "4.0.0" }], + }, + { + code: "if (a) { function f() {} }", + options: [{ version: "6.0.0" }], + }, + ], + invalid: [ + { + code: "'use strict'; if (a) { function f() {} }", + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "no-block-scoped-functions-strict", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + { + code: "if (a) { function f() {} }", + options: [{ version: "5.9.9" }], + errors: [ + { + messageId: "no-block-scoped-functions-sloppy", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + ], + }, + { + keyword: "blockScopedVariables", + valid: [ + { + code: "var a = 0", + options: [{ version: "3.9.9" }], + }, + { + code: "'use strict'; let a = 0", + options: [{ version: "4.0.0" }], + }, + { + code: "'use strict'; const a = 0", + options: [{ version: "4.0.0" }], + }, + { + code: "'use strict'; function wrap() { const a = 0 }", + options: [{ version: "4.0.0" }], + }, + { + code: "function wrap() { 'use strict'; const a = 0 }", + options: [{ version: "4.0.0" }], + }, + { + code: "let a = 0", + options: [{ version: "6.0.0" }], + }, + { + code: "const a = 0", + options: [{ version: "6.0.0" }], + }, + ], + invalid: [ + { + code: "'use strict'; let a = 0", + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "no-block-scoped-variables-strict", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + { + code: "'use strict'; const a = 0", + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "no-block-scoped-variables-strict", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + { + code: "let a = 0", + options: [{ version: "5.9.9" }], + errors: [ + { + messageId: "no-block-scoped-variables-sloppy", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + { + code: "const a = 0", + options: [{ version: "5.9.9" }], + errors: [ + { + messageId: "no-block-scoped-variables-sloppy", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + ], + }, + { + keyword: "classes", + valid: [ + { + code: "'use strict'; class A {}", + options: [{ version: "4.0.0" }], + }, + { + code: "'use strict'; function wrap() { class A {} }", + options: [{ version: "4.0.0" }], + }, + { + code: "function wrap() { 'use strict'; class A {} }", + options: [{ version: "4.0.0" }], + }, + { + code: "class A {}", + options: [{ version: "6.0.0" }], + }, + ], + invalid: [ + { + code: "'use strict'; class A {}", + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "no-classes-strict", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + { + code: "class A {}", + options: [{ version: "5.9.9" }], + errors: [ + { + messageId: "no-classes-sloppy", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + ], + }, + { + keyword: "computedProperties", + valid: [ + { + code: "({ 0: 0, key: 1, 'key2': 2, key3, key4() {} })", + options: [ + { version: "3.9.9", ignores: ["propertyShorthands"] }, + ], + }, + { + code: "({ [key]: 1 })", + options: [{ version: "4.0.0" }], + }, + { + code: "({ [key]() {} })", + options: [{ version: "4.0.0" }], + }, + { + code: "class A { [key]() {} }", + options: [{ version: "4.0.0", ignores: ["classes"] }], + }, + { + code: "(class { [key]() {} })", + options: [{ version: "4.0.0", ignores: ["classes"] }], + }, + ], + invalid: [ + { + code: "({ [key]: 1 })", + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "no-computed-properties", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + { + code: "({ [key]() {} })", + options: [ + { version: "3.9.9", ignores: ["propertyShorthands"] }, + ], + errors: [ + { + messageId: "no-computed-properties", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + { + code: "class A { [key]() {} }", + options: [{ version: "3.9.9", ignores: ["classes"] }], + errors: [ + { + messageId: "no-computed-properties", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + { + code: "(class { [key]() {} })", + options: [{ version: "3.9.9", ignores: ["classes"] }], + errors: [ + { + messageId: "no-computed-properties", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + ], + }, + { + keyword: "defaultParameters", + valid: [ + { + code: "a = 0", + options: [{ version: "5.9.9" }], + }, + { + code: "var a = 0", + options: [{ version: "5.9.9" }], + }, + { + code: "var [a = 0] = []", + options: [{ version: "5.9.9", ignores: ["destructuring"] }], + }, + { + code: "var {a = 0} = {}", + options: [{ version: "5.9.9", ignores: ["destructuring"] }], + }, + { + code: "function f(a = 0) {}", + options: [{ version: "6.0.0" }], + }, + { + code: "(function(a = 0) {})", + options: [{ version: "6.0.0" }], + }, + { + code: "((a = 0) => a)", + options: [{ version: "6.0.0" }], + }, + { + code: "({ key(a = 0) {} })", + options: [{ version: "6.0.0" }], + }, + { + code: "class A { key(a = 0) {} }", + options: [{ version: "6.0.0" }], + }, + { + code: "(class { key(a = 0) {} })", + options: [{ version: "6.0.0" }], + }, + { + code: "function f(a = 0) {}", + options: [{ version: "5.9.9", ignores: ["defaultParameters"] }], + }, + { + code: "(function(a = 0) {})", + options: [{ version: "5.9.9", ignores: ["defaultParameters"] }], + }, + { + code: "((a = 0) => a)", + options: [{ version: "5.9.9", ignores: ["defaultParameters"] }], + }, + { + code: "({ key(a = 0) {} })", + options: [{ version: "5.9.9", ignores: ["defaultParameters"] }], + }, + { + code: "class A { key(a = 0) {} }", + options: [ + { + version: "5.9.9", + ignores: ["classes", "defaultParameters"], + }, + ], + }, + { + code: "(class { key(a = 0) {} })", + options: [ + { + version: "5.9.9", + ignores: ["classes", "defaultParameters"], + }, + ], + }, + ], + invalid: [ + { + code: "function f(a = 0) {}", + options: [{ version: "5.9.9" }], + errors: [ + { + messageId: "no-default-parameters", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + { + code: "(function(a = 0) {})", + options: [{ version: "5.9.9" }], + errors: [ + { + messageId: "no-default-parameters", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + { + code: "((a = 0) => a)", + options: [{ version: "5.9.9" }], + errors: [ + { + messageId: "no-default-parameters", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + { + code: "({ key(a = 0) {} })", + options: [{ version: "5.9.9" }], + errors: [ + { + messageId: "no-default-parameters", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + { + code: "class A { key(a = 0) {} }", + options: [{ version: "5.9.9", ignores: ["classes"] }], + errors: [ + { + messageId: "no-default-parameters", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + { + code: "(class { key(a = 0) {} })", + options: [{ version: "5.9.9", ignores: ["classes"] }], + errors: [ + { + messageId: "no-default-parameters", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + ], + }, + { + keyword: "destructuring", + valid: [ + { + code: "function f(a = 0) {}", + options: [{ version: "5.9.9", ignores: ["defaultParameters"] }], + }, + { + code: "[...a]", + options: [{ version: "5.9.9" }], + }, + { + code: "f(...a)", + options: [{ version: "5.9.9" }], + }, + { + code: "new A(...a)", + options: [{ version: "5.9.9" }], + }, + { + code: "var a = {}", + options: [{ version: "5.9.9" }], + }, + { + code: "var {a} = {}", + options: [{ version: "6.0.0" }], + }, + { + code: "var [a] = {}", + options: [{ version: "6.0.0" }], + }, + { + code: "function f({a}) {}", + options: [{ version: "6.0.0" }], + }, + { + code: "function f([a]) {}", + options: [{ version: "6.0.0" }], + }, + ], + invalid: [ + { + code: "var {a} = {}", + options: [{ version: "5.9.9" }], + errors: [ + { + messageId: "no-destructuring", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + { + code: "var [a] = {}", + options: [{ version: "5.9.9" }], + errors: [ + { + messageId: "no-destructuring", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + { + code: "function f({a}) {}", + options: [{ version: "5.9.9" }], + errors: [ + { + messageId: "no-destructuring", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + { + code: "function f([a]) {}", + options: [{ version: "5.9.9" }], + errors: [ + { + messageId: "no-destructuring", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + // One error even if it's nested. + { + code: "var {a: {b: [c = 0]}} = {}", + options: [{ version: "5.9.9" }], + errors: [ + { + messageId: "no-destructuring", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + { + code: "var [{a: [b = 0]}] = {}", + options: [{ version: "5.9.9" }], + errors: [ + { + messageId: "no-destructuring", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + { + code: "function f({a: {b: [c = 0]}}) {}", + options: [{ version: "5.9.9" }], + errors: [ + { + messageId: "no-destructuring", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + { + code: "function f([{a: [b = 0]}]) {}", + options: [{ version: "5.9.9" }], + errors: [ + { + messageId: "no-destructuring", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + ], + }, + { + keyword: "forOfLoops", + valid: [ + { + code: "for (;;);", + options: [{ version: "0.11.9" }], + }, + { + code: "for (a in b);", + options: [{ version: "0.11.9" }], + }, + { + code: "for (var a in b);", + options: [{ version: "0.11.9" }], + }, + { + code: "for (a of b);", + options: [{ version: "0.12.0" }], + }, + { + code: "for (var a of b);", + options: [{ version: "0.12.0" }], + }, + ], + invalid: [ + { + code: "for (a of b);", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "no-for-of-loops", + data: { supported: "0.12.0", version: "0.11.9" }, + }, + ], + }, + { + code: "for (var a of b);", + options: [{ version: "0.11.9" }], + errors: [ + { + messageId: "no-for-of-loops", + data: { supported: "0.12.0", version: "0.11.9" }, + }, + ], + }, + { + code: "async function wrap() { for await (var a of b); }", + options: [ + { + version: "0.11.9", + ignores: ["asyncFunctions", "asyncIteration"], + }, + ], + errors: [ + { + messageId: "no-for-of-loops", + data: { supported: "0.12.0", version: "0.11.9" }, + }, + ], + }, + ], + }, + { + keyword: "generators", + valid: [ + { + code: "function f() {}", + options: [{ version: "3.9.9" }], + }, + { + code: "async function f() {}", + options: [{ version: "3.9.9", ignores: ["asyncFunctions"] }], + }, + { + code: "function* f() {}", + options: [{ version: "4.0.0" }], + }, + { + code: "(function*() {})", + options: [{ version: "4.0.0" }], + }, + { + code: "({ *f() {} })", + options: [ + { version: "4.0.0", ignores: ["propertyShorthands"] }, + ], + }, + { + code: "class A { *f() {} }", + options: [{ version: "4.0.0", ignores: ["classes"] }], + }, + { + code: "(class { *f() {} })", + options: [{ version: "4.0.0", ignores: ["classes"] }], + }, + ], + invalid: [ + { + code: "function* f() {}", + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "no-generators", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + { + code: "(function*() {})", + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "no-generators", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + { + code: "({ *f() {} })", + options: [ + { version: "3.9.9", ignores: ["propertyShorthands"] }, + ], + errors: [ + { + messageId: "no-generators", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + { + code: "class A { *f() {} }", + options: [{ version: "3.9.9", ignores: ["classes"] }], + errors: [ + { + messageId: "no-generators", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + { + code: "(class { *f() {} })", + options: [{ version: "3.9.9", ignores: ["classes"] }], + errors: [ + { + messageId: "no-generators", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + ], + }, + { + keyword: "modules", + valid: [ + { + code: "require('a')", + options: [{ version: "0.0.0" }], + }, + { + code: "module.exports = {}", + options: [{ version: "0.0.0" }], + }, + { + code: "exports.a = {}", + options: [{ version: "0.0.0" }], + }, + { + code: "import a from 'a'", + languageOptions: { sourceType: "module" }, + options: [{ version: "13.1.0", ignores: ["modules"] }], + }, + { + code: "export default {}", + languageOptions: { sourceType: "module" }, + options: [{ version: "13.1.0", ignores: ["modules"] }], + }, + { + code: "export const a = {}", + languageOptions: { sourceType: "module" }, + options: [{ version: "13.1.0", ignores: ["modules"] }], + }, + { + code: "export {}", + languageOptions: { sourceType: "module" }, + options: [{ version: "13.1.0", ignores: ["modules"] }], + }, + ], + invalid: [ + { + code: "import a from 'a'", + languageOptions: { sourceType: "module" }, + options: [{ version: "10.0.0" }], + errors: [ + { + messageId: "no-modules", + data: { supported: null, version: "10.0.0" }, + }, + ], + }, + { + code: "export default {}", + languageOptions: { sourceType: "module" }, + options: [{ version: "10.0.0" }], + errors: [ + { + messageId: "no-modules", + data: { supported: null, version: "10.0.0" }, + }, + ], + }, + { + code: "export const a = {}", + languageOptions: { sourceType: "module" }, + options: [{ version: "10.0.0" }], + errors: [ + { + messageId: "no-modules", + data: { supported: null, version: "10.0.0" }, + }, + ], + }, + { + code: "export {}", + languageOptions: { sourceType: "module" }, + options: [{ version: "10.0.0" }], + errors: [ + { + messageId: "no-modules", + data: { supported: null, version: "10.0.0" }, + }, + ], + }, + ], + }, + { + keyword: "new.target", + valid: [ + { + code: "new target", + options: [{ version: "4.9.9" }], + }, + { + code: "class A { constructor() { new.target } }", + options: [{ version: "5.0.0", ignores: ["classes"] }], + }, + { + code: "function A() { new.target }", + options: [{ version: "5.0.0" }], + }, + ], + invalid: [ + { + code: "class A { constructor() { new.target } }", + options: [{ version: "4.9.9", ignores: ["classes"] }], + errors: [ + { + messageId: "no-new-target", + data: { supported: "5.0.0", version: "4.9.9" }, + }, + ], + }, + { + code: "function A() { new.target }", + options: [{ version: "4.9.9" }], + errors: [ + { + messageId: "no-new-target", + data: { supported: "5.0.0", version: "4.9.9" }, + }, + ], + }, + ], + }, + { + keyword: "objectSuperProperties", + valid: [ + { + code: "class A { foo() { super.foo } }", + options: [{ version: "3.9.9", ignores: ["classes"] }], + }, + { + code: "(class { foo() { super.foo } })", + options: [{ version: "3.9.9", ignores: ["classes"] }], + }, + { + code: "class A extends B { constructor() { super() } }", + options: [{ version: "3.9.9", ignores: ["classes"] }], + }, + { + code: "({ foo() { super.foo } })", + options: [ + { version: "4.0.0", ignores: ["propertyShorthands"] }, + ], + }, + { + code: "({ foo() { super.foo() } })", + options: [ + { version: "4.0.0", ignores: ["propertyShorthands"] }, + ], + }, + ], + invalid: [ + { + code: "({ foo() { super.foo } })", + options: [ + { version: "3.9.9", ignores: ["propertyShorthands"] }, + ], + errors: [ + { + messageId: "no-object-super-properties", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + { + code: "({ foo() { super.foo() } })", + options: [ + { version: "3.9.9", ignores: ["propertyShorthands"] }, + ], + errors: [ + { + messageId: "no-object-super-properties", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + ], + }, + { + keyword: "octalNumericLiterals", + valid: [ + { + code: "0755", + options: [{ version: "3.9.9" }], + }, + { + code: "0x755", + options: [{ version: "3.9.9" }], + }, + { + code: "0X755", + options: [{ version: "3.9.9" }], + }, + { + code: "0b01", + options: [ + { + version: "3.9.9", + ignores: ["binaryNumericLiterals"], + }, + ], + }, + { + code: "0B01", + options: [ + { + version: "3.9.9", + ignores: ["binaryNumericLiterals"], + }, + ], + }, + { + code: "0o755", + options: [{ version: "4.0.0" }], + }, + { + code: "0O755", + options: [{ version: "4.0.0" }], + }, + ], + invalid: [ + { + code: "0o755", + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "no-octal-numeric-literals", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + { + code: "0O755", + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "no-octal-numeric-literals", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + ], + }, + { + keyword: "propertyShorthands", + valid: [ + { + code: "({ a: 1 })", + options: [{ version: "3.9.9" }], + }, + { + code: "({ get: get })", + options: [{ version: "3.9.9" }], + }, + { + code: "({ get a() {} })", + options: [{ version: "3.9.9" }], + }, + { + code: "({ a })", + options: [{ version: "4.0.0" }], + }, + { + code: "({ b() {} })", + options: [{ version: "4.0.0" }], + }, + { + code: "({ get() {} })", + options: [{ version: "4.0.0" }], + }, + { + code: "({ [c]() {} })", + options: [ + { version: "4.0.0", ignores: ["computedProperties"] }, + ], + }, + { + code: "({ get })", + options: [{ version: "6.0.0" }], + }, + { + code: "({ set })", + options: [{ version: "6.0.0" }], + }, + ], + invalid: [ + { + code: "({ a })", + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "no-property-shorthands", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + { + code: "({ b() {} })", + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "no-property-shorthands", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + { + code: "({ [c]() {} })", + options: [ + { version: "3.9.9", ignores: ["computedProperties"] }, + ], + errors: [ + { + messageId: "no-property-shorthands", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + { + code: "({ get })", + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "no-property-shorthands-getset", + data: { supported: "6.0.0", version: "3.9.9" }, + }, + ], + }, + { + code: "({ set })", + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "no-property-shorthands-getset", + data: { supported: "6.0.0", version: "3.9.9" }, + }, + ], + }, + { + code: "({ get })", + options: [{ version: "5.9.9" }], + errors: [ + { + messageId: "no-property-shorthands-getset", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + { + code: "({ set })", + options: [{ version: "5.9.9" }], + errors: [ + { + messageId: "no-property-shorthands-getset", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + ], + }, + { + keyword: "regexpU", + valid: [ + { + code: "/foo/", + options: [{ version: "5.9.9" }], + }, + { + code: "/foo/gmi", + options: [{ version: "5.9.9" }], + }, + { + code: "/foo/y", + options: [{ version: "5.9.9", ignores: ["regexpY"] }], + }, + { + code: "/foo/u", + options: [{ version: "6.0.0" }], + }, + ], + invalid: [ + { + code: "/foo/u", + options: [{ version: "5.9.9" }], + errors: [ + { + messageId: "no-regexp-u-flag", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + ], + }, + { + keyword: "regexpY", + valid: [ + { + code: "/foo/", + options: [{ version: "5.9.9" }], + }, + { + code: "/foo/gmi", + options: [{ version: "5.9.9" }], + }, + { + code: "/foo/u", + options: [{ version: "5.9.9", ignores: ["regexpU"] }], + }, + { + code: "/foo/y", + options: [{ version: "6.0.0" }], + }, + ], + invalid: [ + { + code: "/foo/y", + options: [{ version: "5.9.9" }], + errors: [ + { + messageId: "no-regexp-y-flag", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + ], + }, + { + keyword: "restParameters", + valid: [ + { + code: "var [...a] = b", + options: [{ version: "5.9.9", ignores: ["destructuring"] }], + }, + { + code: "var {...a} = b", + options: [ + { + version: "5.9.9", + ignores: ["destructuring", "restSpreadProperties"], + }, + ], + }, + { + code: "var a = [...b]", + options: [{ version: "5.9.9" }], + }, + { + code: "var a = {...b}", + options: [ + { version: "5.9.9", ignores: ["restSpreadProperties"] }, + ], + }, + { + code: "f(...a)", + options: [{ version: "5.9.9" }], + }, + { + code: "function f(...a) {}", + options: [{ version: "6.0.0" }], + }, + { + code: "function f(...[a, b = 0]) {}", + options: [{ version: "6.0.0", ignores: ["destructuring"] }], + }, + { + code: "(function(...a) {})", + options: [{ version: "6.0.0" }], + }, + { + code: "((...a) => {})", + options: [{ version: "6.0.0" }], + }, + { + code: "({ f(...a) {} })", + options: [{ version: "6.0.0" }], + }, + { + code: "class A { f(...a) {} }", + options: [{ version: "6.0.0", ignores: ["classes"] }], + }, + { + code: "(class { f(...a) {} })", + options: [{ version: "6.0.0", ignores: ["classes"] }], + }, + ], + invalid: [ + { + code: "function f(...a) {}", + options: [{ version: "5.9.9" }], + errors: [ + { + messageId: "no-rest-parameters", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + { + code: "function f(...[a, b = 0]) {}", + options: [{ version: "5.9.9", ignores: ["destructuring"] }], + errors: [ + { + messageId: "no-rest-parameters", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + { + code: "(function(...a) {})", + options: [{ version: "5.9.9" }], + errors: [ + { + messageId: "no-rest-parameters", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + { + code: "((...a) => {})", + options: [{ version: "5.9.9" }], + errors: [ + { + messageId: "no-rest-parameters", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + { + code: "({ f(...a) {} })", + options: [{ version: "5.9.9" }], + errors: [ + { + messageId: "no-rest-parameters", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + { + code: "class A { f(...a) {} }", + options: [{ version: "5.9.9", ignores: ["classes"] }], + errors: [ + { + messageId: "no-rest-parameters", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + { + code: "(class { f(...a) {} })", + options: [{ version: "5.9.9", ignores: ["classes"] }], + errors: [ + { + messageId: "no-rest-parameters", + data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + ], + }, + { + keyword: "spreadElements", + valid: [ + { + code: "var [...a] = b", + options: [{ version: "4.9.9", ignores: ["destructuring"] }], + }, + { + code: "var {...a} = b", + options: [ + { + version: "4.9.9", + ignores: ["destructuring", "restSpreadProperties"], + }, + ], + }, + { + code: "var a = {...b}", + options: [ + { + version: "4.9.9", + ignores: ["restSpreadProperties"], + }, + ], + }, + { + code: "function f(...a) {}", + options: [{ version: "4.9.9", ignores: ["restParameters"] }], + }, + { + code: "[...a]", + options: [{ version: "5.0.0" }], + }, + { + code: "[...a, ...b]", + options: [{ version: "5.0.0" }], + }, + { + code: "f(...a)", + options: [{ version: "5.0.0" }], + }, + { + code: "new F(...a)", + options: [{ version: "5.0.0" }], + }, + ], + invalid: [ + { + code: "[...a]", + options: [{ version: "4.9.9" }], + errors: [ + { + messageId: "no-spread-elements", + data: { supported: "5.0.0", version: "4.9.9" }, + }, + ], + }, + { + code: "[...a, ...b]", + options: [{ version: "4.9.9" }], + errors: [ + { + messageId: "no-spread-elements", + data: { supported: "5.0.0", version: "4.9.9" }, + }, + { + messageId: "no-spread-elements", + data: { supported: "5.0.0", version: "4.9.9" }, + }, + ], + }, + { + code: "f(...a)", + options: [{ version: "4.9.9" }], + errors: [ + { + messageId: "no-spread-elements", + data: { supported: "5.0.0", version: "4.9.9" }, + }, + ], + }, + { + code: "new F(...a)", + options: [{ version: "4.9.9" }], + errors: [ + { + messageId: "no-spread-elements", + data: { supported: "5.0.0", version: "4.9.9" }, + }, + ], + }, + ], + }, + { + keyword: "templateLiterals", + valid: [ + { + code: "'`foo`'", + options: [{ version: "3.9.9" }], + }, + { + code: "`foo`", + options: [{ version: "4.0.0" }], + }, + { + code: "`foo${a}bar`", + options: [{ version: "4.0.0" }], + }, + { + code: "tag`foo`", + options: [{ version: "4.0.0" }], + }, + { + code: "tag`foo${a}bar`", + options: [{ version: "4.0.0" }], + }, + ], + invalid: [ + { + code: "`foo`", + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "no-template-literals", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + { + code: "`foo${a}bar`", + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "no-template-literals", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + { + code: "tag`foo`", + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "no-template-literals", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + { + code: "tag`foo${a}bar`", + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "no-template-literals", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + ], + }, + { + keyword: "unicodeCodePointEscapes", + valid: [ + { + code: String.raw`var a = "\x61"`, + options: [{ version: "3.9.9" }], + }, + { + code: String.raw`var a = "\u0061"`, + options: [{ version: "3.9.9" }], + }, + { + code: String.raw`var a = "\\u{61}"`, + options: [{ version: "3.9.9" }], + }, + { + code: String.raw`var \u{61} = 0`, + options: [{ version: "4.0.0" }], + }, + { + code: String.raw`var a = "\u{61}"`, + options: [{ version: "4.0.0" }], + }, + { + code: String.raw`var a = '\u{61}'`, + options: [{ version: "4.0.0" }], + }, + { + code: "var a = `\\u{61}`", + options: [{ version: "4.0.0" }], + }, + ], + invalid: [ + { + code: String.raw`var \u{61} = 0`, + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "no-unicode-codepoint-escapes", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + { + code: String.raw`var a = "\u{61}"`, + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "no-unicode-codepoint-escapes", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + { + code: String.raw`var a = "\\\u{61}"`, + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "no-unicode-codepoint-escapes", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + { + code: String.raw`var a = '\u{61}'`, + options: [{ version: "3.9.9" }], + errors: [ + { + messageId: "no-unicode-codepoint-escapes", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + { + code: "var a = `\\u{61}`", + options: [{ version: "3.9.9", ignores: ["templateLiterals"] }], + errors: [ + { + messageId: "no-unicode-codepoint-escapes", + data: { supported: "4.0.0", version: "3.9.9" }, + }, + ], + }, + ], + }, + + //---------------------------------------------------------------------- + // ES2016 + //---------------------------------------------------------------------- + { + keyword: "exponentialOperators", + valid: [ + { + code: "a ** b", + options: [{ version: "7.0.0" }], + }, + { + code: "a **= b", + options: [{ version: "7.0.0" }], + }, + { + code: "a * b", + options: [{ version: "6.9.9" }], + }, + { + code: "a *= b", + options: [{ version: "6.9.9" }], + }, + ], + invalid: [ + { + code: "a ** b", + options: [{ version: "6.9.9" }], + errors: [ + { + messageId: "no-exponential-operators", + data: { supported: "7.0.0", version: "6.9.9" }, + }, + ], + }, + { + code: "a **= b", + options: [{ version: "6.9.9" }], + errors: [ + { + messageId: "no-exponential-operators", + data: { supported: "7.0.0", version: "6.9.9" }, + }, + ], + }, + ], + }, + + //---------------------------------------------------------------------- + // ES2017 + //---------------------------------------------------------------------- + { + keyword: "asyncFunctions", + valid: [ + { + code: "async function f() {}", + options: [{ version: "7.6.0" }], + }, + { + code: "async function f() { await 1 }", + options: [{ version: "7.6.0" }], + }, + { + code: "(async function() { await 1 })", + options: [{ version: "7.6.0" }], + }, + { + code: "(async() => { await 1 })", + options: [{ version: "7.6.0" }], + }, + { + code: "({ async method() { await 1 } })", + options: [{ version: "7.6.0" }], + }, + { + code: "class A { async method() { await 1 } }", + options: [{ version: "7.6.0" }], + }, + { + code: "(class { async method() { await 1 } })", + options: [{ version: "7.6.0" }], + }, + ], + invalid: [ + { + code: "async function f() {}", + options: [{ version: "7.5.9" }], + errors: [ + { + messageId: "no-async-functions", + data: { supported: "7.6.0", version: "7.5.9" }, + }, + ], + }, + { + code: "async function f() { await 1 }", + options: [{ version: "7.5.9" }], + errors: [ + { + messageId: "no-async-functions", + data: { supported: "7.6.0", version: "7.5.9" }, + }, + ], + }, + { + code: "(async function() { await 1 })", + options: [{ version: "7.5.9" }], + errors: [ + { + messageId: "no-async-functions", + data: { supported: "7.6.0", version: "7.5.9" }, + }, + ], + }, + { + code: "(async() => { await 1 })", + options: [{ version: "7.5.9" }], + errors: [ + { + messageId: "no-async-functions", + data: { supported: "7.6.0", version: "7.5.9" }, + }, + ], + }, + { + code: "({ async method() { await 1 } })", + options: [{ version: "7.5.9" }], + errors: [ + { + messageId: "no-async-functions", + data: { supported: "7.6.0", version: "7.5.9" }, + }, + ], + }, + { + code: "class A { async method() { await 1 } }", + options: [{ version: "7.5.9" }], + errors: [ + { + messageId: "no-async-functions", + data: { supported: "7.6.0", version: "7.5.9" }, + }, + ], + }, + { + code: "(class { async method() { await 1 } })", + options: [{ version: "7.5.9" }], + errors: [ + { + messageId: "no-async-functions", + data: { supported: "7.6.0", version: "7.5.9" }, + }, + ], + }, + ], + }, + { + keyword: "trailingCommasInFunctions", + valid: [ + { + code: "function f(a,) {}", + options: [{ version: "8.0.0" }], + }, + { + code: "(function(a,) {})", + options: [{ version: "8.0.0" }], + }, + { + code: "((a,) => {})", + options: [{ version: "8.0.0" }], + }, + { + code: "({ method(a,) {} })", + options: [{ version: "8.0.0" }], + }, + { + code: "class A { method(a,) {} }", + options: [{ version: "8.0.0" }], + }, + { + code: "(class { method(a,) {} })", + options: [{ version: "8.0.0" }], + }, + { + code: "f(1,)", + options: [{ version: "8.0.0" }], + }, + { + code: "new A(1,)", + options: [{ version: "8.0.0" }], + }, + ], + invalid: [ + { + code: "function f(a,) {}", + options: [{ version: "7.9.9" }], + errors: [ + { + messageId: "no-trailing-function-commas", + data: { supported: "8.0.0", version: "7.9.9" }, + }, + ], + }, + { + code: "(function(a,) {})", + options: [{ version: "7.9.9" }], + errors: [ + { + messageId: "no-trailing-function-commas", + data: { supported: "8.0.0", version: "7.9.9" }, + }, + ], + }, + { + code: "((a,) => {})", + options: [{ version: "7.9.9" }], + errors: [ + { + messageId: "no-trailing-function-commas", + data: { supported: "8.0.0", version: "7.9.9" }, + }, + ], + }, + { + code: "({ method(a,) {} })", + options: [{ version: "7.9.9" }], + errors: [ + { + messageId: "no-trailing-function-commas", + data: { supported: "8.0.0", version: "7.9.9" }, + }, + ], + }, + { + code: "class A { method(a,) {} }", + options: [{ version: "7.9.9" }], + errors: [ + { + messageId: "no-trailing-function-commas", + data: { supported: "8.0.0", version: "7.9.9" }, + }, + ], + }, + { + code: "(class { method(a,) {} })", + options: [{ version: "7.9.9" }], + errors: [ + { + messageId: "no-trailing-function-commas", + data: { supported: "8.0.0", version: "7.9.9" }, + }, + ], + }, + { + code: "f(1,)", + options: [{ version: "7.9.9" }], + errors: [ + { + messageId: "no-trailing-function-commas", + data: { supported: "8.0.0", version: "7.9.9" }, + }, + ], + }, + { + code: "new A(1,)", + options: [{ version: "7.9.9" }], + errors: [ + { + messageId: "no-trailing-function-commas", + data: { supported: "8.0.0", version: "7.9.9" }, + }, + ], + }, + ], + }, + + //---------------------------------------------------------------------- + // ES2018 + //---------------------------------------------------------------------- + { + keyword: "asyncIteration", + valid: [ + { + code: "async function f() { for await (const x of xs) {} }", + options: [{ version: "10.0.0" }], + }, + { + code: "async function* f() { }", + options: [{ version: "10.0.0" }], + }, + { + code: "(async function* () { })", + options: [{ version: "10.0.0" }], + }, + { + code: "({ async* method() { } })", + options: [{ version: "10.0.0" }], + }, + { + code: "class A { async* method() { } }", + options: [{ version: "10.0.0" }], + }, + { + code: "(class { async* method() { } })", + options: [{ version: "10.0.0" }], + }, + { + code: "function f() { for (const x of xs) {} }", + options: [{ version: "9.9.9" }], + }, + { + code: "async function f() { }", + options: [{ version: "9.9.9" }], + }, + { + code: "function* f() { }", + options: [{ version: "9.9.9" }], + }, + ], + invalid: [ + { + code: "async function f() { for await (const x of xs) {} }", + options: [{ version: "9.9.9" }], + errors: [ + { + messageId: "no-async-iteration", + data: { supported: "10.0.0", version: "9.9.9" }, + }, + ], + }, + { + code: "async function* f() { }", + options: [{ version: "9.9.9" }], + errors: [ + { + messageId: "no-async-iteration", + data: { supported: "10.0.0", version: "9.9.9" }, + }, + ], + }, + { + code: "(async function* () { })", + options: [{ version: "9.9.9" }], + errors: [ + { + messageId: "no-async-iteration", + data: { supported: "10.0.0", version: "9.9.9" }, + }, + ], + }, + { + code: "({ async* method() { } })", + options: [{ version: "9.9.9" }], + errors: [ + { + messageId: "no-async-iteration", + data: { supported: "10.0.0", version: "9.9.9" }, + }, + ], + }, + { + code: "class A { async* method() { } }", + options: [{ version: "9.9.9" }], + errors: [ + { + messageId: "no-async-iteration", + data: { supported: "10.0.0", version: "9.9.9" }, + }, + ], + }, + { + code: "(class { async* method() { } })", + options: [{ version: "9.9.9" }], + errors: [ + { + messageId: "no-async-iteration", + data: { supported: "10.0.0", version: "9.9.9" }, + }, + ], + }, + ], + }, + { + keyword: "malformedTemplateLiterals", + valid: [ + { + code: "tag`\\unicode`", + options: [{ version: "8.10.0" }], + }, + ], + invalid: [ + { + code: "tag`\\unicode`", + options: [{ version: "8.9.9" }], + errors: [ + { + messageId: "no-malformed-template-literals", + data: { supported: "8.10.0", version: "8.9.9" }, + }, + ], + }, + ], + }, + { + keyword: "regexpLookbehind", + valid: [ + { + code: "var a = /(?<=a)foo/", + options: [{ version: "8.10.0" }], + }, + { + code: "var a = /(?a)foo/", + options: [{ version: "10.0.0" }], + }, + { + code: "var a = /(?a)\\k/", + options: [{ version: "10.0.0" }], + }, + { + code: 'var a = new RegExp("(?a)foo")', + options: [{ version: "10.0.0" }], + }, + { + code: "var a = new RegExp(pattern)", + options: [{ version: "8.9.9" }], + }, + { + code: 'var a = new RegExp("(?a\\)foo/", + options: [{ version: "8.9.9" }], + }, + ], + invalid: [ + { + code: "var a = /(?a)foo/", + options: [{ version: "9.9.9" }], + errors: [ + { + messageId: "no-regexp-named-capture-groups", + data: { supported: "10.0.0", version: "9.9.9" }, + }, + ], + }, + { + code: "var a = /(?a)\\k/", + options: [{ version: "9.9.9" }], + errors: [ + { + messageId: "no-regexp-named-capture-groups", + data: { supported: "10.0.0", version: "9.9.9" }, + }, + ], + }, + { + code: 'var a = new RegExp("(?a)foo")', + options: [{ version: "9.9.9" }], + errors: [ + { + messageId: "no-regexp-named-capture-groups", + data: { supported: "10.0.0", version: "9.9.9" }, + }, + ], + }, + ], + }, + { + keyword: "regexpS", + valid: [ + { + code: "var a = /foo/s", + options: [{ version: "8.10.0" }], + }, + { + code: 'var a = new RegExp("foo", "s")', + options: [{ version: "8.10.0" }], + }, + { + code: "var a = new RegExp(a, b)", + options: [{ version: "8.9.9" }], + }, + { + code: 'var a = new RegExp("(aaaaa", b)', + options: [{ version: "8.9.9" }], + }, + ], + invalid: [ + { + code: "var a = /foo/s", + options: [{ version: "8.9.9" }], + errors: [ + { + messageId: "no-regexp-s-flag", + data: { supported: "8.10.0", version: "8.9.9" }, + }, + ], + }, + { + code: 'var a = new RegExp("foo", "s")', + options: [{ version: "8.9.9" }], + errors: [ + { + messageId: "no-regexp-s-flag", + data: { supported: "8.10.0", version: "8.9.9" }, + }, + ], + }, + ], + }, + { + keyword: "regexpUnicodeProperties", + valid: [ + { + code: "var a = /\\p{Letter}/u", + options: [{ version: "10.0.0" }], + }, + { + code: "var a = /\\P{Letter}/u", + options: [{ version: "10.0.0" }], + }, + { + code: 'var a = new RegExp("\\\\p{Letter}", "u")', + options: [{ version: "10.0.0" }], + }, + { + code: 'var a = new RegExp("\\\\p{Letter}")', + options: [{ version: "9.9.9" }], + }, + { + code: 'var a = new RegExp(pattern, "u")', + options: [{ version: "9.9.9" }], + }, + { + code: 'var a = new RegExp("\\\\p{Letter")', + options: [{ version: "9.9.9" }], + }, + ], + invalid: [ + { + code: "var a = /\\p{Letter}/u", + options: [{ version: "9.9.9" }], + errors: [ + { + messageId: "no-regexp-unicode-property-escapes", + data: { supported: "10.0.0", version: "9.9.9" }, + }, + ], + }, + { + code: "var a = /\\P{Letter}/u", + options: [{ version: "9.9.9" }], + errors: [ + { + messageId: "no-regexp-unicode-property-escapes", + data: { supported: "10.0.0", version: "9.9.9" }, + }, + ], + }, + { + code: 'var a = new RegExp("\\\\p{Letter}", "u")', + options: [{ version: "9.9.9" }], + errors: [ + { + messageId: "no-regexp-unicode-property-escapes", + data: { supported: "10.0.0", version: "9.9.9" }, + }, + ], + }, + ], + }, + { + keyword: "restSpreadProperties", + valid: [ + { + code: "({ ...obj })", + options: [{ version: "8.3.0" }], + }, + { + code: "({ ...rest } = obj)", + options: [{ version: "8.3.0" }], + }, + { + code: "({ obj })", + options: [{ version: "8.2.9" }], + }, + { + code: "({ obj: 1 })", + options: [{ version: "8.2.9" }], + }, + { + code: "({ obj } = a)", + options: [{ version: "8.2.9" }], + }, + { + code: "({ obj: a } = b)", + options: [{ version: "8.2.9" }], + }, + { + code: "([...xs])", + options: [{ version: "8.2.9" }], + }, + { + code: "([a, ...xs] = ys)", + options: [{ version: "8.2.9" }], + }, + ], + invalid: [ + { + code: "({ ...obj })", + options: [{ version: "8.2.9" }], + errors: [ + { + messageId: "no-rest-spread-properties", + data: { supported: "8.3.0", version: "8.2.9" }, + }, + ], + }, + { + code: "({ ...rest } = obj)", + options: [{ version: "8.2.9" }], + errors: [ + { + messageId: "no-rest-spread-properties", + data: { supported: "8.3.0", version: "8.2.9" }, + }, + ], + }, + ], + }, + + //---------------------------------------------------------------------- + // ES2019 + //---------------------------------------------------------------------- + { + keyword: "jsonSuperset", + valid: [ + { + code: "var s = 'foo'", + options: [{ version: "9.99.99" }], + }, + { + code: "var s = '\\\u2028'", + options: [{ version: "9.99.99" }], + }, + { + code: "var s = '\\\u2029'", + options: [{ version: "9.99.99" }], + }, + { + code: "var s = '\u2028'", + options: [{ version: "10.0.0" }], + }, + { + code: "var s = '\u2029'", + options: [{ version: "10.0.0" }], + }, + ], + invalid: [ + { + code: "var s = '\u2028'", + options: [{ version: "9.99.99" }], + errors: [ + { + messageId: "no-json-superset", + data: { + code: "2028", + supported: "10.0.0", + version: "9.99.99", }, - ], - }, - { - code: "class A { key(a = 0) {} }", - options: [{ version: "5.9.9", ignores: ["classes"] }], - errors: [ - { - messageId: "no-default-parameters", - data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + { + code: "var s = '\u2029'", + options: [{ version: "9.99.99" }], + errors: [ + { + messageId: "no-json-superset", + data: { + code: "2029", + supported: "10.0.0", + version: "9.99.99", }, - ], - }, - { - code: "(class { key(a = 0) {} })", - options: [{ version: "5.9.9", ignores: ["classes"] }], - errors: [ - { - messageId: "no-default-parameters", - data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + ], + }, + { + keyword: "optionalCatchBinding", + valid: [ + { + code: "try {} catch {}", + options: [{ version: "10.0.0" }], + }, + { + code: "try {} catch (error) {}", + options: [{ version: "9.99.99" }], + }, + ], + invalid: [ + { + code: "try {} catch {}", + options: [{ version: "9.99.99" }], + errors: [ + { + messageId: "no-optional-catch-binding", + data: { supported: "10.0.0", version: "9.99.99" }, + }, + ], + }, + ], + }, + + //---------------------------------------------------------------------- + // ES2020 + //---------------------------------------------------------------------- + { + keyword: "bigint", + requiredEcmaVersion: 2020, + valid: [ + { + code: "var n = 0n", + options: [{ version: "10.4.0" }], + }, + { + code: "var n = BigInt(0)", + options: [{ version: "10.3.0" }], + }, + { + code: "var n = new BigInt64Array()", + options: [{ version: "10.3.0" }], + }, + { + code: "var n = new BigUint64Array()", + options: [{ version: "10.3.0" }], + }, + { + code: "var n = { [0n]: 0 }", + options: [{ version: "10.4.0" }], + }, + { + code: "var n = class { [0n]() {} }", + options: [{ version: "10.4.0" }], + }, + ], + invalid: [ + { + code: "var n = 0n", + options: [{ version: "10.3.0" }], + errors: [ + { + messageId: "no-bigint", + data: { + supported: "10.4.0", + version: "10.3.0", }, - ], - }, - ], - }, - { - keyword: "destructuring", - valid: [ - { - code: "function f(a = 0) {}", - options: [ - { version: "5.9.9", ignores: ["defaultParameters"] }, - ], - }, - { - code: "[...a]", - options: [{ version: "5.9.9" }], - }, - { - code: "f(...a)", - options: [{ version: "5.9.9" }], - }, - { - code: "new A(...a)", - options: [{ version: "5.9.9" }], - }, - { - code: "var a = {}", - options: [{ version: "5.9.9" }], - }, - { - code: "var {a} = {}", - options: [{ version: "6.0.0" }], - }, - { - code: "var [a] = {}", - options: [{ version: "6.0.0" }], - }, - { - code: "function f({a}) {}", - options: [{ version: "6.0.0" }], - }, - { - code: "function f([a]) {}", - options: [{ version: "6.0.0" }], - }, - ], - invalid: [ - { - code: "var {a} = {}", - options: [{ version: "5.9.9" }], - errors: [ - { - messageId: "no-destructuring", - data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + { + code: "var n = { 0n: 0 }", + options: [{ version: "12.0.0" }], + errors: [ + { + messageId: "no-bigint-property-names", + data: { + supported: null, + version: "12.0.0", }, - ], - }, - { - code: "var [a] = {}", - options: [{ version: "5.9.9" }], - errors: [ - { - messageId: "no-destructuring", - data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + { + code: "var n = class { 0n() {} }", + options: [{ version: "12.0.0" }], + errors: [ + { + messageId: "no-bigint-property-names", + data: { + supported: null, + version: "12.0.0", }, - ], - }, - { - code: "function f({a}) {}", - options: [{ version: "5.9.9" }], - errors: [ - { - messageId: "no-destructuring", - data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + ], + }, + { + keyword: "dynamicImport", + requiredEcmaVersion: 2020, + valid: [ + { + code: "obj.import(source)", + options: [{ version: "12.0.0" }], + }, + ...["12.17.0", "13.2.0"].map(v => ({ + code: "import(source)", + options: [{ version: v }], + })), + ], + invalid: [ + ...["12.16.0", "13.0.0", "13.1.0", ">=8.0.0"].map(v => ({ + code: "import(source)", + options: [{ version: v }], + errors: [ + { + messageId: "no-dynamic-import", + data: { + supported: new Range( + ">=12.17 <13 || >=13.2" + ).toString(), + version: v, }, - ], - }, - { - code: "function f([a]) {}", - options: [{ version: "5.9.9" }], - errors: [ - { - messageId: "no-destructuring", - data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + })), + ], + }, + { + keyword: "optionalChaining", + requiredEcmaVersion: 2020, + valid: [ + { + code: "foo?.bar;", + options: [{ version: "14.0.0" }], + }, + ], + invalid: [ + { + code: "foo?.bar", + options: [{ version: "13.0.0" }], + errors: [ + { + messageId: "no-optional-chaining", + data: { + supported: "14.0.0", + version: "13.0.0", }, - ], - }, - // One error even if it's nested. - { - code: "var {a: {b: [c = 0]}} = {}", - options: [{ version: "5.9.9" }], - errors: [ - { - messageId: "no-destructuring", - data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + ], + }, + { + keyword: "nullishCoalescingOperators", + requiredEcmaVersion: 2020, + valid: [ + { + code: "foo ?? bar;", + options: [{ version: "14.0.0" }], + }, + { + code: "foo ?? bar;", + settings: { + node: { version: "14.0.0" }, + }, + }, + ], + invalid: [ + { + code: "foo ?? bar", + options: [{ version: "13.0.0" }], + errors: [ + { + messageId: "no-nullish-coalescing-operators", + data: { + supported: "14.0.0", + version: "13.0.0", }, - ], - }, - { - code: "var [{a: [b = 0]}] = {}", - options: [{ version: "5.9.9" }], - errors: [ - { - messageId: "no-destructuring", - data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + { + code: "foo ?? bar", + settings: { + node: { version: "13.0.0" }, + }, + errors: [ + { + messageId: "no-nullish-coalescing-operators", + data: { + supported: "14.0.0", + version: "13.0.0", }, - ], - }, - { - code: "function f({a: {b: [c = 0]}}) {}", - options: [{ version: "5.9.9" }], - errors: [ - { - messageId: "no-destructuring", - data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + ], + }, + + //---------------------------------------------------------------------- + // ES2021 + //---------------------------------------------------------------------- + { + keyword: "logicalAssignmentOperators", + requiredEcmaVersion: 2021, + valid: [ + { + code: "a ||= b", + options: [{ version: "15.0.0" }], + }, + { + code: "a &&= b", + options: [{ version: "15.0.0" }], + }, + { + code: "a ??= b", + options: [{ version: "15.0.0" }], + }, + ], + invalid: [ + { + code: "a ||= b", + options: [{ version: "14.0.0" }], + errors: [ + { + messageId: "no-logical-assignment-operators", + data: { + supported: "15.0.0", + version: "14.0.0", }, - ], - }, - { - code: "function f([{a: [b = 0]}]) {}", - options: [{ version: "5.9.9" }], - errors: [ - { - messageId: "no-destructuring", - data: { supported: "6.0.0", version: "5.9.9" }, + }, + ], + }, + { + code: "a &&= b", + options: [{ version: "14.0.0" }], + errors: [ + { + messageId: "no-logical-assignment-operators", + data: { + supported: "15.0.0", + version: "14.0.0", }, - ], - }, - ], - }, - { - keyword: "forOfLoops", - valid: [ - { - code: "for (;;);", - options: [{ version: "0.11.9" }], - }, - { - code: "for (a in b);", - options: [{ version: "0.11.9" }], - }, - { - code: "for (var a in b);", - options: [{ version: "0.11.9" }], - }, - { - code: "for (a of b);", - options: [{ version: "0.12.0" }], - }, - { - code: "for (var a of b);", - options: [{ version: "0.12.0" }], - }, - ], - invalid: [ - { - code: "for (a of b);", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "no-for-of-loops", - data: { supported: "0.12.0", version: "0.11.9" }, + }, + ], + }, + { + code: "a ??= b", + options: [{ version: "14.0.0" }], + errors: [ + { + messageId: "no-logical-assignment-operators", + data: { + supported: "15.0.0", + version: "14.0.0", }, - ], - }, - { - code: "for (var a of b);", - options: [{ version: "0.11.9" }], - errors: [ - { - messageId: "no-for-of-loops", - data: { supported: "0.12.0", version: "0.11.9" }, + }, + ], + }, + ], + }, + { + keyword: "numericSeparators", + requiredEcmaVersion: 2021, + valid: [ + { + code: "a = 123_456_789", + options: [{ version: "12.5.0" }], + }, + ], + invalid: [ + { + code: "a = 123_456_789", + options: [{ version: "12.4.0" }], + errors: [ + { + messageId: "no-numeric-separators", + data: { + supported: "12.5.0", + version: "12.4.0", }, - ], - }, - { - code: "async function wrap() { for await (var a of b); }", - options: [ - { - version: "0.11.9", - ignores: ["asyncFunctions", "asyncIteration"], - }, - ], - errors: [ - { - messageId: "no-for-of-loops", - data: { supported: "0.12.0", version: "0.11.9" }, - }, - ], - }, - ], - }, - { - keyword: "generators", - valid: [ - { - code: "function f() {}", - options: [{ version: "3.9.9" }], - }, - { - code: "async function f() {}", - options: [ - { version: "3.9.9", ignores: ["asyncFunctions"] }, - ], - }, - { - code: "function* f() {}", - options: [{ version: "4.0.0" }], - }, - { - code: "(function*() {})", - options: [{ version: "4.0.0" }], - }, - { - code: "({ *f() {} })", - options: [ - { version: "4.0.0", ignores: ["propertyShorthands"] }, - ], - }, - { - code: "class A { *f() {} }", - options: [{ version: "4.0.0", ignores: ["classes"] }], - }, - { - code: "(class { *f() {} })", - options: [{ version: "4.0.0", ignores: ["classes"] }], - }, - ], - invalid: [ - { - code: "function* f() {}", - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "no-generators", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - { - code: "(function*() {})", - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "no-generators", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - { - code: "({ *f() {} })", - options: [ - { version: "3.9.9", ignores: ["propertyShorthands"] }, - ], - errors: [ - { - messageId: "no-generators", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - { - code: "class A { *f() {} }", - options: [{ version: "3.9.9", ignores: ["classes"] }], - errors: [ - { - messageId: "no-generators", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - { - code: "(class { *f() {} })", - options: [{ version: "3.9.9", ignores: ["classes"] }], - errors: [ - { - messageId: "no-generators", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - ], - }, - { - keyword: "modules", - valid: [ - { - code: "require('a')", - options: [{ version: "0.0.0" }], - }, - { - code: "module.exports = {}", - options: [{ version: "0.0.0" }], - }, - { - code: "exports.a = {}", - options: [{ version: "0.0.0" }], - }, - { - code: "import a from 'a'", - languageOptions: { sourceType: "module" }, - options: [{ version: "13.1.0", ignores: ["modules"] }], - }, - { - code: "export default {}", - languageOptions: { sourceType: "module" }, - options: [{ version: "13.1.0", ignores: ["modules"] }], - }, - { - code: "export const a = {}", - languageOptions: { sourceType: "module" }, - options: [{ version: "13.1.0", ignores: ["modules"] }], - }, - { - code: "export {}", - languageOptions: { sourceType: "module" }, - options: [{ version: "13.1.0", ignores: ["modules"] }], - }, - ], - invalid: [ - { - code: "import a from 'a'", - languageOptions: { sourceType: "module" }, - options: [{ version: "10.0.0" }], - errors: [ - { - messageId: "no-modules", - data: { supported: null, version: "10.0.0" }, - }, - ], - }, - { - code: "export default {}", - languageOptions: { sourceType: "module" }, - options: [{ version: "10.0.0" }], - errors: [ - { - messageId: "no-modules", - data: { supported: null, version: "10.0.0" }, - }, - ], - }, - { - code: "export const a = {}", - languageOptions: { sourceType: "module" }, - options: [{ version: "10.0.0" }], - errors: [ - { - messageId: "no-modules", - data: { supported: null, version: "10.0.0" }, - }, - ], - }, - { - code: "export {}", - languageOptions: { sourceType: "module" }, - options: [{ version: "10.0.0" }], - errors: [ - { - messageId: "no-modules", - data: { supported: null, version: "10.0.0" }, - }, - ], - }, - ], - }, - { - keyword: "new.target", - valid: [ - { - code: "new target", - options: [{ version: "4.9.9" }], - }, - { - code: "class A { constructor() { new.target } }", - options: [{ version: "5.0.0", ignores: ["classes"] }], - }, - { - code: "function A() { new.target }", - options: [{ version: "5.0.0" }], - }, - ], - invalid: [ - { - code: "class A { constructor() { new.target } }", - options: [{ version: "4.9.9", ignores: ["classes"] }], - errors: [ - { - messageId: "no-new-target", - data: { supported: "5.0.0", version: "4.9.9" }, - }, - ], - }, - { - code: "function A() { new.target }", - options: [{ version: "4.9.9" }], - errors: [ - { - messageId: "no-new-target", - data: { supported: "5.0.0", version: "4.9.9" }, - }, - ], - }, - ], - }, - { - keyword: "objectSuperProperties", - valid: [ - { - code: "class A { foo() { super.foo } }", - options: [{ version: "3.9.9", ignores: ["classes"] }], - }, - { - code: "(class { foo() { super.foo } })", - options: [{ version: "3.9.9", ignores: ["classes"] }], - }, - { - code: "class A extends B { constructor() { super() } }", - options: [{ version: "3.9.9", ignores: ["classes"] }], - }, - { - code: "({ foo() { super.foo } })", - options: [ - { version: "4.0.0", ignores: ["propertyShorthands"] }, - ], - }, - { - code: "({ foo() { super.foo() } })", - options: [ - { version: "4.0.0", ignores: ["propertyShorthands"] }, - ], - }, - ], - invalid: [ - { - code: "({ foo() { super.foo } })", - options: [ - { version: "3.9.9", ignores: ["propertyShorthands"] }, - ], - errors: [ - { - messageId: "no-object-super-properties", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - { - code: "({ foo() { super.foo() } })", - options: [ - { version: "3.9.9", ignores: ["propertyShorthands"] }, - ], - errors: [ - { - messageId: "no-object-super-properties", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - ], - }, - { - keyword: "octalNumericLiterals", - valid: [ - { - code: "0755", - options: [{ version: "3.9.9" }], - }, - { - code: "0x755", - options: [{ version: "3.9.9" }], - }, - { - code: "0X755", - options: [{ version: "3.9.9" }], - }, - { - code: "0b01", - options: [ - { - version: "3.9.9", - ignores: ["binaryNumericLiterals"], - }, - ], - }, - { - code: "0B01", - options: [ - { - version: "3.9.9", - ignores: ["binaryNumericLiterals"], - }, - ], - }, - { - code: "0o755", - options: [{ version: "4.0.0" }], - }, - { - code: "0O755", - options: [{ version: "4.0.0" }], - }, - ], - invalid: [ - { - code: "0o755", - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "no-octal-numeric-literals", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - { - code: "0O755", - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "no-octal-numeric-literals", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - ], - }, - { - keyword: "propertyShorthands", - valid: [ - { - code: "({ a: 1 })", - options: [{ version: "3.9.9" }], - }, - { - code: "({ get: get })", - options: [{ version: "3.9.9" }], - }, - { - code: "({ get a() {} })", - options: [{ version: "3.9.9" }], - }, - { - code: "({ a })", - options: [{ version: "4.0.0" }], - }, - { - code: "({ b() {} })", - options: [{ version: "4.0.0" }], - }, - { - code: "({ get() {} })", - options: [{ version: "4.0.0" }], - }, - { - code: "({ [c]() {} })", - options: [ - { version: "4.0.0", ignores: ["computedProperties"] }, - ], - }, - { - code: "({ get })", - options: [{ version: "6.0.0" }], - }, - { - code: "({ set })", - options: [{ version: "6.0.0" }], - }, - ], - invalid: [ - { - code: "({ a })", - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "no-property-shorthands", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - { - code: "({ b() {} })", - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "no-property-shorthands", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - { - code: "({ [c]() {} })", - options: [ - { version: "3.9.9", ignores: ["computedProperties"] }, - ], - errors: [ - { - messageId: "no-property-shorthands", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - { - code: "({ get })", - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "no-property-shorthands-getset", - data: { supported: "6.0.0", version: "3.9.9" }, - }, - ], - }, - { - code: "({ set })", - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "no-property-shorthands-getset", - data: { supported: "6.0.0", version: "3.9.9" }, - }, - ], - }, - { - code: "({ get })", - options: [{ version: "5.9.9" }], - errors: [ - { - messageId: "no-property-shorthands-getset", - data: { supported: "6.0.0", version: "5.9.9" }, - }, - ], - }, - { - code: "({ set })", - options: [{ version: "5.9.9" }], - errors: [ - { - messageId: "no-property-shorthands-getset", - data: { supported: "6.0.0", version: "5.9.9" }, - }, - ], - }, - ], - }, - { - keyword: "regexpU", - valid: [ - { - code: "/foo/", - options: [{ version: "5.9.9" }], - }, - { - code: "/foo/gmi", - options: [{ version: "5.9.9" }], - }, - { - code: "/foo/y", - options: [{ version: "5.9.9", ignores: ["regexpY"] }], - }, - { - code: "/foo/u", - options: [{ version: "6.0.0" }], - }, - ], - invalid: [ - { - code: "/foo/u", - options: [{ version: "5.9.9" }], - errors: [ - { - messageId: "no-regexp-u-flag", - data: { supported: "6.0.0", version: "5.9.9" }, - }, - ], - }, - ], - }, - { - keyword: "regexpY", - valid: [ - { - code: "/foo/", - options: [{ version: "5.9.9" }], - }, - { - code: "/foo/gmi", - options: [{ version: "5.9.9" }], - }, - { - code: "/foo/u", - options: [{ version: "5.9.9", ignores: ["regexpU"] }], - }, - { - code: "/foo/y", - options: [{ version: "6.0.0" }], - }, - ], - invalid: [ - { - code: "/foo/y", - options: [{ version: "5.9.9" }], - errors: [ - { - messageId: "no-regexp-y-flag", - data: { supported: "6.0.0", version: "5.9.9" }, - }, - ], - }, - ], - }, - { - keyword: "restParameters", - valid: [ - { - code: "var [...a] = b", - options: [{ version: "5.9.9", ignores: ["destructuring"] }], - }, - { - code: "var {...a} = b", - options: [ - { - version: "5.9.9", - ignores: ["destructuring", "restSpreadProperties"], - }, - ], - }, - { - code: "var a = [...b]", - options: [{ version: "5.9.9" }], - }, - { - code: "var a = {...b}", - options: [ - { version: "5.9.9", ignores: ["restSpreadProperties"] }, - ], - }, - { - code: "f(...a)", - options: [{ version: "5.9.9" }], - }, - { - code: "function f(...a) {}", - options: [{ version: "6.0.0" }], - }, - { - code: "function f(...[a, b = 0]) {}", - options: [{ version: "6.0.0", ignores: ["destructuring"] }], - }, - { - code: "(function(...a) {})", - options: [{ version: "6.0.0" }], - }, - { - code: "((...a) => {})", - options: [{ version: "6.0.0" }], - }, - { - code: "({ f(...a) {} })", - options: [{ version: "6.0.0" }], - }, - { - code: "class A { f(...a) {} }", - options: [{ version: "6.0.0", ignores: ["classes"] }], - }, - { - code: "(class { f(...a) {} })", - options: [{ version: "6.0.0", ignores: ["classes"] }], - }, - ], - invalid: [ - { - code: "function f(...a) {}", - options: [{ version: "5.9.9" }], - errors: [ - { - messageId: "no-rest-parameters", - data: { supported: "6.0.0", version: "5.9.9" }, - }, - ], - }, - { - code: "function f(...[a, b = 0]) {}", - options: [{ version: "5.9.9", ignores: ["destructuring"] }], - errors: [ - { - messageId: "no-rest-parameters", - data: { supported: "6.0.0", version: "5.9.9" }, - }, - ], - }, - { - code: "(function(...a) {})", - options: [{ version: "5.9.9" }], - errors: [ - { - messageId: "no-rest-parameters", - data: { supported: "6.0.0", version: "5.9.9" }, - }, - ], - }, - { - code: "((...a) => {})", - options: [{ version: "5.9.9" }], - errors: [ - { - messageId: "no-rest-parameters", - data: { supported: "6.0.0", version: "5.9.9" }, - }, - ], - }, - { - code: "({ f(...a) {} })", - options: [{ version: "5.9.9" }], - errors: [ - { - messageId: "no-rest-parameters", - data: { supported: "6.0.0", version: "5.9.9" }, - }, - ], - }, - { - code: "class A { f(...a) {} }", - options: [{ version: "5.9.9", ignores: ["classes"] }], - errors: [ - { - messageId: "no-rest-parameters", - data: { supported: "6.0.0", version: "5.9.9" }, - }, - ], - }, - { - code: "(class { f(...a) {} })", - options: [{ version: "5.9.9", ignores: ["classes"] }], - errors: [ - { - messageId: "no-rest-parameters", - data: { supported: "6.0.0", version: "5.9.9" }, - }, - ], - }, - ], - }, - { - keyword: "spreadElements", - valid: [ - { - code: "var [...a] = b", - options: [{ version: "4.9.9", ignores: ["destructuring"] }], - }, - { - code: "var {...a} = b", - options: [ - { - version: "4.9.9", - ignores: ["destructuring", "restSpreadProperties"], - }, - ], - }, - { - code: "var a = {...b}", - options: [ - { - version: "4.9.9", - ignores: ["restSpreadProperties"], - }, - ], - }, - { - code: "function f(...a) {}", - options: [ - { version: "4.9.9", ignores: ["restParameters"] }, - ], - }, - { - code: "[...a]", - options: [{ version: "5.0.0" }], - }, - { - code: "[...a, ...b]", - options: [{ version: "5.0.0" }], - }, - { - code: "f(...a)", - options: [{ version: "5.0.0" }], - }, - { - code: "new F(...a)", - options: [{ version: "5.0.0" }], - }, - ], - invalid: [ - { - code: "[...a]", - options: [{ version: "4.9.9" }], - errors: [ - { - messageId: "no-spread-elements", - data: { supported: "5.0.0", version: "4.9.9" }, - }, - ], - }, - { - code: "[...a, ...b]", - options: [{ version: "4.9.9" }], - errors: [ - { - messageId: "no-spread-elements", - data: { supported: "5.0.0", version: "4.9.9" }, - }, - { - messageId: "no-spread-elements", - data: { supported: "5.0.0", version: "4.9.9" }, - }, - ], - }, - { - code: "f(...a)", - options: [{ version: "4.9.9" }], - errors: [ - { - messageId: "no-spread-elements", - data: { supported: "5.0.0", version: "4.9.9" }, - }, - ], - }, - { - code: "new F(...a)", - options: [{ version: "4.9.9" }], - errors: [ - { - messageId: "no-spread-elements", - data: { supported: "5.0.0", version: "4.9.9" }, - }, - ], - }, - ], - }, - { - keyword: "templateLiterals", - valid: [ - { - code: "'`foo`'", - options: [{ version: "3.9.9" }], - }, - { - code: "`foo`", - options: [{ version: "4.0.0" }], - }, - { - code: "`foo${a}bar`", - options: [{ version: "4.0.0" }], - }, - { - code: "tag`foo`", - options: [{ version: "4.0.0" }], - }, - { - code: "tag`foo${a}bar`", - options: [{ version: "4.0.0" }], - }, - ], - invalid: [ - { - code: "`foo`", - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "no-template-literals", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - { - code: "`foo${a}bar`", - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "no-template-literals", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - { - code: "tag`foo`", - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "no-template-literals", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - { - code: "tag`foo${a}bar`", - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "no-template-literals", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - ], - }, - { - keyword: "unicodeCodePointEscapes", - valid: [ - { - code: String.raw`var a = "\x61"`, - options: [{ version: "3.9.9" }], - }, - { - code: String.raw`var a = "\u0061"`, - options: [{ version: "3.9.9" }], - }, - { - code: String.raw`var a = "\\u{61}"`, - options: [{ version: "3.9.9" }], - }, - { - code: String.raw`var \u{61} = 0`, - options: [{ version: "4.0.0" }], - }, - { - code: String.raw`var a = "\u{61}"`, - options: [{ version: "4.0.0" }], - }, - { - code: String.raw`var a = '\u{61}'`, - options: [{ version: "4.0.0" }], - }, - { - code: "var a = `\\u{61}`", - options: [{ version: "4.0.0" }], - }, - ], - invalid: [ - { - code: String.raw`var \u{61} = 0`, - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "no-unicode-codepoint-escapes", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - { - code: String.raw`var a = "\u{61}"`, - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "no-unicode-codepoint-escapes", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - { - code: String.raw`var a = "\\\u{61}"`, - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "no-unicode-codepoint-escapes", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - { - code: String.raw`var a = '\u{61}'`, - options: [{ version: "3.9.9" }], - errors: [ - { - messageId: "no-unicode-codepoint-escapes", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - { - code: "var a = `\\u{61}`", - options: [ - { version: "3.9.9", ignores: ["templateLiterals"] }, - ], - errors: [ - { - messageId: "no-unicode-codepoint-escapes", - data: { supported: "4.0.0", version: "3.9.9" }, - }, - ], - }, - ], - }, - - //---------------------------------------------------------------------- - // ES2016 - //---------------------------------------------------------------------- - { - keyword: "exponentialOperators", - valid: [ - { - code: "a ** b", - options: [{ version: "7.0.0" }], - }, - { - code: "a **= b", - options: [{ version: "7.0.0" }], - }, - { - code: "a * b", - options: [{ version: "6.9.9" }], - }, - { - code: "a *= b", - options: [{ version: "6.9.9" }], - }, - ], - invalid: [ - { - code: "a ** b", - options: [{ version: "6.9.9" }], - errors: [ - { - messageId: "no-exponential-operators", - data: { supported: "7.0.0", version: "6.9.9" }, - }, - ], - }, - { - code: "a **= b", - options: [{ version: "6.9.9" }], - errors: [ - { - messageId: "no-exponential-operators", - data: { supported: "7.0.0", version: "6.9.9" }, - }, - ], - }, - ], - }, - - //---------------------------------------------------------------------- - // ES2017 - //---------------------------------------------------------------------- - { - keyword: "asyncFunctions", - valid: [ - { - code: "async function f() {}", - options: [{ version: "7.6.0" }], - }, - { - code: "async function f() { await 1 }", - options: [{ version: "7.6.0" }], - }, - { - code: "(async function() { await 1 })", - options: [{ version: "7.6.0" }], - }, - { - code: "(async() => { await 1 })", - options: [{ version: "7.6.0" }], - }, - { - code: "({ async method() { await 1 } })", - options: [{ version: "7.6.0" }], - }, - { - code: "class A { async method() { await 1 } }", - options: [{ version: "7.6.0" }], - }, - { - code: "(class { async method() { await 1 } })", - options: [{ version: "7.6.0" }], - }, - ], - invalid: [ - { - code: "async function f() {}", - options: [{ version: "7.5.9" }], - errors: [ - { - messageId: "no-async-functions", - data: { supported: "7.6.0", version: "7.5.9" }, - }, - ], - }, - { - code: "async function f() { await 1 }", - options: [{ version: "7.5.9" }], - errors: [ - { - messageId: "no-async-functions", - data: { supported: "7.6.0", version: "7.5.9" }, - }, - ], - }, - { - code: "(async function() { await 1 })", - options: [{ version: "7.5.9" }], - errors: [ - { - messageId: "no-async-functions", - data: { supported: "7.6.0", version: "7.5.9" }, - }, - ], - }, - { - code: "(async() => { await 1 })", - options: [{ version: "7.5.9" }], - errors: [ - { - messageId: "no-async-functions", - data: { supported: "7.6.0", version: "7.5.9" }, - }, - ], - }, - { - code: "({ async method() { await 1 } })", - options: [{ version: "7.5.9" }], - errors: [ - { - messageId: "no-async-functions", - data: { supported: "7.6.0", version: "7.5.9" }, - }, - ], - }, - { - code: "class A { async method() { await 1 } }", - options: [{ version: "7.5.9" }], - errors: [ - { - messageId: "no-async-functions", - data: { supported: "7.6.0", version: "7.5.9" }, - }, - ], - }, - { - code: "(class { async method() { await 1 } })", - options: [{ version: "7.5.9" }], - errors: [ - { - messageId: "no-async-functions", - data: { supported: "7.6.0", version: "7.5.9" }, - }, - ], - }, - ], - }, - { - keyword: "trailingCommasInFunctions", - valid: [ - { - code: "function f(a,) {}", - options: [{ version: "8.0.0" }], - }, - { - code: "(function(a,) {})", - options: [{ version: "8.0.0" }], - }, - { - code: "((a,) => {})", - options: [{ version: "8.0.0" }], - }, - { - code: "({ method(a,) {} })", - options: [{ version: "8.0.0" }], - }, - { - code: "class A { method(a,) {} }", - options: [{ version: "8.0.0" }], - }, - { - code: "(class { method(a,) {} })", - options: [{ version: "8.0.0" }], - }, - { - code: "f(1,)", - options: [{ version: "8.0.0" }], - }, - { - code: "new A(1,)", - options: [{ version: "8.0.0" }], - }, - ], - invalid: [ - { - code: "function f(a,) {}", - options: [{ version: "7.9.9" }], - errors: [ - { - messageId: "no-trailing-function-commas", - data: { supported: "8.0.0", version: "7.9.9" }, - }, - ], - }, - { - code: "(function(a,) {})", - options: [{ version: "7.9.9" }], - errors: [ - { - messageId: "no-trailing-function-commas", - data: { supported: "8.0.0", version: "7.9.9" }, - }, - ], - }, - { - code: "((a,) => {})", - options: [{ version: "7.9.9" }], - errors: [ - { - messageId: "no-trailing-function-commas", - data: { supported: "8.0.0", version: "7.9.9" }, - }, - ], - }, - { - code: "({ method(a,) {} })", - options: [{ version: "7.9.9" }], - errors: [ - { - messageId: "no-trailing-function-commas", - data: { supported: "8.0.0", version: "7.9.9" }, - }, - ], - }, - { - code: "class A { method(a,) {} }", - options: [{ version: "7.9.9" }], - errors: [ - { - messageId: "no-trailing-function-commas", - data: { supported: "8.0.0", version: "7.9.9" }, - }, - ], - }, - { - code: "(class { method(a,) {} })", - options: [{ version: "7.9.9" }], - errors: [ - { - messageId: "no-trailing-function-commas", - data: { supported: "8.0.0", version: "7.9.9" }, - }, - ], - }, - { - code: "f(1,)", - options: [{ version: "7.9.9" }], - errors: [ - { - messageId: "no-trailing-function-commas", - data: { supported: "8.0.0", version: "7.9.9" }, - }, - ], - }, - { - code: "new A(1,)", - options: [{ version: "7.9.9" }], - errors: [ - { - messageId: "no-trailing-function-commas", - data: { supported: "8.0.0", version: "7.9.9" }, - }, - ], - }, - ], - }, - - //---------------------------------------------------------------------- - // ES2018 - //---------------------------------------------------------------------- - { - keyword: "asyncIteration", - valid: [ - { - code: "async function f() { for await (const x of xs) {} }", - options: [{ version: "10.0.0" }], - }, - { - code: "async function* f() { }", - options: [{ version: "10.0.0" }], - }, - { - code: "(async function* () { })", - options: [{ version: "10.0.0" }], - }, - { - code: "({ async* method() { } })", - options: [{ version: "10.0.0" }], - }, - { - code: "class A { async* method() { } }", - options: [{ version: "10.0.0" }], - }, - { - code: "(class { async* method() { } })", - options: [{ version: "10.0.0" }], - }, - { - code: "function f() { for (const x of xs) {} }", - options: [{ version: "9.9.9" }], - }, - { - code: "async function f() { }", - options: [{ version: "9.9.9" }], - }, - { - code: "function* f() { }", - options: [{ version: "9.9.9" }], - }, - ], - invalid: [ - { - code: "async function f() { for await (const x of xs) {} }", - options: [{ version: "9.9.9" }], - errors: [ - { - messageId: "no-async-iteration", - data: { supported: "10.0.0", version: "9.9.9" }, - }, - ], - }, - { - code: "async function* f() { }", - options: [{ version: "9.9.9" }], - errors: [ - { - messageId: "no-async-iteration", - data: { supported: "10.0.0", version: "9.9.9" }, - }, - ], - }, - { - code: "(async function* () { })", - options: [{ version: "9.9.9" }], - errors: [ - { - messageId: "no-async-iteration", - data: { supported: "10.0.0", version: "9.9.9" }, - }, - ], - }, - { - code: "({ async* method() { } })", - options: [{ version: "9.9.9" }], - errors: [ - { - messageId: "no-async-iteration", - data: { supported: "10.0.0", version: "9.9.9" }, - }, - ], - }, - { - code: "class A { async* method() { } }", - options: [{ version: "9.9.9" }], - errors: [ - { - messageId: "no-async-iteration", - data: { supported: "10.0.0", version: "9.9.9" }, - }, - ], - }, - { - code: "(class { async* method() { } })", - options: [{ version: "9.9.9" }], - errors: [ - { - messageId: "no-async-iteration", - data: { supported: "10.0.0", version: "9.9.9" }, - }, - ], - }, - ], - }, - { - keyword: "malformedTemplateLiterals", - valid: [ - { - code: "tag`\\unicode`", - options: [{ version: "8.10.0" }], - }, - ], - invalid: [ - { - code: "tag`\\unicode`", - options: [{ version: "8.9.9" }], - errors: [ - { - messageId: "no-malformed-template-literals", - data: { supported: "8.10.0", version: "8.9.9" }, - }, - ], - }, - ], - }, - { - keyword: "regexpLookbehind", - valid: [ - { - code: "var a = /(?<=a)foo/", - options: [{ version: "8.10.0" }], - }, - { - code: "var a = /(?a)foo/", - options: [{ version: "10.0.0" }], - }, - { - code: "var a = /(?a)\\k/", - options: [{ version: "10.0.0" }], - }, - { - code: 'var a = new RegExp("(?a)foo")', - options: [{ version: "10.0.0" }], - }, - { - code: "var a = new RegExp(pattern)", - options: [{ version: "8.9.9" }], - }, - { - code: 'var a = new RegExp("(?a\\)foo/", - options: [{ version: "8.9.9" }], - }, - ], - invalid: [ - { - code: "var a = /(?a)foo/", - options: [{ version: "9.9.9" }], - errors: [ - { - messageId: "no-regexp-named-capture-groups", - data: { supported: "10.0.0", version: "9.9.9" }, - }, - ], - }, - { - code: "var a = /(?a)\\k/", - options: [{ version: "9.9.9" }], - errors: [ - { - messageId: "no-regexp-named-capture-groups", - data: { supported: "10.0.0", version: "9.9.9" }, - }, - ], - }, - { - code: 'var a = new RegExp("(?a)foo")', - options: [{ version: "9.9.9" }], - errors: [ - { - messageId: "no-regexp-named-capture-groups", - data: { supported: "10.0.0", version: "9.9.9" }, - }, - ], - }, - ], - }, - { - keyword: "regexpS", - valid: [ - { - code: "var a = /foo/s", - options: [{ version: "8.10.0" }], - }, - { - code: 'var a = new RegExp("foo", "s")', - options: [{ version: "8.10.0" }], - }, - { - code: "var a = new RegExp(a, b)", - options: [{ version: "8.9.9" }], - }, - { - code: 'var a = new RegExp("(aaaaa", b)', - options: [{ version: "8.9.9" }], - }, - ], - invalid: [ - { - code: "var a = /foo/s", - options: [{ version: "8.9.9" }], - errors: [ - { - messageId: "no-regexp-s-flag", - data: { supported: "8.10.0", version: "8.9.9" }, - }, - ], - }, - { - code: 'var a = new RegExp("foo", "s")', - options: [{ version: "8.9.9" }], - errors: [ - { - messageId: "no-regexp-s-flag", - data: { supported: "8.10.0", version: "8.9.9" }, - }, - ], - }, - ], - }, - { - keyword: "regexpUnicodeProperties", - valid: [ - { - code: "var a = /\\p{Letter}/u", - options: [{ version: "10.0.0" }], - }, - { - code: "var a = /\\P{Letter}/u", - options: [{ version: "10.0.0" }], - }, - { - code: 'var a = new RegExp("\\\\p{Letter}", "u")', - options: [{ version: "10.0.0" }], - }, - { - code: 'var a = new RegExp("\\\\p{Letter}")', - options: [{ version: "9.9.9" }], - }, - { - code: 'var a = new RegExp(pattern, "u")', - options: [{ version: "9.9.9" }], - }, - { - code: 'var a = new RegExp("\\\\p{Letter")', - options: [{ version: "9.9.9" }], - }, - ], - invalid: [ - { - code: "var a = /\\p{Letter}/u", - options: [{ version: "9.9.9" }], - errors: [ - { - messageId: "no-regexp-unicode-property-escapes", - data: { supported: "10.0.0", version: "9.9.9" }, - }, - ], - }, - { - code: "var a = /\\P{Letter}/u", - options: [{ version: "9.9.9" }], - errors: [ - { - messageId: "no-regexp-unicode-property-escapes", - data: { supported: "10.0.0", version: "9.9.9" }, - }, - ], - }, - { - code: 'var a = new RegExp("\\\\p{Letter}", "u")', - options: [{ version: "9.9.9" }], - errors: [ - { - messageId: "no-regexp-unicode-property-escapes", - data: { supported: "10.0.0", version: "9.9.9" }, - }, - ], - }, - ], - }, - { - keyword: "restSpreadProperties", - valid: [ - { - code: "({ ...obj })", - options: [{ version: "8.3.0" }], - }, - { - code: "({ ...rest } = obj)", - options: [{ version: "8.3.0" }], - }, - { - code: "({ obj })", - options: [{ version: "8.2.9" }], - }, - { - code: "({ obj: 1 })", - options: [{ version: "8.2.9" }], - }, - { - code: "({ obj } = a)", - options: [{ version: "8.2.9" }], - }, - { - code: "({ obj: a } = b)", - options: [{ version: "8.2.9" }], - }, - { - code: "([...xs])", - options: [{ version: "8.2.9" }], - }, - { - code: "([a, ...xs] = ys)", - options: [{ version: "8.2.9" }], - }, - ], - invalid: [ - { - code: "({ ...obj })", - options: [{ version: "8.2.9" }], - errors: [ - { - messageId: "no-rest-spread-properties", - data: { supported: "8.3.0", version: "8.2.9" }, - }, - ], - }, - { - code: "({ ...rest } = obj)", - options: [{ version: "8.2.9" }], - errors: [ - { - messageId: "no-rest-spread-properties", - data: { supported: "8.3.0", version: "8.2.9" }, - }, - ], - }, - ], - }, - - //---------------------------------------------------------------------- - // ES2019 - //---------------------------------------------------------------------- - { - keyword: "jsonSuperset", - valid: [ - { - code: "var s = 'foo'", - options: [{ version: "9.99.99" }], - }, - { - code: "var s = '\\\u2028'", - options: [{ version: "9.99.99" }], - }, - { - code: "var s = '\\\u2029'", - options: [{ version: "9.99.99" }], - }, - { - code: "var s = '\u2028'", - options: [{ version: "10.0.0" }], - }, - { - code: "var s = '\u2029'", - options: [{ version: "10.0.0" }], - }, - ], - invalid: [ - { - code: "var s = '\u2028'", - options: [{ version: "9.99.99" }], - errors: [ - { - messageId: "no-json-superset", - data: { - code: "2028", - supported: "10.0.0", - version: "9.99.99", - }, - }, - ], - }, - { - code: "var s = '\u2029'", - options: [{ version: "9.99.99" }], - errors: [ - { - messageId: "no-json-superset", - data: { - code: "2029", - supported: "10.0.0", - version: "9.99.99", - }, - }, - ], - }, - ], - }, - { - keyword: "optionalCatchBinding", - valid: [ - { - code: "try {} catch {}", - options: [{ version: "10.0.0" }], - }, - { - code: "try {} catch (error) {}", - options: [{ version: "9.99.99" }], - }, - ], - invalid: [ - { - code: "try {} catch {}", - options: [{ version: "9.99.99" }], - errors: [ - { - messageId: "no-optional-catch-binding", - data: { supported: "10.0.0", version: "9.99.99" }, - }, - ], - }, - ], - }, - - //---------------------------------------------------------------------- - // ES2020 - //---------------------------------------------------------------------- - { - keyword: "bigint", - requiredEcmaVersion: 2020, - valid: [ - { - code: "var n = 0n", - options: [{ version: "10.4.0" }], - }, - { - code: "var n = BigInt(0)", - options: [{ version: "10.3.0" }], - }, - { - code: "var n = new BigInt64Array()", - options: [{ version: "10.3.0" }], - }, - { - code: "var n = new BigUint64Array()", - options: [{ version: "10.3.0" }], - }, - { - code: "var n = { [0n]: 0 }", - options: [{ version: "10.4.0" }], - }, - { - code: "var n = class { [0n]() {} }", - options: [{ version: "10.4.0" }], - }, - ], - invalid: [ - { - code: "var n = 0n", - options: [{ version: "10.3.0" }], - errors: [ - { - messageId: "no-bigint", - data: { - supported: "10.4.0", - version: "10.3.0", - }, - }, - ], - }, - { - code: "var n = { 0n: 0 }", - options: [{ version: "12.0.0" }], - errors: [ - { - messageId: "no-bigint-property-names", - data: { - supported: null, - version: "12.0.0", - }, - }, - ], - }, - { - code: "var n = class { 0n() {} }", - options: [{ version: "12.0.0" }], - errors: [ - { - messageId: "no-bigint-property-names", - data: { - supported: null, - version: "12.0.0", - }, - }, - ], - }, - ], - }, - { - keyword: "dynamicImport", - requiredEcmaVersion: 2020, - valid: [ - { - code: "obj.import(source)", - options: [{ version: "12.0.0" }], - }, - ...["12.17.0", "13.2.0"].map(v => ({ - code: "import(source)", - options: [{ version: v }], - })), - ], - invalid: [ - ...["12.16.0", "13.0.0", "13.1.0", ">=8.0.0"].map(v => ({ - code: "import(source)", - options: [{ version: v }], - errors: [ - { - messageId: "no-dynamic-import", - data: { - supported: new Range( - ">=12.17 <13 || >=13.2" - ).toString(), - version: v, - }, - }, - ], - })), - ], - }, - { - keyword: "optionalChaining", - requiredEcmaVersion: 2020, - valid: [ - { - code: "foo?.bar;", - options: [{ version: "14.0.0" }], - }, - ], - invalid: [ - { - code: "foo?.bar", - options: [{ version: "13.0.0" }], - errors: [ - { - messageId: "no-optional-chaining", - data: { - supported: "14.0.0", - version: "13.0.0", - }, - }, - ], - }, - ], - }, - { - keyword: "nullishCoalescingOperators", - requiredEcmaVersion: 2020, - valid: [ - { - code: "foo ?? bar;", - options: [{ version: "14.0.0" }], - }, - { - code: "foo ?? bar;", - settings: { - node: { version: "14.0.0" }, }, - }, - ], - invalid: [ - { - code: "foo ?? bar", - options: [{ version: "13.0.0" }], - errors: [ - { - messageId: "no-nullish-coalescing-operators", - data: { - supported: "14.0.0", - version: "13.0.0", - }, - }, - ], - }, - { - code: "foo ?? bar", - settings: { - node: { version: "13.0.0" }, - }, - errors: [ - { - messageId: "no-nullish-coalescing-operators", - data: { - supported: "14.0.0", - version: "13.0.0", - }, - }, - ], - }, - ], - }, - - //---------------------------------------------------------------------- - // ES2021 - //---------------------------------------------------------------------- - { - keyword: "logicalAssignmentOperators", - requiredEcmaVersion: 2021, - valid: [ - { - code: "a ||= b", - options: [{ version: "15.0.0" }], - }, - { - code: "a &&= b", - options: [{ version: "15.0.0" }], - }, - { - code: "a ??= b", - options: [{ version: "15.0.0" }], - }, - ], - invalid: [ - { - code: "a ||= b", - options: [{ version: "14.0.0" }], - errors: [ - { - messageId: "no-logical-assignment-operators", - data: { - supported: "15.0.0", - version: "14.0.0", - }, - }, - ], - }, - { - code: "a &&= b", - options: [{ version: "14.0.0" }], - errors: [ - { - messageId: "no-logical-assignment-operators", - data: { - supported: "15.0.0", - version: "14.0.0", - }, - }, - ], - }, - { - code: "a ??= b", - options: [{ version: "14.0.0" }], - errors: [ - { - messageId: "no-logical-assignment-operators", - data: { - supported: "15.0.0", - version: "14.0.0", - }, - }, - ], - }, - ], - }, - { - keyword: "numericSeparators", - requiredEcmaVersion: 2021, - valid: [ - { - code: "a = 123_456_789", - options: [{ version: "12.5.0" }], - }, - ], - invalid: [ - { - code: "a = 123_456_789", - options: [{ version: "12.4.0" }], - errors: [ - { - messageId: "no-numeric-separators", - data: { - supported: "12.5.0", - version: "12.4.0", - }, - }, - ], - }, - ], - }, - //---------------------------------------------------------------------- - // MISC - //---------------------------------------------------------------------- - { - keywords: [], - valid: [ - { - filename: fixture("gte-4.0.0/a.js"), - code: "var a = () => 1", - }, - { - filename: fixture("gte-4.4.0-lt-5.0.0/a.js"), - code: "var a = () => 1", - }, - { - filename: fixture("hat-4.1.2/a.js"), - code: "var a = () => 1", - }, - { - code: "'\\\\u{0123}'", - }, - { - filename: fixture("gte-4.0.0/a.js"), - code: "var a = async () => 1", - options: [{ ignores: ["asyncFunctions"] }], - }, - { - filename: fixture("gte-7.6.0/a.js"), - code: "var a = async () => 1", - }, - { - filename: fixture("gte-7.10.0/a.js"), - code: "var a = async () => 1", - }, - { - filename: fixture("invalid/a.js"), - code: "var a = () => 1", - }, - { - filename: fixture("nothing/a.js"), - code: "var a = () => 1", - }, - { - code: "var a = async () => 1", - options: [{ version: "7.10.0" }], - }, - { - code: "var a = async () => 1", - settings: { - node: { version: "7.10.0" }, + ], + }, + ], + }, + //---------------------------------------------------------------------- + // MISC + //---------------------------------------------------------------------- + { + keywords: [], + valid: [ + { + filename: fixture("gte-4.0.0/a.js"), + code: "var a = () => 1", + }, + { + filename: fixture("gte-4.4.0-lt-5.0.0/a.js"), + code: "var a = () => 1", + }, + { + filename: fixture("hat-4.1.2/a.js"), + code: "var a = () => 1", + }, + { + code: "'\\\\u{0123}'", + }, + { + filename: fixture("gte-4.0.0/a.js"), + code: "var a = async () => 1", + options: [{ ignores: ["asyncFunctions"] }], + }, + { + filename: fixture("gte-7.6.0/a.js"), + code: "var a = async () => 1", + }, + { + filename: fixture("gte-7.10.0/a.js"), + code: "var a = async () => 1", + }, + { + filename: fixture("invalid/a.js"), + code: "var a = () => 1", + }, + { + filename: fixture("nothing/a.js"), + code: "var a = () => 1", + }, + { + code: "var a = async () => 1", + options: [{ version: "7.10.0" }], + }, + { + code: "var a = async () => 1", + settings: { + node: { version: "7.10.0" }, + }, + }, + { + filename: fixture("without-node/a.js"), + code: "var a = () => 1", + }, + ], + invalid: [ + { + filename: fixture("gte-0.12.8/a.js"), + code: "var a = () => 1", + errors: [ + { + messageId: "no-arrow-functions", + data: { supported: "4.0.0", version: ">=0.12.8" }, }, - }, - { - filename: fixture("without-node/a.js"), - code: "var a = () => 1", - }, - ], - invalid: [ - { - filename: fixture("gte-0.12.8/a.js"), - code: "var a = () => 1", - errors: [ - { - messageId: "no-arrow-functions", - data: { supported: "4.0.0", version: ">=0.12.8" }, - }, - ], - }, - { - filename: fixture("invalid/a.js"), - code: "var a = { ...obj }", - options: [{ version: ">=8.0.0" }], - errors: [ - { - messageId: "no-rest-spread-properties", - data: { supported: "8.3.0", version: ">=8.0.0" }, - }, - ], - }, - { - filename: fixture("lt-6.0.0/a.js"), - code: "var a = () => 1", - errors: [ - { - messageId: "no-arrow-functions", - data: { supported: "4.0.0", version: "<6.0.0" }, - }, - ], - }, - { - filename: fixture("nothing/a.js"), - code: "var a = { ...obj }", - options: [{ version: ">=8.0.0" }], - errors: [ - { - messageId: "no-rest-spread-properties", - data: { supported: "8.3.0", version: ">=8.0.0" }, - }, - ], - }, - { - filename: fixture("gte-7.5.0/a.js"), - code: "var a = async () => 1", - errors: [ - { - messageId: "no-async-functions", - data: { supported: "7.6.0", version: ">=7.5.0" }, - }, - ], - }, - { - filename: fixture("star/a.js"), - code: '"use strict"; let a = 1', - errors: [ - { - messageId: "no-block-scoped-variables-strict", - data: { supported: "4.0.0", version: "*" }, - }, - ], - }, - { - code: "var a = async () => 1", - options: [{ version: "7.1.0" }], - errors: [ - { - messageId: "no-async-functions", - data: { supported: "7.6.0", version: "7.1.0" }, - }, - ], - }, - { - code: "var a = async () => 1", - settings: { - node: { version: "7.1.0" }, - }, - errors: [ - { - messageId: "no-async-functions", - data: { supported: "7.6.0", version: "7.1.0" }, - }, - ], - }, - ], - }, - ]) -) + ], + }, + { + filename: fixture("invalid/a.js"), + code: "var a = { ...obj }", + options: [{ version: ">=8.0.0" }], + errors: [ + { + messageId: "no-rest-spread-properties", + data: { supported: "8.3.0", version: ">=8.0.0" }, + }, + ], + }, + { + filename: fixture("lt-6.0.0/a.js"), + code: "var a = () => 1", + errors: [ + { + messageId: "no-arrow-functions", + data: { supported: "4.0.0", version: "<6.0.0" }, + }, + ], + }, + { + filename: fixture("nothing/a.js"), + code: "var a = { ...obj }", + options: [{ version: ">=8.0.0" }], + errors: [ + { + messageId: "no-rest-spread-properties", + data: { supported: "8.3.0", version: ">=8.0.0" }, + }, + ], + }, + { + filename: fixture("gte-7.5.0/a.js"), + code: "var a = async () => 1", + errors: [ + { + messageId: "no-async-functions", + data: { supported: "7.6.0", version: ">=7.5.0" }, + }, + ], + }, + { + filename: fixture("star/a.js"), + code: '"use strict"; let a = 1', + errors: [ + { + messageId: "no-block-scoped-variables-strict", + data: { supported: "4.0.0", version: "*" }, + }, + ], + }, + { + code: "var a = async () => 1", + options: [{ version: "7.1.0" }], + errors: [ + { + messageId: "no-async-functions", + data: { supported: "7.6.0", version: "7.1.0" }, + }, + ], + }, + { + code: "var a = async () => 1", + settings: { + node: { version: "7.1.0" }, + }, + errors: [ + { + messageId: "no-async-functions", + data: { supported: "7.6.0", version: "7.1.0" }, + }, + ], + }, + ], + }, +])