diff --git a/lib/rules/no-unsupported-features/es-syntax-additions.json b/lib/rules/no-unsupported-features/es-syntax-additions.json new file mode 100644 index 00000000..86d197d6 --- /dev/null +++ b/lib/rules/no-unsupported-features/es-syntax-additions.json @@ -0,0 +1,30 @@ +{ + "[computed=false] Literal.key[bigint]": { + "name": "no-bigint-property-names", + "supported": ">=14.0.0" + }, + "[shorthand=true][kind='get'], [shorthand=true][key.name='get']": { + "name": "no-property-shorthands-get", + "supported": ">=6.0.0" + }, + "[shorthand=true][kind='set'], [shorthand=true][key.name='set']": { + "name": "no-property-shorthands-set", + "supported": ">=6.0.0" + }, + "CallExpression[optional=true] > SpreadElement.arguments": { + "name": "no-spread-parameters-after-optional-chaining", + "supported": ">=16.1.0" + }, + "MethodDefinition > PrivateName.key": { + "name": "no-class-private-methods", + "supported": ">=14.6.0" + }, + "MemberExpression[object.name='Atomics'] > Identifier.property[name='notify']": { + "name": "no-class-private-methods", + "supported": ">=10.6.0" + }, + "MemberExpression[object.name='Array'] > Identifier.property[name='fromAsync']": { + "name": "no-class-array-fromasync", + "supported": null + } +} diff --git a/lib/rules/no-unsupported-features/es-syntax.js b/lib/rules/no-unsupported-features/es-syntax.js index 323d81f8..2c0c65ed 100644 --- a/lib/rules/no-unsupported-features/es-syntax.js +++ b/lib/rules/no-unsupported-features/es-syntax.js @@ -4,428 +4,64 @@ */ "use strict" -const { rules: esRules } = require("eslint-plugin-es-x") const { getInnermostScope } = require("@eslint-community/eslint-utils") -const { Range } = require("semver") +const { rules: esRules } = require("eslint-plugin-es-x") const rangeSubset = require("semver/ranges/subset") const getConfiguredNodeVersion = require("../../util/get-configured-node-version") const getSemverRange = require("../../util/get-semver-range") const mergeVisitorsInPlace = require("../../util/merge-visitors-in-place") +/** @type {Record} */ +const features = require("./es-syntax.json") -const getOrSet = /^(?:g|s)et$/u -const features = { - //-------------------------------------------------------------------------- - // ES2015 - //-------------------------------------------------------------------------- - arrowFunctions: { - ruleId: "no-arrow-functions", - cases: [ - { - supported: "4.0.0", - messageId: "no-arrow-functions", - }, - ], - }, - binaryNumericLiterals: { - ruleId: "no-binary-numeric-literals", - cases: [ - { - supported: "4.0.0", - messageId: "no-binary-numeric-literals", - }, - ], - }, - blockScopedFunctions: { - ruleId: "no-block-scoped-functions", - cases: [ - { - supported: "6.0.0", - test: info => !info.isStrict, - messageId: "no-block-scoped-functions-sloppy", - }, - { - supported: "4.0.0", - messageId: "no-block-scoped-functions-strict", - }, - ], - }, - blockScopedVariables: { - ruleId: "no-block-scoped-variables", - cases: [ - { - supported: "6.0.0", - test: info => !info.isStrict, - messageId: "no-block-scoped-variables-sloppy", - }, - { - supported: "4.0.0", - messageId: "no-block-scoped-variables-strict", - }, - ], - }, - classes: { - ruleId: "no-classes", - cases: [ - { - supported: "6.0.0", - test: info => !info.isStrict, - messageId: "no-classes-sloppy", - }, - { - supported: "4.0.0", - messageId: "no-classes-strict", - }, - ], - }, - computedProperties: { - ruleId: "no-computed-properties", - cases: [ - { - supported: "4.0.0", - messageId: "no-computed-properties", - }, - ], - }, - defaultParameters: { - ruleId: "no-default-parameters", - cases: [ - { - supported: "6.0.0", - messageId: "no-default-parameters", - }, - ], - }, - destructuring: { - ruleId: "no-destructuring", - cases: [ - { - supported: "6.0.0", - messageId: "no-destructuring", - }, - ], - }, - forOfLoops: { - ruleId: "no-for-of-loops", - cases: [ - { - supported: "0.12.0", - messageId: "no-for-of-loops", - }, - ], - }, - generators: { - ruleId: "no-generators", - cases: [ - { - supported: "4.0.0", - messageId: "no-generators", - }, - ], - }, - modules: { - ruleId: "no-modules", - cases: [ - { - supported: new Range("^12.17 || >=13.2"), - messageId: "no-modules", - }, - ], - }, - "new.target": { - ruleId: "no-new-target", - cases: [ - { - supported: "5.0.0", - messageId: "no-new-target", - }, - ], - }, - objectSuperProperties: { - ruleId: "no-object-super-properties", - cases: [ - { - supported: "4.0.0", - messageId: "no-object-super-properties", - }, - ], - }, - octalNumericLiterals: { - ruleId: "no-octal-numeric-literals", - cases: [ - { - supported: "4.0.0", - messageId: "no-octal-numeric-literals", - }, - ], - }, - propertyShorthands: { - ruleId: "no-property-shorthands", - cases: [ - { - supported: "6.0.0", - test: info => - info.node.shorthand && getOrSet.test(info.node.key.name), - messageId: "no-property-shorthands-getset", - }, - { - supported: "4.0.0", - messageId: "no-property-shorthands", - }, - ], - }, - regexpU: { - ruleId: "no-regexp-u-flag", - cases: [ - { - supported: "6.0.0", - messageId: "no-regexp-u-flag", - }, - ], - }, - regexpY: { - ruleId: "no-regexp-y-flag", - cases: [ - { - supported: "6.0.0", - messageId: "no-regexp-y-flag", - }, - ], - }, - restParameters: { - ruleId: "no-rest-parameters", - cases: [ - { - supported: "6.0.0", - messageId: "no-rest-parameters", - }, - ], - }, - spreadElements: { - ruleId: "no-spread-elements", - cases: [ - { - supported: "5.0.0", - messageId: "no-spread-elements", - }, - ], - }, - templateLiterals: { - ruleId: "no-template-literals", - cases: [ - { - supported: "4.0.0", - messageId: "no-template-literals", - }, - ], - }, - unicodeCodePointEscapes: { - ruleId: "no-unicode-codepoint-escapes", - cases: [ - { - supported: "4.0.0", - messageId: "no-unicode-codepoint-escapes", - }, - ], - }, +/** @type {Set} */ +const ignoreKeys = new Set() - //-------------------------------------------------------------------------- - // ES2016 - //-------------------------------------------------------------------------- - exponentialOperators: { - ruleId: "no-exponential-operators", - cases: [ - { - supported: "7.0.0", - messageId: "no-exponential-operators", - }, - ], - }, +/** + * @typedef {Object} ESSyntax + * @property {string[]} aliases + * @property {string | null} supported + * @property {string} [strictMode] + * @property {string} [deprecated] + */ +/** + * @typedef {Object} RuleMap + * @property {string} ruleId + * @property {string} feature + * @property {string[]} ignoreNames + * @property {import("semver").Range} supported + * @property {boolean} deprecated + */ - //-------------------------------------------------------------------------- - // ES2017 - //-------------------------------------------------------------------------- - asyncFunctions: { - ruleId: "no-async-functions", - cases: [ - { - supported: "7.6.0", - messageId: "no-async-functions", - }, - ], - }, - trailingCommasInFunctions: { - ruleId: "no-trailing-function-commas", - cases: [ - { - supported: "8.0.0", - messageId: "no-trailing-function-commas", - }, - ], - }, +/** + * @param {string} _match The entire match + * @param {string} first The first regex group + * @returns {string} + */ +function firstMatchToUpper(_match, first) { + return first.toUpperCase() +} - //-------------------------------------------------------------------------- - // ES2018 - //-------------------------------------------------------------------------- - asyncIteration: { - ruleId: "no-async-iteration", - cases: [ - { - supported: "10.0.0", - messageId: "no-async-iteration", - }, - ], - }, - malformedTemplateLiterals: { - ruleId: "no-malformed-template-literals", - cases: [ - { - supported: "8.10.0", - messageId: "no-malformed-template-literals", - }, - ], - }, - regexpLookbehind: { - ruleId: "no-regexp-lookbehind-assertions", - cases: [ - { - supported: "8.10.0", - messageId: "no-regexp-lookbehind-assertions", - }, - ], - }, - regexpNamedCaptureGroups: { - ruleId: "no-regexp-named-capture-groups", - cases: [ - { - supported: "10.0.0", - messageId: "no-regexp-named-capture-groups", - }, - ], - }, - regexpS: { - ruleId: "no-regexp-s-flag", - cases: [ - { - supported: "8.10.0", - messageId: "no-regexp-s-flag", - }, - ], - }, - regexpUnicodeProperties: { - ruleId: "no-regexp-unicode-property-escapes", - cases: [ - { - supported: "10.0.0", - messageId: "no-regexp-unicode-property-escapes", - }, - ], - }, - restSpreadProperties: { - ruleId: "no-rest-spread-properties", - cases: [ - { - supported: "8.3.0", - messageId: "no-rest-spread-properties", - }, - ], - }, +/** @type {RuleMap[]} */ +const ruleMap = Object.entries(features).map(([ruleId, meta]) => { + const ruleIdNegated = ruleId.replace(/^no-/, "") + const ruleIdCamel = ruleIdNegated.replace(/-(\w)/g, firstMatchToUpper) - //-------------------------------------------------------------------------- - // ES2019 - //-------------------------------------------------------------------------- - jsonSuperset: { - ruleId: "no-json-superset", - cases: [ - { - supported: "10.0.0", - messageId: "no-json-superset", - }, - ], - }, - optionalCatchBinding: { - ruleId: "no-optional-catch-binding", - cases: [ - { - supported: "10.0.0", - messageId: "no-optional-catch-binding", - }, - ], - }, + meta.aliases ??= [] + const ignoreNames = [ruleId, ruleIdNegated, ruleIdCamel, ...meta.aliases] - //-------------------------------------------------------------------------- - // ES2020 - //-------------------------------------------------------------------------- - bigint: { - ruleId: "no-bigint", - cases: [ - { - supported: "10.4.0", - test: info => info.node.type === "Literal", - messageId: "no-bigint", - }, - { - supported: null, - test: ({ node }) => - node.type === "Literal" && - (node.parent.type === "Property" || - node.parent.type === "MethodDefinition") && - !node.parent.computed && - node.parent.key === node, - messageId: "no-bigint-property-names", - }, - ], - }, - dynamicImport: { - ruleId: "no-dynamic-import", - cases: [ - { - supported: new Range("^12.17 || >=13.2"), - messageId: "no-dynamic-import", - }, - ], - }, - optionalChaining: { - ruleId: "no-optional-chaining", - cases: [ - { - supported: "14.0.0", - messageId: "no-optional-chaining", - }, - ], - }, - nullishCoalescingOperators: { - ruleId: "no-nullish-coalescing-operators", - cases: [ - { - supported: "14.0.0", - messageId: "no-nullish-coalescing-operators", - }, - ], - }, + for (const ignoreName of ignoreNames) { + ignoreKeys.add(ignoreName) + } - //-------------------------------------------------------------------------- - // ES2021 - //-------------------------------------------------------------------------- - logicalAssignmentOperators: { - ruleId: "no-logical-assignment-operators", - cases: [ - { - supported: "15.0.0", - messageId: "no-logical-assignment-operators", - }, - ], - }, - numericSeparators: { - ruleId: "no-numeric-separators", - cases: [ - { - supported: "12.5.0", - messageId: "no-numeric-separators", - }, - ], - }, -} -const keywords = Object.keys(features) + return { + ruleId: ruleId, + feature: ruleIdNegated, + ignoreNames: ignoreNames, + supported: getSemverRange(meta.supported ?? "<0"), + strictMode: getSemverRange(meta.strictMode), + deprecated: Boolean(meta.deprecated), + } +}) /** * Parses the options. @@ -456,6 +92,12 @@ function normalizeScope(initialScope, node) { return scope } +function isStrict(context, node) { + const sourceCode = context.sourceCode ?? context.getSourceCode() // TODO: just use context.sourceCode when dropping eslint < v9 + const scope = sourceCode.getScope?.(node) ?? context.getScope() //TODO: remove context.getScope() when dropping support for ESLint < v9 + return normalizeScope(scope, node).isStrict +} + /** * Define the visitor object as merging the rules of eslint-plugin-es-x. * @param {RuleContext} context The rule context. @@ -463,83 +105,55 @@ function normalizeScope(initialScope, node) { * @returns {object} The defined visitor. */ function defineVisitor(context, options) { - const testInfoPrototype = { - get isStrict() { - const sourceCode = context.sourceCode ?? context.getSourceCode() // TODO: just use context.sourceCode when dropping eslint < v9 - const scope = sourceCode.getScope?.(this.node) ?? context.getScope() //TODO: remove context.getScope() when dropping support for ESLint < v9 - return normalizeScope(scope, this.node).isStrict - }, - } - - /** - * Check whether a given case object is full-supported on the configured node version. - * @param {{supported:string}} aCase The case object to check. - * @returns {boolean} `true` if it's supporting. - */ - function isNotSupportingVersion(aCase) { - if (!aCase.supported) { - return true - } - - const supported = - typeof aCase.supported === "string" - ? getSemverRange(`>=${aCase.supported}`) - : aCase.supported - return !rangeSubset(options.version, supported) - } + return ruleMap + .filter( + rule => + rule.ignoreNames.every( + ignoreName => options.ignores.has(ignoreName) === false + ) && + rangeSubset( + options.version, + rule.strictMode ?? rule.supported + ) === false + ) + .map(rule => { + const esRule = esRules[rule.ruleId] + const esContext = { + report(descriptor) { + delete descriptor.fix + + if (descriptor.data == null) { + descriptor.data = {} + } + + descriptor.data.featureName = rule.feature + descriptor.data.version = options.version.raw + descriptor.data.supported = rule.supported.raw + + if (rule.strictMode != null) { + if (isStrict(context, descriptor.node) === false) { + descriptor.data.supported = rule.strictMode.raw + } else if ( + rangeSubset(options.version, rule.supported) + ) { + return + } + } - /** - * Define the predicate function to check whether a given case object is supported on the configured node version. - * @param {Node} node The node which is reported. - * @returns {function(aCase:{supported:string}):boolean} The predicate function. - */ - function isNotSupportingOn(node) { - return aCase => - isNotSupportingVersion(aCase) && - (!aCase.test || aCase.test({ node, __proto__: testInfoPrototype })) - } + descriptor.messageId = + rule.supported.raw === "<0" + ? "not-supported-yet" + : "not-supported-till" - return ( - keywords - // Omit full-supported features and ignored features by options - // because this rule never reports those. - .filter( - keyword => - !options.ignores.has(keyword) && - features[keyword].cases.some(isNotSupportingVersion) - ) - // Merge remaining features with overriding `context.report()`. - .reduce((visitor, keyword) => { - const { ruleId, cases } = features[keyword] - const rule = esRules[ruleId] - const thisContext = { - __proto__: context, + super.report(descriptor) + }, + } - // Override `context.report()` then: - // - ignore if it's supported. - // - override reporting messages. - report(descriptor) { - // Set additional information. - if (descriptor.data) { - descriptor.data.version = options.version.raw - } else { - descriptor.data = { version: options.version.raw } - } - descriptor.fix = undefined + Object.setPrototypeOf(esContext, context) - // Test and report. - const node = descriptor.node - const hitCase = cases.find(isNotSupportingOn(node)) - if (hitCase) { - descriptor.messageId = hitCase.messageId - descriptor.data.supported = hitCase.supported - super.report(descriptor) - } - }, - } - return mergeVisitorsInPlace(visitor, rule.create(thisContext)) - }, {}) - ) + return esRule.create(esContext) + }) + .reduce(mergeVisitorsInPlace, {}) } module.exports = { @@ -559,9 +173,7 @@ module.exports = { version: getConfiguredNodeVersion.schema, ignores: { type: "array", - items: { - enum: Object.keys(features), - }, + items: { enum: [...ignoreKeys] }, uniqueItems: true, }, }, @@ -569,121 +181,14 @@ module.exports = { }, ], messages: { - //------------------------------------------------------------------ - // ES2015 - //------------------------------------------------------------------ - "no-arrow-functions": - "Arrow functions are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-binary-numeric-literals": - "Binary numeric literals are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-block-scoped-functions-strict": - "Block-scoped functions in strict mode are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-block-scoped-functions-sloppy": - "Block-scoped functions in non-strict mode are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-block-scoped-variables-strict": - "Block-scoped variables in strict mode are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-block-scoped-variables-sloppy": - "Block-scoped variables in non-strict mode are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-classes-strict": - "Classes in strict mode are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-classes-sloppy": - "Classes in non-strict mode are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-computed-properties": - "Computed properties are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-default-parameters": - "Default parameters are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-destructuring": - "Destructuring is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-for-of-loops": - "'for-of' loops are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-generators": - "Generator functions are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-modules": - "Import and export declarations are not supported yet.", - "no-new-target": - "'new.target' is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-object-super-properties": - "'super' in object literals is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-octal-numeric-literals": - "Octal numeric literals are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-property-shorthands": - "Property shorthands are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-property-shorthands-getset": - "Property shorthands of 'get' and 'set' are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-regexp-u-flag": - "RegExp 'u' flag is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-regexp-y-flag": - "RegExp 'y' flag is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-rest-parameters": - "Rest parameters are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-spread-elements": - "Spread elements are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-template-literals": - "Template literals are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-unicode-codepoint-escapes": - "Unicode code point escapes are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - - //------------------------------------------------------------------ - // ES2016 - //------------------------------------------------------------------ - "no-exponential-operators": - "Exponential operators are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - - //------------------------------------------------------------------ - // ES2017 - //------------------------------------------------------------------ - "no-async-functions": - "Async functions are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-trailing-function-commas": - "Trailing commas in function syntax are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - - //------------------------------------------------------------------ - // ES2018 - //------------------------------------------------------------------ - "no-async-iteration": - "Async iteration is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-malformed-template-literals": - "Malformed template literals are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-regexp-lookbehind-assertions": - "RegExp lookbehind assertions are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-regexp-named-capture-groups": - "RegExp named capture groups are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-regexp-s-flag": - "RegExp 's' flag is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-regexp-unicode-property-escapes": - "RegExp Unicode property escapes are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-rest-spread-properties": - "Rest/spread properties are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - - //------------------------------------------------------------------ - // ES2019 - //------------------------------------------------------------------ - "no-json-superset": - "'\\u{{code}}' in string literals is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-optional-catch-binding": - "The omission of 'catch' binding is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - - //------------------------------------------------------------------ - // ES2020 - //------------------------------------------------------------------ - "no-bigint": - "Bigint literals are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-bigint-property-names": - "Bigint literal property names are not supported yet.", - "no-dynamic-import": - "'import()' expressions are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-optional-chaining": - "Optional chainings are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-nullish-coalescing-operators": - "Nullish coalescing operators are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - - //------------------------------------------------------------------ - // ES2021 - //------------------------------------------------------------------ - "no-logical-assignment-operators": - "Logical assignment operators are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - "no-numeric-separators": - "Numeric separators are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + "not-supported-till": [ + "'{{featureName}}' is not supported until Node.js {{supported}}.", + "The configured version range is '{{version}}'.", + ].join(" "), + "not-supported-yet": [ + "'{{featureName}}' is not supported in Node.js.", + "The configured version range is '{{version}}'.", + ].join(" "), }, }, create(context) { diff --git a/lib/rules/no-unsupported-features/es-syntax.json b/lib/rules/no-unsupported-features/es-syntax.json new file mode 100644 index 00000000..87ca77a7 --- /dev/null +++ b/lib/rules/no-unsupported-features/es-syntax.json @@ -0,0 +1,615 @@ +{ + "no-accessor-properties": { + "supported": ">=0.10.0" + }, + "no-arbitrary-module-namespace-names": { + "supported": ">=13.2.0" + }, + "no-array-from": { + "supported": ">=4.0.0" + }, + "no-array-isarray": { + "supported": ">=0.10.0" + }, + "no-array-of": { + "supported": ">=4.0.0" + }, + "no-array-prototype-copywithin": { + "supported": ">=4.0.0" + }, + "no-array-prototype-entries": { + "supported": ">=0.12.0" + }, + "no-array-prototype-every": { + "supported": ">=0.10.0" + }, + "no-array-prototype-fill": { + "supported": ">=4.0.0" + }, + "no-array-prototype-filter": { + "supported": ">=0.10.0" + }, + "no-array-prototype-find": { + "supported": ">=4.0.0" + }, + "no-array-prototype-findindex": { + "supported": ">=4.0.0" + }, + "no-array-prototype-findlast-findlastindex": { + "supported": ">=18.0.0" + }, + "no-array-prototype-flat": { + "supported": ">=11.0.0" + }, + "no-array-prototype-foreach": { + "supported": ">=0.10.0" + }, + "no-array-prototype-includes": { + "supported": ">=6.0.0" + }, + "no-array-prototype-indexof": { + "supported": ">=0.10.0" + }, + "no-array-prototype-keys": { + "supported": ">=0.12.0" + }, + "no-array-prototype-lastindexof": { + "supported": ">=0.10.0" + }, + "no-array-prototype-map": { + "supported": ">=0.10.0" + }, + "no-array-prototype-reduce": { + "supported": ">=0.10.0" + }, + "no-array-prototype-reduceright": { + "supported": ">=0.10.0" + }, + "no-array-prototype-some": { + "supported": ">=0.10.0" + }, + "no-array-prototype-toreversed": { + "supported": ">=20.0.0" + }, + "no-array-prototype-tosorted": { + "supported": ">=20.0.0" + }, + "no-array-prototype-tospliced": { + "supported": ">=20.0.0" + }, + "no-array-prototype-values": { + "supported": ">=10.9.0" + }, + "no-array-prototype-with": { + "supported": ">=20.0.0" + }, + "no-array-string-prototype-at": { + "supported": ">=16.6.0" + }, + "no-arrow-functions": { + "supported": ">=4.0.0" + }, + "no-async-functions": { + "supported": ">=7.6.0" + }, + "no-async-iteration": { + "supported": ">=10.0.0" + }, + "no-atomics-waitasync": { + "supported": ">=16.0.0" + }, + "no-atomics": { + "supported": ">=8.10.0" + }, + "no-bigint": { + "supported": ">=10.4.0" + }, + "no-binary-numeric-literals": { + "supported": ">=4.0.0" + }, + "no-block-scoped-functions": { + "supported": ">=4.0.0", + "strictMode": ">=6.0.0" + }, + "no-block-scoped-variables": { + "supported": ">=4.0.0", + "strictMode": ">=6.0.0" + }, + "no-class-fields": { + "supported": ">=12.0.0" + }, + "no-class-static-block": { + "supported": ">=16.11.0" + }, + "no-classes": { + "supported": ">=4.0.0", + "strictMode": ">=6.0.0" + }, + "no-computed-properties": { + "supported": ">=4.0.0" + }, + "no-date-now": { + "supported": ">=0.10.0" + }, + "no-date-prototype-getyear-setyear": { + "supported": ">=0.10.0", + "deprecated": true + }, + "no-date-prototype-togmtstring": { + "supported": ">=0.10.0", + "deprecated": true + }, + "no-default-parameters": { + "supported": ">=6.0.0" + }, + "no-destructuring": { + "supported": ">=6.0.0" + }, + "no-dynamic-import": { + "supported": "^12.17.0 || >=13.2.0" + }, + "no-error-cause": { + "supported": ">=16.9.0" + }, + "no-escape-unescape": { + "supported": ">=0.10.0", + "deprecated": true + }, + "no-exponential-operators": { + "supported": ">=7.0.0" + }, + "no-export-ns-from": { + "supported": ">=13.2.0" + }, + "no-for-of-loops": { + "supported": ">=0.12.0" + }, + "no-function-declarations-in-if-statement-clauses-without-block": { + "supported": ">=0.10.0" + }, + "no-function-prototype-bind": { + "supported": ">=0.10.0" + }, + "no-generators": { + "supported": ">=4.0.0" + }, + "no-global-this": { + "supported": ">=12.0.0" + }, + "no-hashbang": { + "supported": ">=12.5.0" + }, + "no-import-meta": { + "supported": ">=10.4.0" + }, + "no-initializers-in-for-in": { + "supported": ">=0.10.0" + }, + "no-intl-datetimeformat-prototype-formatrange": { + "supported": ">=12.9.0" + }, + "no-intl-datetimeformat-prototype-formattoparts": { + "supported": ">=12.9.0" + }, + "no-intl-displaynames": { + "supported": ">=14.0.0" + }, + "no-intl-getcanonicallocales": { + "supported": ">=7.0.0" + }, + "no-intl-listformat": { + "supported": ">=12.0.0" + }, + "no-intl-locale": { + "supported": ">=12.0.0" + }, + "no-intl-numberformat-prototype-formatrange": { + "supported": ">=19.0.0" + }, + "no-intl-numberformat-prototype-formatrangetoparts": { + "supported": ">=19.0.0" + }, + "no-intl-numberformat-prototype-formattoparts": { + "supported": ">=10.0.0" + }, + "no-intl-pluralrules-prototype-selectrange": { + "supported": ">=19.0.0" + }, + "no-intl-pluralrules": { + "supported": ">=10.0.0" + }, + "no-intl-relativetimeformat": { + "supported": ">=12.0.0" + }, + "no-intl-segmenter": { + "supported": ">=16.0.0" + }, + "no-intl-supportedvaluesof": { + "supported": ">=18.0.0" + }, + "no-json-superset": { + "supported": ">=10.0.0" + }, + "no-json": { + "supported": ">=0.10.0" + }, + "no-keyword-properties": { + "supported": ">=0.10.0" + }, + "no-labelled-function-declarations": { + "supported": ">=0.10.0" + }, + "no-legacy-object-prototype-accessor-methods": { + "supported": ">=0.10.0", + "deprecated": true + }, + "no-logical-assignment-operators": { + "supported": ">=15.0.0" + }, + "no-malformed-template-literals": { + "supported": ">=8.10.0" + }, + "no-map": { + "supported": ">=0.12.0" + }, + "no-math-acosh": { + "supported": ">=0.12.0" + }, + "no-math-asinh": { + "supported": ">=0.12.0" + }, + "no-math-atanh": { + "supported": ">=0.12.0" + }, + "no-math-cbrt": { + "supported": ">=0.12.0" + }, + "no-math-clz32": { + "supported": ">=0.12.0" + }, + "no-math-cosh": { + "supported": ">=0.12.0" + }, + "no-math-expm1": { + "supported": ">=0.12.0" + }, + "no-math-fround": { + "supported": ">=0.12.0" + }, + "no-math-hypot": { + "supported": ">=0.12.0" + }, + "no-math-imul": { + "supported": ">=0.12.0" + }, + "no-math-log10": { + "supported": ">=0.12.0" + }, + "no-math-log1p": { + "supported": ">=0.12.0" + }, + "no-math-log2": { + "supported": ">=0.12.0" + }, + "no-math-sign": { + "supported": ">=0.12.0" + }, + "no-math-sinh": { + "supported": ">=0.12.0" + }, + "no-math-tanh": { + "supported": ">=0.12.0" + }, + "no-math-trunc": { + "supported": ">=0.12.0" + }, + "no-modules": { + "supported": "^12.17.0 || >=13.2.0" + }, + "no-new-target": { + "aliases": ["new.target"], + "supported": ">=5.0.0" + }, + "no-nullish-coalescing-operators": { + "supported": ">=14.0.0" + }, + "no-number-epsilon": { + "supported": ">=0.12.0" + }, + "no-number-isfinite": { + "supported": ">=0.10.0" + }, + "no-number-isinteger": { + "supported": ">=0.10.0" + }, + "no-number-isnan": { + "supported": ">=0.10.0" + }, + "no-number-issafeinteger": { + "supported": ">=0.12.0" + }, + "no-number-maxsafeinteger": { + "supported": ">=0.12.0" + }, + "no-number-minsafeinteger": { + "supported": ">=0.12.0" + }, + "no-number-parsefloat": { + "supported": ">=0.12.0" + }, + "no-number-parseint": { + "supported": ">=0.12.0" + }, + "no-numeric-separators": { + "supported": ">=12.5.0" + }, + "no-object-assign": { + "supported": ">=4.0.0" + }, + "no-object-create": { + "supported": ">=0.10.0" + }, + "no-object-defineproperties": { + "supported": ">=0.10.0" + }, + "no-object-defineproperty": { + "supported": ">=0.10.0" + }, + "no-object-entries": { + "supported": ">=7.0.0" + }, + "no-object-freeze": { + "supported": ">=0.10.0" + }, + "no-object-fromentries": { + "supported": ">=12.0.0" + }, + "no-object-getownpropertydescriptor": { + "supported": ">=0.10.0" + }, + "no-object-getownpropertydescriptors": { + "supported": ">=7.0.0" + }, + "no-object-getownpropertynames": { + "supported": ">=0.10.0" + }, + "no-object-getownpropertysymbols": { + "supported": ">=0.12.0" + }, + "no-object-getprototypeof": { + "supported": ">=0.10.0" + }, + "no-object-hasown": { + "supported": ">=16.9.0" + }, + "no-object-is": { + "supported": ">=0.10.0" + }, + "no-object-isextensible": { + "supported": ">=0.10.0" + }, + "no-object-isfrozen": { + "supported": ">=0.10.0" + }, + "no-object-issealed": { + "supported": ">=0.10.0" + }, + "no-object-keys": { + "supported": ">=0.10.0" + }, + "no-object-map-groupby": { + "supported": ">=21.0.0" + }, + "no-object-preventextensions": { + "supported": ">=0.10.0" + }, + "no-object-seal": { + "supported": ">=0.10.0" + }, + "no-object-setprototypeof": { + "supported": ">=0.12.0" + }, + "no-object-super-properties": { + "supported": ">=4.0.0" + }, + "no-object-values": { + "supported": ">=7.0.0" + }, + "no-octal-numeric-literals": { + "supported": ">=4.0.0" + }, + "no-optional-catch-binding": { + "supported": ">=10.0.0" + }, + "no-optional-chaining": { + "supported": ">=14.0.0" + }, + "no-private-in": { + "supported": ">=16.4.0" + }, + "no-promise-all-settled": { + "supported": ">=12.9.0" + }, + "no-promise-any": { + "supported": ">=15.0.0" + }, + "no-promise-prototype-finally": { + "supported": ">=10.0.0" + }, + "no-promise-withresolvers": { + "supported": null + }, + "no-promise": { + "supported": ">=0.12.0" + }, + "no-property-shorthands": { + "supported": ">=4.0.0" + }, + "no-proxy": { + "supported": ">=6.0.0" + }, + "no-reflect": { + "supported": ">=6.0.0" + }, + "no-regexp-d-flag": { + "supported": ">=16.0.0" + }, + "no-regexp-lookbehind-assertions": { + "aliases": ["regexpLookbehind"], + "supported": ">=8.10.0" + }, + "no-regexp-named-capture-groups": { + "supported": ">=10.0.0" + }, + "no-regexp-prototype-compile": { + "supported": ">=0.10.0" + }, + "no-regexp-prototype-flags": { + "supported": ">=6.0.0" + }, + "no-regexp-s-flag": { + "aliases": ["regexpS"], + "supported": ">=8.10.0" + }, + "no-regexp-u-flag": { + "aliases": ["regexpU"], + "supported": ">=6.0.0" + }, + "no-regexp-unicode-property-escapes-2019": { + "supported": ">=12.1.0 || ^10.16.0" + }, + "no-regexp-unicode-property-escapes-2020": { + "supported": ">=13.12.0 || ^12.17.0" + }, + "no-regexp-unicode-property-escapes-2021": { + "supported": ">=17.2.0 || ^16.14.0" + }, + "no-regexp-unicode-property-escapes-2022": { + "supported": ">=19.1.0 || ^18.13.0" + }, + "no-regexp-unicode-property-escapes-2023": { + "supported": null + }, + "no-regexp-unicode-property-escapes": { + "aliases": ["regexpUnicodeProperties"], + "supported": ">=10.0.0" + }, + "no-regexp-v-flag": { + "supported": ">=20.0.0" + }, + "no-regexp-y-flag": { + "aliases": ["regexpY"], + "supported": ">=6.0.0" + }, + "no-resizable-and-growable-arraybuffers": { + "supported": ">=20.0.0" + }, + "no-rest-parameters": { + "supported": ">=6.0.0" + }, + "no-rest-spread-properties": { + "supported": ">=8.3.0" + }, + "no-set": { + "supported": ">=0.12.0" + }, + "no-shadow-catch-param": { + "supported": ">=0.10.0" + }, + "no-shared-array-buffer": { + "supported": ">=8.10.0" + }, + "no-spread-elements": { + "supported": ">=5.0.0" + }, + "no-string-create-html-methods": { + "supported": ">=0.10.0", + "deprecated": true + }, + "no-string-fromcodepoint": { + "supported": ">=4.0.0" + }, + "no-string-prototype-codepointat": { + "supported": ">=4.0.0" + }, + "no-string-prototype-endswith": { + "supported": ">=4.0.0" + }, + "no-string-prototype-includes": { + "supported": ">=6.0.0" + }, + "no-string-prototype-iswellformed-towellformed": { + "supported": ">=20.0.0" + }, + "no-string-prototype-matchall": { + "supported": ">=12.0.0" + }, + "no-string-prototype-normalize": { + "supported": ">=0.12.0" + }, + "no-string-prototype-padstart-padend": { + "supported": ">=8.0.0" + }, + "no-string-prototype-repeat": { + "supported": ">=4.0.0" + }, + "no-string-prototype-replaceall": { + "supported": ">=15.0.0" + }, + "no-string-prototype-startswith": { + "supported": ">=4.0.0" + }, + "no-string-prototype-substr": { + "supported": ">=0.10.0" + }, + "no-string-prototype-trim": { + "supported": ">=0.10.0" + }, + "no-string-prototype-trimleft-trimright": { + "supported": ">=0.10.0" + }, + "no-string-prototype-trimstart-trimend": { + "supported": ">=10.0.0" + }, + "no-string-raw": { + "supported": ">=4.0.0" + }, + "no-subclassing-builtins": { + "supported": ">=4.0.0" + }, + "no-symbol-prototype-description": { + "supported": ">=11.0.0" + }, + "no-symbol": { + "supported": ">=0.12.0" + }, + "no-template-literals": { + "supported": ">=4.0.0" + }, + "no-top-level-await": { + "supported": ">=14.8.0" + }, + "no-trailing-commas": { + "supported": ">=0.10.0" + }, + "no-trailing-function-commas": { + "aliases": ["trailingCommasInFunctions"], + "supported": ">=8.0.0" + }, + "no-typed-arrays": { + "supported": ">=0.10.0" + }, + "no-unicode-codepoint-escapes": { + "aliases": ["unicodeCodePointEscapes"], + "supported": ">=4.0.0" + }, + "no-weak-map": { + "supported": ">=0.12.0" + }, + "no-weak-set": { + "supported": ">=0.12.0" + }, + "no-weakrefs": { + "supported": ">=14.6.0" + } +} diff --git a/package.json b/package.json index 85c34405..d2ec54d9 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,8 @@ "pretest": "npm run -s lint", "preversion": "npm test", "test": "nyc npm run -s test:_mocha", - "test:_mocha": "_mocha \"tests/lib/**/*.js\" --reporter progress --timeout 4000", + "test:_mocha": "_mocha --reporter progress --timeout 4000 \"tests/lib/**/*.js\"", + "test:mocha": "_mocha --reporter progress --timeout 4000", "test:ci": "nyc npm run -s test:_mocha", "update:eslint-docs": "eslint-doc-generator", "version": "npm run -s build && eslint lib/rules --fix && git add .", diff --git a/tests/lib/rules/no-unsupported-features/es-syntax.js b/tests/lib/rules/no-unsupported-features/es-syntax.js index d3042e95..b94cd57e 100644 --- a/tests/lib/rules/no-unsupported-features/es-syntax.js +++ b/tests/lib/rules/no-unsupported-features/es-syntax.js @@ -6,7 +6,6 @@ const path = require("path") const RuleTester = require("#eslint-rule-tester").RuleTester -const { Range } = require("semver") const rule = require("../../../../lib/rules/no-unsupported-features/es-syntax") /** @@ -68,8 +67,14 @@ function runTests(patterns) { } // Add the invalid patterns with `ignores` option into the valid patterns. - if (pattern.keyword) { - tests.valid.push(...pattern.invalid.map(ignores(pattern.keyword))) + if (typeof pattern.keyword === "string") { + pattern.keyword = [pattern.keyword] + } + + if (Array.isArray(pattern.keyword)) { + for (const keyword of pattern.keyword) { + tests.valid.push(...pattern.invalid.map(ignores(keyword))) + } } ruleTester.run("no-unsupported-features/es-builtins", rule, tests) @@ -106,8 +111,12 @@ runTests([ options: [{ version: "3.9.9" }], errors: [ { - messageId: "no-arrow-functions", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "arrow-functions", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -116,8 +125,12 @@ runTests([ options: [{ version: "3.9.9" }], errors: [ { - messageId: "no-arrow-functions", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "arrow-functions", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -145,8 +158,12 @@ runTests([ options: [{ version: "3.9.9" }], errors: [ { - messageId: "no-binary-numeric-literals", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "binary-numeric-literals", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -178,8 +195,12 @@ runTests([ options: [{ version: "3.9.9" }], errors: [ { - messageId: "no-block-scoped-functions-strict", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "block-scoped-functions", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -188,8 +209,12 @@ runTests([ options: [{ version: "5.9.9" }], errors: [ { - messageId: "no-block-scoped-functions-sloppy", - data: { supported: "6.0.0", version: "5.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "block-scoped-functions", + supported: ">=6.0.0", + version: "5.9.9", + }, }, ], }, @@ -233,8 +258,12 @@ runTests([ options: [{ version: "3.9.9" }], errors: [ { - messageId: "no-block-scoped-variables-strict", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "block-scoped-variables", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -243,8 +272,12 @@ runTests([ options: [{ version: "3.9.9" }], errors: [ { - messageId: "no-block-scoped-variables-strict", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "block-scoped-variables", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -253,8 +286,12 @@ runTests([ options: [{ version: "5.9.9" }], errors: [ { - messageId: "no-block-scoped-variables-sloppy", - data: { supported: "6.0.0", version: "5.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "block-scoped-variables", + supported: ">=6.0.0", + version: "5.9.9", + }, }, ], }, @@ -263,8 +300,12 @@ runTests([ options: [{ version: "5.9.9" }], errors: [ { - messageId: "no-block-scoped-variables-sloppy", - data: { supported: "6.0.0", version: "5.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "block-scoped-variables", + supported: ">=6.0.0", + version: "5.9.9", + }, }, ], }, @@ -296,8 +337,12 @@ runTests([ options: [{ version: "3.9.9" }], errors: [ { - messageId: "no-classes-strict", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "classes", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -306,8 +351,12 @@ runTests([ options: [{ version: "5.9.9" }], errors: [ { - messageId: "no-classes-sloppy", - data: { supported: "6.0.0", version: "5.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "classes", + supported: ">=6.0.0", + version: "5.9.9", + }, }, ], }, @@ -345,8 +394,12 @@ runTests([ options: [{ version: "3.9.9" }], errors: [ { - messageId: "no-computed-properties", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "computed-properties", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -357,8 +410,12 @@ runTests([ ], errors: [ { - messageId: "no-computed-properties", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "computed-properties", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -367,8 +424,12 @@ runTests([ options: [{ version: "3.9.9", ignores: ["classes"] }], errors: [ { - messageId: "no-computed-properties", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "computed-properties", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -377,8 +438,12 @@ runTests([ options: [{ version: "3.9.9", ignores: ["classes"] }], errors: [ { - messageId: "no-computed-properties", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "computed-properties", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -468,8 +533,12 @@ runTests([ options: [{ version: "5.9.9" }], errors: [ { - messageId: "no-default-parameters", - data: { supported: "6.0.0", version: "5.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "default-parameters", + supported: ">=6.0.0", + version: "5.9.9", + }, }, ], }, @@ -478,8 +547,12 @@ runTests([ options: [{ version: "5.9.9" }], errors: [ { - messageId: "no-default-parameters", - data: { supported: "6.0.0", version: "5.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "default-parameters", + supported: ">=6.0.0", + version: "5.9.9", + }, }, ], }, @@ -488,8 +561,12 @@ runTests([ options: [{ version: "5.9.9" }], errors: [ { - messageId: "no-default-parameters", - data: { supported: "6.0.0", version: "5.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "default-parameters", + supported: ">=6.0.0", + version: "5.9.9", + }, }, ], }, @@ -498,8 +575,12 @@ runTests([ options: [{ version: "5.9.9" }], errors: [ { - messageId: "no-default-parameters", - data: { supported: "6.0.0", version: "5.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "default-parameters", + supported: ">=6.0.0", + version: "5.9.9", + }, }, ], }, @@ -508,8 +589,12 @@ runTests([ options: [{ version: "5.9.9", ignores: ["classes"] }], errors: [ { - messageId: "no-default-parameters", - data: { supported: "6.0.0", version: "5.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "default-parameters", + supported: ">=6.0.0", + version: "5.9.9", + }, }, ], }, @@ -518,8 +603,12 @@ runTests([ options: [{ version: "5.9.9", ignores: ["classes"] }], errors: [ { - messageId: "no-default-parameters", - data: { supported: "6.0.0", version: "5.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "default-parameters", + supported: ">=6.0.0", + version: "5.9.9", + }, }, ], }, @@ -571,8 +660,12 @@ runTests([ options: [{ version: "5.9.9" }], errors: [ { - messageId: "no-destructuring", - data: { supported: "6.0.0", version: "5.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "destructuring", + supported: ">=6.0.0", + version: "5.9.9", + }, }, ], }, @@ -581,8 +674,12 @@ runTests([ options: [{ version: "5.9.9" }], errors: [ { - messageId: "no-destructuring", - data: { supported: "6.0.0", version: "5.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "destructuring", + supported: ">=6.0.0", + version: "5.9.9", + }, }, ], }, @@ -591,8 +688,12 @@ runTests([ options: [{ version: "5.9.9" }], errors: [ { - messageId: "no-destructuring", - data: { supported: "6.0.0", version: "5.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "destructuring", + supported: ">=6.0.0", + version: "5.9.9", + }, }, ], }, @@ -601,8 +702,12 @@ runTests([ options: [{ version: "5.9.9" }], errors: [ { - messageId: "no-destructuring", - data: { supported: "6.0.0", version: "5.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "destructuring", + supported: ">=6.0.0", + version: "5.9.9", + }, }, ], }, @@ -612,8 +717,12 @@ runTests([ options: [{ version: "5.9.9" }], errors: [ { - messageId: "no-destructuring", - data: { supported: "6.0.0", version: "5.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "destructuring", + supported: ">=6.0.0", + version: "5.9.9", + }, }, ], }, @@ -622,8 +731,12 @@ runTests([ options: [{ version: "5.9.9" }], errors: [ { - messageId: "no-destructuring", - data: { supported: "6.0.0", version: "5.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "destructuring", + supported: ">=6.0.0", + version: "5.9.9", + }, }, ], }, @@ -632,8 +745,12 @@ runTests([ options: [{ version: "5.9.9" }], errors: [ { - messageId: "no-destructuring", - data: { supported: "6.0.0", version: "5.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "destructuring", + supported: ">=6.0.0", + version: "5.9.9", + }, }, ], }, @@ -642,8 +759,12 @@ runTests([ options: [{ version: "5.9.9" }], errors: [ { - messageId: "no-destructuring", - data: { supported: "6.0.0", version: "5.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "destructuring", + supported: ">=6.0.0", + version: "5.9.9", + }, }, ], }, @@ -679,8 +800,12 @@ runTests([ options: [{ version: "0.11.9" }], errors: [ { - messageId: "no-for-of-loops", - data: { supported: "0.12.0", version: "0.11.9" }, + messageId: "not-supported-till", + data: { + featureName: "for-of-loops", + supported: ">=0.12.0", + version: "0.11.9", + }, }, ], }, @@ -689,8 +814,12 @@ runTests([ options: [{ version: "0.11.9" }], errors: [ { - messageId: "no-for-of-loops", - data: { supported: "0.12.0", version: "0.11.9" }, + messageId: "not-supported-till", + data: { + featureName: "for-of-loops", + supported: ">=0.12.0", + version: "0.11.9", + }, }, ], }, @@ -704,8 +833,12 @@ runTests([ ], errors: [ { - messageId: "no-for-of-loops", - data: { supported: "0.12.0", version: "0.11.9" }, + messageId: "not-supported-till", + data: { + featureName: "for-of-loops", + supported: ">=0.12.0", + version: "0.11.9", + }, }, ], }, @@ -751,8 +884,12 @@ runTests([ options: [{ version: "3.9.9" }], errors: [ { - messageId: "no-generators", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "generators", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -761,8 +898,12 @@ runTests([ options: [{ version: "3.9.9" }], errors: [ { - messageId: "no-generators", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "generators", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -773,8 +914,12 @@ runTests([ ], errors: [ { - messageId: "no-generators", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "generators", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -783,8 +928,12 @@ runTests([ options: [{ version: "3.9.9", ignores: ["classes"] }], errors: [ { - messageId: "no-generators", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "generators", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -793,8 +942,12 @@ runTests([ options: [{ version: "3.9.9", ignores: ["classes"] }], errors: [ { - messageId: "no-generators", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "generators", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -843,8 +996,12 @@ runTests([ options: [{ version: "10.0.0" }], errors: [ { - messageId: "no-modules", - data: { supported: null, version: "10.0.0" }, + messageId: "not-supported-till", + data: { + featureName: "modules", + supported: "^12.17.0 || >=13.2.0", + version: "10.0.0", + }, }, ], }, @@ -854,8 +1011,12 @@ runTests([ options: [{ version: "10.0.0" }], errors: [ { - messageId: "no-modules", - data: { supported: null, version: "10.0.0" }, + messageId: "not-supported-till", + data: { + featureName: "modules", + supported: "^12.17.0 || >=13.2.0", + version: "10.0.0", + }, }, ], }, @@ -865,8 +1026,12 @@ runTests([ options: [{ version: "10.0.0" }], errors: [ { - messageId: "no-modules", - data: { supported: null, version: "10.0.0" }, + messageId: "not-supported-till", + data: { + featureName: "modules", + supported: "^12.17.0 || >=13.2.0", + version: "10.0.0", + }, }, ], }, @@ -876,15 +1041,19 @@ runTests([ options: [{ version: "10.0.0" }], errors: [ { - messageId: "no-modules", - data: { supported: null, version: "10.0.0" }, + messageId: "not-supported-till", + data: { + featureName: "modules", + supported: "^12.17.0 || >=13.2.0", + version: "10.0.0", + }, }, ], }, ], }, { - keyword: "new.target", + keyword: ["newTarget", "new.target"], valid: [ { code: "new target", @@ -905,8 +1074,12 @@ runTests([ options: [{ version: "4.9.9", ignores: ["classes"] }], errors: [ { - messageId: "no-new-target", - data: { supported: "5.0.0", version: "4.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "new-target", + supported: ">=5.0.0", + version: "4.9.9", + }, }, ], }, @@ -915,8 +1088,12 @@ runTests([ options: [{ version: "4.9.9" }], errors: [ { - messageId: "no-new-target", - data: { supported: "5.0.0", version: "4.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "new-target", + supported: ">=5.0.0", + version: "4.9.9", + }, }, ], }, @@ -958,8 +1135,12 @@ runTests([ ], errors: [ { - messageId: "no-object-super-properties", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "object-super-properties", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -970,8 +1151,12 @@ runTests([ ], errors: [ { - messageId: "no-object-super-properties", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "object-super-properties", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -1025,8 +1210,12 @@ runTests([ options: [{ version: "3.9.9" }], errors: [ { - messageId: "no-octal-numeric-literals", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "octal-numeric-literals", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -1035,8 +1224,12 @@ runTests([ options: [{ version: "3.9.9" }], errors: [ { - messageId: "no-octal-numeric-literals", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "octal-numeric-literals", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -1090,8 +1283,12 @@ runTests([ options: [{ version: "3.9.9" }], errors: [ { - messageId: "no-property-shorthands", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "property-shorthands", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -1100,8 +1297,12 @@ runTests([ options: [{ version: "3.9.9" }], errors: [ { - messageId: "no-property-shorthands", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "property-shorthands", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -1112,55 +1313,60 @@ runTests([ ], 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" }, + messageId: "not-supported-till", + data: { + featureName: "property-shorthands", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, + // TODO: Additional es-syntax + // { + // code: "({ get })", + // options: [{ version: "3.9.9" }], + // errors: [ + // { + // messageId: "not-supported-till", + // data: { featureName: "property-shorthands-getset", supported: ">=6.0.0", version: "3.9.9" }, + // }, + // ], + // }, + // { + // code: "({ set })", + // options: [{ version: "3.9.9" }], + // errors: [ + // { + // messageId: "not-supported-till", + // data: { featureName: "property-shorthands-getset", supported: ">=6.0.0", version: "3.9.9" }, + // }, + // ], + // }, + // { + // code: "({ get })", + // options: [{ version: "5.9.9" }], + // errors: [ + // { + // messageId: "not-supported-till", + // data: { featureName: "property-shorthands-getset", supported: ">=6.0.0", version: "5.9.9" }, + // }, + // ], + // }, + // { + // code: "({ set })", + // options: [{ version: "5.9.9" }], + // errors: [ + // { + // messageId: "not-supported-till", + // data: { featureName: "property-shorthands-getset", supported: ">=6.0.0", version: "5.9.9" }, + // }, + // ], + // }, ], }, { - keyword: "regexpU", + keyword: ["regexpU", "regexpUFlag"], valid: [ { code: "/foo/", @@ -1172,7 +1378,7 @@ runTests([ }, { code: "/foo/y", - options: [{ version: "5.9.9", ignores: ["regexpY"] }], + options: [{ version: "5.9.9", ignores: ["regexpYFlag"] }], }, { code: "/foo/u", @@ -1185,15 +1391,19 @@ runTests([ options: [{ version: "5.9.9" }], errors: [ { - messageId: "no-regexp-u-flag", - data: { supported: "6.0.0", version: "5.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "regexp-u-flag", + supported: ">=6.0.0", + version: "5.9.9", + }, }, ], }, ], }, { - keyword: "regexpY", + keyword: ["regexpY", "regexpYFlag"], valid: [ { code: "/foo/", @@ -1205,7 +1415,7 @@ runTests([ }, { code: "/foo/u", - options: [{ version: "5.9.9", ignores: ["regexpU"] }], + options: [{ version: "5.9.9", ignores: ["regexpUFlag"] }], }, { code: "/foo/y", @@ -1218,8 +1428,12 @@ runTests([ options: [{ version: "5.9.9" }], errors: [ { - messageId: "no-regexp-y-flag", - data: { supported: "6.0.0", version: "5.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "regexp-y-flag", + supported: ">=6.0.0", + version: "5.9.9", + }, }, ], }, @@ -1290,8 +1504,12 @@ runTests([ options: [{ version: "5.9.9" }], errors: [ { - messageId: "no-rest-parameters", - data: { supported: "6.0.0", version: "5.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "rest-parameters", + supported: ">=6.0.0", + version: "5.9.9", + }, }, ], }, @@ -1300,8 +1518,12 @@ runTests([ options: [{ version: "5.9.9", ignores: ["destructuring"] }], errors: [ { - messageId: "no-rest-parameters", - data: { supported: "6.0.0", version: "5.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "rest-parameters", + supported: ">=6.0.0", + version: "5.9.9", + }, }, ], }, @@ -1310,8 +1532,12 @@ runTests([ options: [{ version: "5.9.9" }], errors: [ { - messageId: "no-rest-parameters", - data: { supported: "6.0.0", version: "5.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "rest-parameters", + supported: ">=6.0.0", + version: "5.9.9", + }, }, ], }, @@ -1320,8 +1546,12 @@ runTests([ options: [{ version: "5.9.9" }], errors: [ { - messageId: "no-rest-parameters", - data: { supported: "6.0.0", version: "5.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "rest-parameters", + supported: ">=6.0.0", + version: "5.9.9", + }, }, ], }, @@ -1330,8 +1560,12 @@ runTests([ options: [{ version: "5.9.9" }], errors: [ { - messageId: "no-rest-parameters", - data: { supported: "6.0.0", version: "5.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "rest-parameters", + supported: ">=6.0.0", + version: "5.9.9", + }, }, ], }, @@ -1340,8 +1574,12 @@ runTests([ options: [{ version: "5.9.9", ignores: ["classes"] }], errors: [ { - messageId: "no-rest-parameters", - data: { supported: "6.0.0", version: "5.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "rest-parameters", + supported: ">=6.0.0", + version: "5.9.9", + }, }, ], }, @@ -1350,8 +1588,12 @@ runTests([ options: [{ version: "5.9.9", ignores: ["classes"] }], errors: [ { - messageId: "no-rest-parameters", - data: { supported: "6.0.0", version: "5.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "rest-parameters", + supported: ">=6.0.0", + version: "5.9.9", + }, }, ], }, @@ -1409,8 +1651,12 @@ runTests([ options: [{ version: "4.9.9" }], errors: [ { - messageId: "no-spread-elements", - data: { supported: "5.0.0", version: "4.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "spread-elements", + supported: ">=5.0.0", + version: "4.9.9", + }, }, ], }, @@ -1419,12 +1665,20 @@ runTests([ options: [{ version: "4.9.9" }], errors: [ { - messageId: "no-spread-elements", - data: { supported: "5.0.0", version: "4.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "spread-elements", + supported: ">=5.0.0", + version: "4.9.9", + }, }, { - messageId: "no-spread-elements", - data: { supported: "5.0.0", version: "4.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "spread-elements", + supported: ">=5.0.0", + version: "4.9.9", + }, }, ], }, @@ -1433,8 +1687,12 @@ runTests([ options: [{ version: "4.9.9" }], errors: [ { - messageId: "no-spread-elements", - data: { supported: "5.0.0", version: "4.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "spread-elements", + supported: ">=5.0.0", + version: "4.9.9", + }, }, ], }, @@ -1443,8 +1701,12 @@ runTests([ options: [{ version: "4.9.9" }], errors: [ { - messageId: "no-spread-elements", - data: { supported: "5.0.0", version: "4.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "spread-elements", + supported: ">=5.0.0", + version: "4.9.9", + }, }, ], }, @@ -1480,8 +1742,12 @@ runTests([ options: [{ version: "3.9.9" }], errors: [ { - messageId: "no-template-literals", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "template-literals", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -1490,8 +1756,12 @@ runTests([ options: [{ version: "3.9.9" }], errors: [ { - messageId: "no-template-literals", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "template-literals", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -1500,8 +1770,12 @@ runTests([ options: [{ version: "3.9.9" }], errors: [ { - messageId: "no-template-literals", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "template-literals", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -1510,15 +1784,19 @@ runTests([ options: [{ version: "3.9.9" }], errors: [ { - messageId: "no-template-literals", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "template-literals", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, ], }, { - keyword: "unicodeCodePointEscapes", + keyword: ["unicodeCodePointEscapes", "unicodeCodepointEscapes"], valid: [ { code: String.raw`var a = "\x61"`, @@ -1555,8 +1833,12 @@ runTests([ options: [{ version: "3.9.9" }], errors: [ { - messageId: "no-unicode-codepoint-escapes", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "unicode-codepoint-escapes", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -1565,8 +1847,12 @@ runTests([ options: [{ version: "3.9.9" }], errors: [ { - messageId: "no-unicode-codepoint-escapes", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "unicode-codepoint-escapes", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -1575,8 +1861,12 @@ runTests([ options: [{ version: "3.9.9" }], errors: [ { - messageId: "no-unicode-codepoint-escapes", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "unicode-codepoint-escapes", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -1585,8 +1875,12 @@ runTests([ options: [{ version: "3.9.9" }], errors: [ { - messageId: "no-unicode-codepoint-escapes", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "unicode-codepoint-escapes", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -1595,8 +1889,12 @@ runTests([ options: [{ version: "3.9.9", ignores: ["templateLiterals"] }], errors: [ { - messageId: "no-unicode-codepoint-escapes", - data: { supported: "4.0.0", version: "3.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "unicode-codepoint-escapes", + supported: ">=4.0.0", + version: "3.9.9", + }, }, ], }, @@ -1632,8 +1930,12 @@ runTests([ options: [{ version: "6.9.9" }], errors: [ { - messageId: "no-exponential-operators", - data: { supported: "7.0.0", version: "6.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "exponential-operators", + supported: ">=7.0.0", + version: "6.9.9", + }, }, ], }, @@ -1642,8 +1944,12 @@ runTests([ options: [{ version: "6.9.9" }], errors: [ { - messageId: "no-exponential-operators", - data: { supported: "7.0.0", version: "6.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "exponential-operators", + supported: ">=7.0.0", + version: "6.9.9", + }, }, ], }, @@ -1691,8 +1997,12 @@ runTests([ options: [{ version: "7.5.9" }], errors: [ { - messageId: "no-async-functions", - data: { supported: "7.6.0", version: "7.5.9" }, + messageId: "not-supported-till", + data: { + featureName: "async-functions", + supported: ">=7.6.0", + version: "7.5.9", + }, }, ], }, @@ -1701,8 +2011,12 @@ runTests([ options: [{ version: "7.5.9" }], errors: [ { - messageId: "no-async-functions", - data: { supported: "7.6.0", version: "7.5.9" }, + messageId: "not-supported-till", + data: { + featureName: "async-functions", + supported: ">=7.6.0", + version: "7.5.9", + }, }, ], }, @@ -1711,8 +2025,12 @@ runTests([ options: [{ version: "7.5.9" }], errors: [ { - messageId: "no-async-functions", - data: { supported: "7.6.0", version: "7.5.9" }, + messageId: "not-supported-till", + data: { + featureName: "async-functions", + supported: ">=7.6.0", + version: "7.5.9", + }, }, ], }, @@ -1721,8 +2039,12 @@ runTests([ options: [{ version: "7.5.9" }], errors: [ { - messageId: "no-async-functions", - data: { supported: "7.6.0", version: "7.5.9" }, + messageId: "not-supported-till", + data: { + featureName: "async-functions", + supported: ">=7.6.0", + version: "7.5.9", + }, }, ], }, @@ -1731,8 +2053,12 @@ runTests([ options: [{ version: "7.5.9" }], errors: [ { - messageId: "no-async-functions", - data: { supported: "7.6.0", version: "7.5.9" }, + messageId: "not-supported-till", + data: { + featureName: "async-functions", + supported: ">=7.6.0", + version: "7.5.9", + }, }, ], }, @@ -1741,8 +2067,12 @@ runTests([ options: [{ version: "7.5.9" }], errors: [ { - messageId: "no-async-functions", - data: { supported: "7.6.0", version: "7.5.9" }, + messageId: "not-supported-till", + data: { + featureName: "async-functions", + supported: ">=7.6.0", + version: "7.5.9", + }, }, ], }, @@ -1751,15 +2081,19 @@ runTests([ options: [{ version: "7.5.9" }], errors: [ { - messageId: "no-async-functions", - data: { supported: "7.6.0", version: "7.5.9" }, + messageId: "not-supported-till", + data: { + featureName: "async-functions", + supported: ">=7.6.0", + version: "7.5.9", + }, }, ], }, ], }, { - keyword: "trailingCommasInFunctions", + keyword: ["trailingCommasInFunctions", "trailingFunctionCommas"], valid: [ { code: "function f(a,) {}", @@ -1800,8 +2134,12 @@ runTests([ options: [{ version: "7.9.9" }], errors: [ { - messageId: "no-trailing-function-commas", - data: { supported: "8.0.0", version: "7.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "trailing-function-commas", + supported: ">=8.0.0", + version: "7.9.9", + }, }, ], }, @@ -1810,8 +2148,12 @@ runTests([ options: [{ version: "7.9.9" }], errors: [ { - messageId: "no-trailing-function-commas", - data: { supported: "8.0.0", version: "7.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "trailing-function-commas", + supported: ">=8.0.0", + version: "7.9.9", + }, }, ], }, @@ -1820,8 +2162,12 @@ runTests([ options: [{ version: "7.9.9" }], errors: [ { - messageId: "no-trailing-function-commas", - data: { supported: "8.0.0", version: "7.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "trailing-function-commas", + supported: ">=8.0.0", + version: "7.9.9", + }, }, ], }, @@ -1830,8 +2176,12 @@ runTests([ options: [{ version: "7.9.9" }], errors: [ { - messageId: "no-trailing-function-commas", - data: { supported: "8.0.0", version: "7.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "trailing-function-commas", + supported: ">=8.0.0", + version: "7.9.9", + }, }, ], }, @@ -1840,8 +2190,12 @@ runTests([ options: [{ version: "7.9.9" }], errors: [ { - messageId: "no-trailing-function-commas", - data: { supported: "8.0.0", version: "7.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "trailing-function-commas", + supported: ">=8.0.0", + version: "7.9.9", + }, }, ], }, @@ -1850,8 +2204,12 @@ runTests([ options: [{ version: "7.9.9" }], errors: [ { - messageId: "no-trailing-function-commas", - data: { supported: "8.0.0", version: "7.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "trailing-function-commas", + supported: ">=8.0.0", + version: "7.9.9", + }, }, ], }, @@ -1860,8 +2218,12 @@ runTests([ options: [{ version: "7.9.9" }], errors: [ { - messageId: "no-trailing-function-commas", - data: { supported: "8.0.0", version: "7.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "trailing-function-commas", + supported: ">=8.0.0", + version: "7.9.9", + }, }, ], }, @@ -1870,8 +2232,12 @@ runTests([ options: [{ version: "7.9.9" }], errors: [ { - messageId: "no-trailing-function-commas", - data: { supported: "8.0.0", version: "7.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "trailing-function-commas", + supported: ">=8.0.0", + version: "7.9.9", + }, }, ], }, @@ -1927,8 +2293,12 @@ runTests([ options: [{ version: "9.9.9" }], errors: [ { - messageId: "no-async-iteration", - data: { supported: "10.0.0", version: "9.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "async-iteration", + supported: ">=10.0.0", + version: "9.9.9", + }, }, ], }, @@ -1937,8 +2307,12 @@ runTests([ options: [{ version: "9.9.9" }], errors: [ { - messageId: "no-async-iteration", - data: { supported: "10.0.0", version: "9.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "async-iteration", + supported: ">=10.0.0", + version: "9.9.9", + }, }, ], }, @@ -1947,8 +2321,12 @@ runTests([ options: [{ version: "9.9.9" }], errors: [ { - messageId: "no-async-iteration", - data: { supported: "10.0.0", version: "9.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "async-iteration", + supported: ">=10.0.0", + version: "9.9.9", + }, }, ], }, @@ -1957,8 +2335,12 @@ runTests([ options: [{ version: "9.9.9" }], errors: [ { - messageId: "no-async-iteration", - data: { supported: "10.0.0", version: "9.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "async-iteration", + supported: ">=10.0.0", + version: "9.9.9", + }, }, ], }, @@ -1967,8 +2349,12 @@ runTests([ options: [{ version: "9.9.9" }], errors: [ { - messageId: "no-async-iteration", - data: { supported: "10.0.0", version: "9.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "async-iteration", + supported: ">=10.0.0", + version: "9.9.9", + }, }, ], }, @@ -1977,8 +2363,12 @@ runTests([ options: [{ version: "9.9.9" }], errors: [ { - messageId: "no-async-iteration", - data: { supported: "10.0.0", version: "9.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "async-iteration", + supported: ">=10.0.0", + version: "9.9.9", + }, }, ], }, @@ -1998,15 +2388,19 @@ runTests([ options: [{ version: "8.9.9" }], errors: [ { - messageId: "no-malformed-template-literals", - data: { supported: "8.10.0", version: "8.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "malformed-template-literals", + supported: ">=8.10.0", + version: "8.9.9", + }, }, ], }, ], }, { - keyword: "regexpLookbehind", + keyword: ["regexpLookbehind", "regexpLookbehindAssertions"], valid: [ { code: "var a = /(?<=a)foo/", @@ -2039,8 +2433,12 @@ runTests([ options: [{ version: "8.9.9" }], errors: [ { - messageId: "no-regexp-lookbehind-assertions", - data: { supported: "8.10.0", version: "8.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "regexp-lookbehind-assertions", + supported: ">=8.10.0", + version: "8.9.9", + }, }, ], }, @@ -2049,8 +2447,12 @@ runTests([ options: [{ version: "8.9.9" }], errors: [ { - messageId: "no-regexp-lookbehind-assertions", - data: { supported: "8.10.0", version: "8.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "regexp-lookbehind-assertions", + supported: ">=8.10.0", + version: "8.9.9", + }, }, ], }, @@ -2059,8 +2461,12 @@ runTests([ options: [{ version: "8.9.9" }], errors: [ { - messageId: "no-regexp-lookbehind-assertions", - data: { supported: "8.10.0", version: "8.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "regexp-lookbehind-assertions", + supported: ">=8.10.0", + version: "8.9.9", + }, }, ], }, @@ -2100,8 +2506,12 @@ runTests([ options: [{ version: "9.9.9" }], errors: [ { - messageId: "no-regexp-named-capture-groups", - data: { supported: "10.0.0", version: "9.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "regexp-named-capture-groups", + supported: ">=10.0.0", + version: "9.9.9", + }, }, ], }, @@ -2110,8 +2520,12 @@ runTests([ options: [{ version: "9.9.9" }], errors: [ { - messageId: "no-regexp-named-capture-groups", - data: { supported: "10.0.0", version: "9.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "regexp-named-capture-groups", + supported: ">=10.0.0", + version: "9.9.9", + }, }, ], }, @@ -2120,15 +2534,19 @@ runTests([ options: [{ version: "9.9.9" }], errors: [ { - messageId: "no-regexp-named-capture-groups", - data: { supported: "10.0.0", version: "9.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "regexp-named-capture-groups", + supported: ">=10.0.0", + version: "9.9.9", + }, }, ], }, ], }, { - keyword: "regexpS", + keyword: ["regexpS", "regexpSFlag"], valid: [ { code: "var a = /foo/s", @@ -2153,8 +2571,12 @@ runTests([ options: [{ version: "8.9.9" }], errors: [ { - messageId: "no-regexp-s-flag", - data: { supported: "8.10.0", version: "8.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "regexp-s-flag", + supported: ">=8.10.0", + version: "8.9.9", + }, }, ], }, @@ -2163,15 +2585,19 @@ runTests([ options: [{ version: "8.9.9" }], errors: [ { - messageId: "no-regexp-s-flag", - data: { supported: "8.10.0", version: "8.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "regexp-s-flag", + supported: ">=8.10.0", + version: "8.9.9", + }, }, ], }, ], }, { - keyword: "regexpUnicodeProperties", + keyword: ["regexpUnicodeProperties", "regexpUnicodePropertyEscapes"], valid: [ { code: "var a = /\\p{Letter}/u", @@ -2204,8 +2630,12 @@ runTests([ options: [{ version: "9.9.9" }], errors: [ { - messageId: "no-regexp-unicode-property-escapes", - data: { supported: "10.0.0", version: "9.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "regexp-unicode-property-escapes", + supported: ">=10.0.0", + version: "9.9.9", + }, }, ], }, @@ -2214,8 +2644,12 @@ runTests([ options: [{ version: "9.9.9" }], errors: [ { - messageId: "no-regexp-unicode-property-escapes", - data: { supported: "10.0.0", version: "9.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "regexp-unicode-property-escapes", + supported: ">=10.0.0", + version: "9.9.9", + }, }, ], }, @@ -2224,8 +2658,12 @@ runTests([ options: [{ version: "9.9.9" }], errors: [ { - messageId: "no-regexp-unicode-property-escapes", - data: { supported: "10.0.0", version: "9.9.9" }, + messageId: "not-supported-till", + data: { + featureName: "regexp-unicode-property-escapes", + supported: ">=10.0.0", + version: "9.9.9", + }, }, ], }, @@ -2273,8 +2711,12 @@ runTests([ options: [{ version: "8.2.9" }], errors: [ { - messageId: "no-rest-spread-properties", - data: { supported: "8.3.0", version: "8.2.9" }, + messageId: "not-supported-till", + data: { + featureName: "rest-spread-properties", + supported: ">=8.3.0", + version: "8.2.9", + }, }, ], }, @@ -2283,8 +2725,12 @@ runTests([ options: [{ version: "8.2.9" }], errors: [ { - messageId: "no-rest-spread-properties", - data: { supported: "8.3.0", version: "8.2.9" }, + messageId: "not-supported-till", + data: { + featureName: "rest-spread-properties", + supported: ">=8.3.0", + version: "8.2.9", + }, }, ], }, @@ -2324,10 +2770,11 @@ runTests([ options: [{ version: "9.99.99" }], errors: [ { - messageId: "no-json-superset", + messageId: "not-supported-till", data: { + featureName: "json-superset", code: "2028", - supported: "10.0.0", + supported: ">=10.0.0", version: "9.99.99", }, }, @@ -2338,10 +2785,11 @@ runTests([ options: [{ version: "9.99.99" }], errors: [ { - messageId: "no-json-superset", + messageId: "not-supported-till", data: { + featureName: "json-superset", code: "2029", - supported: "10.0.0", + supported: ">=10.0.0", version: "9.99.99", }, }, @@ -2367,8 +2815,12 @@ runTests([ options: [{ version: "9.99.99" }], errors: [ { - messageId: "no-optional-catch-binding", - data: { supported: "10.0.0", version: "9.99.99" }, + messageId: "not-supported-till", + data: { + featureName: "optional-catch-binding", + supported: ">=10.0.0", + version: "9.99.99", + }, }, ], }, @@ -2388,15 +2840,15 @@ runTests([ }, { code: "var n = BigInt(0)", - options: [{ version: "10.3.0" }], + options: [{ version: "10.4.0" }], }, { code: "var n = new BigInt64Array()", - options: [{ version: "10.3.0" }], + options: [{ version: "10.4.0" }], }, { code: "var n = new BigUint64Array()", - options: [{ version: "10.3.0" }], + options: [{ version: "10.4.0" }], }, { code: "var n = { [0n]: 0 }", @@ -2413,40 +2865,43 @@ runTests([ options: [{ version: "10.3.0" }], errors: [ { - messageId: "no-bigint", + messageId: "not-supported-till", data: { - supported: "10.4.0", + featureName: "bigint", + 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", - }, - }, - ], - }, + // { + // code: "var n = { 0n: 0 }", + // options: [{ version: "12.0.0" }], + // errors: [ + // { + // messageId: "not-supported-till", + // data: { + // featureName: "bigint-property-names", + // supported: null, + // version: "12.0.0", + // }, + // }, + // ], + // }, + // { + // code: "var n = class { 0n() {} }", + // options: [{ version: "12.0.0" }], + // errors: [ + // { + // messageId: "not-supported-till", + // data: { + // featureName: "bigint-property-names", + // supported: null, + // version: "12.0.0", + // }, + // }, + // ], + // }, ], }, { @@ -2457,28 +2912,29 @@ runTests([ 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 => ({ + options: [{ version: "12.17.0" }], + }, + { code: "import(source)", - options: [{ version: v }], - errors: [ - { - messageId: "no-dynamic-import", - data: { - supported: new Range( - ">=12.17 <13 || >=13.2" - ).toString(), - version: v, - }, - }, - ], - })), + options: [{ version: "13.2.0" }], + }, ], + invalid: ["12.16.0", "13.0.0", "13.1.0", ">=8.0.0"].map(version => ({ + code: "import(source)", + options: [{ version: version }], + errors: [ + { + messageId: "not-supported-till", + data: { + featureName: "dynamic-import", + supported: "^12.17.0 || >=13.2.0", + version: version, + }, + }, + ], + })), }, { keyword: "optionalChaining", @@ -2495,9 +2951,10 @@ runTests([ options: [{ version: "13.0.0" }], errors: [ { - messageId: "no-optional-chaining", + messageId: "not-supported-till", data: { - supported: "14.0.0", + featureName: "optional-chaining", + supported: ">=14.0.0", version: "13.0.0", }, }, @@ -2526,9 +2983,10 @@ runTests([ options: [{ version: "13.0.0" }], errors: [ { - messageId: "no-nullish-coalescing-operators", + messageId: "not-supported-till", data: { - supported: "14.0.0", + featureName: "nullish-coalescing-operators", + supported: ">=14.0.0", version: "13.0.0", }, }, @@ -2541,9 +2999,10 @@ runTests([ }, errors: [ { - messageId: "no-nullish-coalescing-operators", + messageId: "not-supported-till", data: { - supported: "14.0.0", + featureName: "nullish-coalescing-operators", + supported: ">=14.0.0", version: "13.0.0", }, }, @@ -2578,9 +3037,10 @@ runTests([ options: [{ version: "14.0.0" }], errors: [ { - messageId: "no-logical-assignment-operators", + messageId: "not-supported-till", data: { - supported: "15.0.0", + featureName: "logical-assignment-operators", + supported: ">=15.0.0", version: "14.0.0", }, }, @@ -2591,9 +3051,10 @@ runTests([ options: [{ version: "14.0.0" }], errors: [ { - messageId: "no-logical-assignment-operators", + messageId: "not-supported-till", data: { - supported: "15.0.0", + featureName: "logical-assignment-operators", + supported: ">=15.0.0", version: "14.0.0", }, }, @@ -2604,9 +3065,10 @@ runTests([ options: [{ version: "14.0.0" }], errors: [ { - messageId: "no-logical-assignment-operators", + messageId: "not-supported-till", data: { - supported: "15.0.0", + featureName: "logical-assignment-operators", + supported: ">=15.0.0", version: "14.0.0", }, }, @@ -2629,9 +3091,10 @@ runTests([ options: [{ version: "12.4.0" }], errors: [ { - messageId: "no-numeric-separators", + messageId: "not-supported-till", data: { - supported: "12.5.0", + featureName: "numeric-separators", + supported: ">=12.5.0", version: "12.4.0", }, }, @@ -2702,8 +3165,12 @@ runTests([ code: "var a = () => 1", errors: [ { - messageId: "no-arrow-functions", - data: { supported: "4.0.0", version: ">=0.12.8" }, + messageId: "not-supported-till", + data: { + featureName: "arrow-functions", + supported: ">=4.0.0", + version: ">=0.12.8", + }, }, ], }, @@ -2713,8 +3180,12 @@ runTests([ options: [{ version: ">=8.0.0" }], errors: [ { - messageId: "no-rest-spread-properties", - data: { supported: "8.3.0", version: ">=8.0.0" }, + messageId: "not-supported-till", + data: { + featureName: "rest-spread-properties", + supported: ">=8.3.0", + version: ">=8.0.0", + }, }, ], }, @@ -2723,8 +3194,12 @@ runTests([ code: "var a = () => 1", errors: [ { - messageId: "no-arrow-functions", - data: { supported: "4.0.0", version: "<6.0.0" }, + messageId: "not-supported-till", + data: { + featureName: "arrow-functions", + supported: ">=4.0.0", + version: "<6.0.0", + }, }, ], }, @@ -2734,8 +3209,12 @@ runTests([ options: [{ version: ">=8.0.0" }], errors: [ { - messageId: "no-rest-spread-properties", - data: { supported: "8.3.0", version: ">=8.0.0" }, + messageId: "not-supported-till", + data: { + featureName: "rest-spread-properties", + supported: ">=8.3.0", + version: ">=8.0.0", + }, }, ], }, @@ -2744,8 +3223,12 @@ runTests([ code: "var a = async () => 1", errors: [ { - messageId: "no-async-functions", - data: { supported: "7.6.0", version: ">=7.5.0" }, + messageId: "not-supported-till", + data: { + featureName: "async-functions", + supported: ">=7.6.0", + version: ">=7.5.0", + }, }, ], }, @@ -2754,8 +3237,12 @@ runTests([ code: '"use strict"; let a = 1', errors: [ { - messageId: "no-block-scoped-variables-strict", - data: { supported: "4.0.0", version: "*" }, + messageId: "not-supported-till", + data: { + featureName: "block-scoped-variables", + supported: ">=4.0.0", + version: "*", + }, }, ], }, @@ -2764,8 +3251,12 @@ runTests([ options: [{ version: "7.1.0" }], errors: [ { - messageId: "no-async-functions", - data: { supported: "7.6.0", version: "7.1.0" }, + messageId: "not-supported-till", + data: { + featureName: "async-functions", + supported: ">=7.6.0", + version: "7.1.0", + }, }, ], }, @@ -2776,8 +3267,12 @@ runTests([ }, errors: [ { - messageId: "no-async-functions", - data: { supported: "7.6.0", version: "7.1.0" }, + messageId: "not-supported-till", + data: { + featureName: "async-functions", + supported: ">=7.6.0", + version: "7.1.0", + }, }, ], },