diff --git a/packages/core-js/internals/native-raw-json.js b/packages/core-js/internals/native-raw-json.js index f37892e2f425..96b353103eac 100644 --- a/packages/core-js/internals/native-raw-json.js +++ b/packages/core-js/internals/native-raw-json.js @@ -4,6 +4,8 @@ var fails = require('../internals/fails'); module.exports = !fails(function () { var unsafeInt = '9007199254740993'; + // eslint-disable-next-line es/no-nonstandard-json-properties -- feature detection var raw = JSON.rawJSON(unsafeInt); + // eslint-disable-next-line es/no-nonstandard-json-properties -- feature detection return !JSON.isRawJSON(raw) || JSON.stringify(raw) !== unsafeInt; }); diff --git a/packages/core-js/modules/esnext.array.from-async.js b/packages/core-js/modules/esnext.array.from-async.js index 3d483137aa0e..1d9e61549fee 100644 --- a/packages/core-js/modules/esnext.array.from-async.js +++ b/packages/core-js/modules/esnext.array.from-async.js @@ -3,6 +3,7 @@ var $ = require('../internals/export'); var fromAsync = require('../internals/array-from-async'); var fails = require('../internals/fails'); +// eslint-disable-next-line es/no-nonstandard-array-properties -- safe var nativeFromAsync = Array.fromAsync; // https://bugs.webkit.org/show_bug.cgi?id=271703 var INCORRECT_CONSTRUCTURING = !nativeFromAsync || fails(function () { diff --git a/packages/core-js/modules/esnext.regexp.escape.js b/packages/core-js/modules/esnext.regexp.escape.js index 31af8a2545f2..04c18705dea3 100644 --- a/packages/core-js/modules/esnext.regexp.escape.js +++ b/packages/core-js/modules/esnext.regexp.escape.js @@ -7,6 +7,7 @@ var padStart = require('../internals/string-pad').start; var WHITESPACES = require('../internals/whitespaces'); var $Array = Array; +// eslint-disable-next-line es/no-nonstandard-regexp-properties -- safe var $escape = RegExp.escape; var charAt = uncurryThis(''.charAt); var charCodeAt = uncurryThis(''.charCodeAt); diff --git a/tests/compat/tests.js b/tests/compat/tests.js index 13289840c645..d05f7001e4ce 100644 --- a/tests/compat/tests.js +++ b/tests/compat/tests.js @@ -374,6 +374,7 @@ GLOBAL.tests = { return { foo: 1 }; }; + // eslint-disable-next-line es/no-nonstandard-array-prototype-properties -- @@species return array1.concat()[0] === array1 && array2.concat().foo === 1; }, 'es.array.copy-within': function () { @@ -395,6 +396,7 @@ GLOBAL.tests = { constructor[Symbol.species] = function () { return { foo: 1 }; }; + // eslint-disable-next-line es/no-nonstandard-array-prototype-properties -- @@species return array.filter(Boolean).foo === 1; }, 'es.array.find': function () { @@ -475,6 +477,7 @@ GLOBAL.tests = { constructor[Symbol.species] = function () { return { foo: 1 }; }; + // eslint-disable-next-line es/no-nonstandard-array-prototype-properties -- @@species return array.map(function () { return true; }).foo === 1; }, 'es.array.of': function () { @@ -513,6 +516,7 @@ GLOBAL.tests = { constructor[Symbol.species] = function () { return { foo: 1 }; }; + // eslint-disable-next-line es/no-nonstandard-array-prototype-properties -- @@species return array.slice().foo === 1; }, 'es.array.some': function () { @@ -569,6 +573,7 @@ GLOBAL.tests = { constructor[Symbol.species] = function () { return { foo: 1 }; }; + // eslint-disable-next-line es/no-nonstandard-array-prototype-properties -- @@species return array.splice().foo === 1; }, 'es.array.to-reversed': function () { diff --git a/tests/eslint/eslint.config.js b/tests/eslint/eslint.config.js index 8f74b3348e39..3223132e4e34 100644 --- a/tests/eslint/eslint.config.js +++ b/tests/eslint/eslint.config.js @@ -1059,6 +1059,280 @@ const useES3Syntax = { 'unicorn/prefer-optional-catch-binding': OFF, }; +const forbidNonStandardBuiltIns = { + // disallow non-standard built-in methods + 'es/no-nonstandard-array-properties': ERROR, + 'es/no-nonstandard-array-prototype-properties': ERROR, + 'es/no-nonstandard-arraybuffer-properties': ERROR, + 'es/no-nonstandard-arraybuffer-prototype-properties': ERROR, + 'es/no-nonstandard-atomics-properties': ERROR, + 'es/no-nonstandard-bigint-properties': ERROR, + 'es/no-nonstandard-bigint-prototype-properties': ERROR, + 'es/no-nonstandard-boolean-properties': ERROR, + 'es/no-nonstandard-boolean-prototype-properties': ERROR, + 'es/no-nonstandard-dataview-properties': ERROR, + 'es/no-nonstandard-dataview-prototype-properties': ERROR, + 'es/no-nonstandard-date-properties': ERROR, + 'es/no-nonstandard-date-prototype-properties': ERROR, + 'es/no-nonstandard-finalizationregistry-properties': ERROR, + 'es/no-nonstandard-finalizationregistry-prototype-properties': ERROR, + 'es/no-nonstandard-function-properties': ERROR, + 'es/no-nonstandard-intl-collator-properties': ERROR, + 'es/no-nonstandard-intl-collator-prototype-properties': ERROR, + 'es/no-nonstandard-intl-datetimeformat-properties': ERROR, + 'es/no-nonstandard-intl-datetimeformat-prototype-properties': ERROR, + 'es/no-nonstandard-intl-displaynames-properties': ERROR, + 'es/no-nonstandard-intl-displaynames-prototype-properties': ERROR, + 'es/no-nonstandard-intl-listformat-properties': ERROR, + 'es/no-nonstandard-intl-listformat-prototype-properties': ERROR, + 'es/no-nonstandard-intl-locale-properties': ERROR, + 'es/no-nonstandard-intl-locale-prototype-properties': ERROR, + 'es/no-nonstandard-intl-numberformat-properties': ERROR, + 'es/no-nonstandard-intl-numberformat-prototype-properties': ERROR, + 'es/no-nonstandard-intl-pluralrules-properties': ERROR, + 'es/no-nonstandard-intl-pluralrules-prototype-properties': ERROR, + 'es/no-nonstandard-intl-properties': ERROR, + 'es/no-nonstandard-intl-relativetimeformat-properties': ERROR, + 'es/no-nonstandard-intl-relativetimeformat-prototype-properties': ERROR, + 'es/no-nonstandard-intl-segmenter-properties': ERROR, + 'es/no-nonstandard-intl-segmenter-prototype-properties': ERROR, + 'es/no-nonstandard-iterator-properties': ERROR, + 'es/no-nonstandard-iterator-prototype-properties': ERROR, + 'es/no-nonstandard-json-properties': ERROR, + 'es/no-nonstandard-map-properties': ERROR, + 'es/no-nonstandard-map-prototype-properties': ERROR, + 'es/no-nonstandard-math-properties': ERROR, + 'es/no-nonstandard-number-properties': ERROR, + 'es/no-nonstandard-number-prototype-properties': ERROR, + 'es/no-nonstandard-object-properties': ERROR, + 'es/no-nonstandard-promise-properties': ERROR, + 'es/no-nonstandard-promise-prototype-properties': ERROR, + 'es/no-nonstandard-proxy-properties': ERROR, + 'es/no-nonstandard-reflect-properties': ERROR, + 'es/no-nonstandard-regexp-properties': ERROR, + 'es/no-nonstandard-regexp-prototype-properties': ERROR, + 'es/no-nonstandard-set-properties': ERROR, + 'es/no-nonstandard-set-prototype-properties': ERROR, + 'es/no-nonstandard-sharedarraybuffer-properties': ERROR, + 'es/no-nonstandard-sharedarraybuffer-prototype-properties': ERROR, + 'es/no-nonstandard-string-properties': ERROR, + 'es/no-nonstandard-string-prototype-properties': ERROR, + 'es/no-nonstandard-symbol-properties': [ERROR, { allow: [ + 'sham', // non-standard flag + ] }], + 'es/no-nonstandard-symbol-prototype-properties': ERROR, + 'es/no-nonstandard-typed-array-properties': ERROR, + 'es/no-nonstandard-typed-array-prototype-properties': ERROR, + 'es/no-nonstandard-weakmap-properties': ERROR, + 'es/no-nonstandard-weakmap-prototype-properties': ERROR, + 'es/no-nonstandard-weakref-properties': ERROR, + 'es/no-nonstandard-weakref-prototype-properties': ERROR, + 'es/no-nonstandard-weakset-properties': ERROR, + 'es/no-nonstandard-weakset-prototype-properties': ERROR, +}; + +const forbidCompletelyNonExistentBuiltIns = { + ...forbidNonStandardBuiltIns, + // disallow non-standard built-in methods + 'es/no-nonstandard-array-properties': [ERROR, { allow: [ + 'fromAsync', + 'isTemplateObject', + ] }], + 'es/no-nonstandard-array-prototype-properties': [ERROR, { allow: [ + 'filterReject', + 'uniqueBy', + // TODO: drop from `core-js@4` + 'filterOut', + 'group', + 'groupBy', + 'groupByToMap', + 'groupToMap', + 'lastIndex', + 'lastItem', + ] }], + 'es/no-nonstandard-bigint-properties': [ERROR, { allow: [ + // TODO: drop from `core-js@4` + 'range', + ] }], + 'es/no-nonstandard-dataview-prototype-properties': [ERROR, { allow: [ + 'getFloat16', + 'getUint8Clamped', + 'setFloat16', + 'setUint8Clamped', + ] }], + 'es/no-nonstandard-function-properties': [ERROR, { allow: [ + 'isCallable', + 'isConstructor', + ] }], + 'es/no-nonstandard-iterator-properties': [ERROR, { allow: [ + 'concat', + 'range', + ] }], + 'es/no-nonstandard-iterator-prototype-properties': [ERROR, { allow: [ + 'toAsync', + // TODO: drop from `core-js@4` + 'asIndexedPairs', + 'indexed', + ] }], + 'es/no-nonstandard-json-properties': [ERROR, { allow: [ + 'isRawJSON', + 'rawJSON', + ] }], + 'es/no-nonstandard-map-properties': [ERROR, { allow: [ + 'from', + 'of', + // TODO: drop from `core-js@4` + 'keyBy', + ] }], + 'es/no-nonstandard-map-prototype-properties': [ERROR, { allow: [ + 'getOrInsert', + 'getOrInsertComputed', + // TODO: drop from `core-js@4` + 'deleteAll', + 'emplace', + 'every', + 'filter', + 'find', + 'findKey', + 'includes', + 'keyOf', + 'mapKeys', + 'mapValues', + 'merge', + 'reduce', + 'some', + 'update', + 'updateOrInsert', + 'upsert', + ] }], + 'es/no-nonstandard-math-properties': [ERROR, { allow: [ + 'f16round', + 'sumPrecise', + // TODO: drop from `core-js@4` + 'DEG_PER_RAD', + 'RAD_PER_DEG', + 'clamp', + 'degrees', + 'fscale', + 'iaddh', + 'imulh', + 'isubh', + 'radians', + 'scale', + 'seededPRNG', + 'signbit', + 'umulh', + ] }], + 'es/no-nonstandard-number-properties': [ERROR, { allow: [ + // TODO: drop from `core-js@4` + 'fromString', + 'range', + ] }], + 'es/no-nonstandard-object-properties': [ERROR, { allow: [ + // TODO: drop from `core-js@4` + 'iterateEntries', + 'iterateKeys', + 'iterateValues', + ] }], + 'es/no-nonstandard-reflect-properties': [ERROR, { allow: [ + // TODO: drop from `core-js@4` + 'defineMetadata', + 'deleteMetadata', + 'getMetadata', + 'getMetadataKeys', + 'getOwnMetadata', + 'getOwnMetadataKeys', + 'hasMetadata', + 'hasOwnMetadata', + 'metadata', + ] }], + 'es/no-nonstandard-regexp-properties': [ERROR, { allow: [ + 'escape', + ] }], + 'es/no-nonstandard-set-properties': [ERROR, { allow: [ + 'from', + 'of', + ] }], + 'es/no-nonstandard-set-prototype-properties': [ERROR, { allow: [ + // TODO: drop from `core-js@4` + 'addAll', + 'deleteAll', + 'every', + 'filter', + 'find', + 'join', + 'map', + 'reduce', + 'some', + ] }], + 'es/no-nonstandard-string-properties': [ERROR, { allow: [ + 'cooked', + 'dedent', + ] }], + 'es/no-nonstandard-string-prototype-properties': [ERROR, { allow: [ + // TODO: drop from `core-js@4` + 'codePoints', + ] }], + 'es/no-nonstandard-symbol-properties': [ERROR, { allow: [ + 'asyncDispose', + 'customMatcher', + 'dispose', + 'isRegisteredSymbol', + 'isWellKnownSymbol', + 'metadata', + 'sham', // non-standard flag + // TODO: drop from `core-js@4` + 'isRegistered', + 'isWellKnown', + 'matcher', + 'metadataKey', + 'observable', + 'patternMatch', + 'replaceAll', + 'useSetter', + 'useSimple', + ] }], + 'es/no-nonstandard-typed-array-properties': [ERROR, { allow: [ + 'fromBase64', + 'fromHex', + // TODO: drop from `core-js@4` + 'fromAsync', + ] }], + 'es/no-nonstandard-typed-array-prototype-properties': [ERROR, { allow: [ + 'filterReject', + 'uniqueBy', + // TODO: drop from `core-js@4` + 'filterOut', + 'groupBy', + 'setFromBase64', + 'setFromHex', + 'toBase64', + 'toHex', + 'toSpliced', + ] }], + 'es/no-nonstandard-weakmap-properties': [ERROR, { allow: [ + 'from', + 'of', + ] }], + 'es/no-nonstandard-weakmap-prototype-properties': [ERROR, { allow: [ + 'getOrInsert', + 'getOrInsertComputed', + // TODO: drop from `core-js@4` + 'deleteAll', + 'emplace', + 'upsert', + ] }], + 'es/no-nonstandard-weakset-properties': [ERROR, { allow: [ + 'from', + 'of', + ] }], + 'es/no-nonstandard-weakset-prototype-properties': [ERROR, { allow: [ + // TODO: drop from `core-js@4` + 'addAll', + 'deleteAll', + ] }], +}; + const forbidESAnnexBBuiltIns = { 'es/no-date-prototype-getyear-setyear': ERROR, 'es/no-date-prototype-togmtstring': ERROR, @@ -1384,6 +1658,7 @@ const transpiledAndPolyfilled = { // enforce using named capture group in regular expression 'regexp/prefer-named-capture-group': OFF, ...forbidSomeES2025Syntax, + ...forbidCompletelyNonExistentBuiltIns, }; const nodePackages = { @@ -1668,6 +1943,7 @@ const packagesPackageJSON = { const markdown = { ...disable(forbidModernBuiltIns), + ...forbidCompletelyNonExistentBuiltIns, // allow use of console 'no-console': OFF, // disallow use of new operator when not part of the assignment or comparison @@ -1781,6 +2057,7 @@ export default [ }, rules: { ...base, + ...forbidNonStandardBuiltIns, ...forbidESAnnexBBuiltIns, }, }, @@ -1827,7 +2104,10 @@ export default [ files: [ 'packages/core-js?(-pure)/**/instance/**', ], - rules: disable(forbidModernBuiltIns), + rules: { + ...disable(forbidModernBuiltIns), + ...forbidCompletelyNonExistentBuiltIns, + }, }, { files: [ @@ -1844,6 +2124,12 @@ export default [ ], rules: tests, }, + { + files: [ + 'tests/compat/tests.js', + ], + rules: forbidCompletelyNonExistentBuiltIns, + }, { files: [ 'tests/@(helpers|unit-@(global|pure))/**', diff --git a/tests/unit-global/es.array.concat.js b/tests/unit-global/es.array.concat.js index bc301ae97d32..eca9b7a1d911 100644 --- a/tests/unit-global/es.array.concat.js +++ b/tests/unit-global/es.array.concat.js @@ -30,5 +30,7 @@ QUnit.test('Array#concat', assert => { array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; + // https://bugs.webkit.org/show_bug.cgi?id=281061 + // eslint-disable-next-line es/no-nonstandard-array-prototype-properties -- @@species assert.same(array.concat().foo, 1, '@@species'); }); diff --git a/tests/unit-global/es.array.filter.js b/tests/unit-global/es.array.filter.js index 06be6b7606b4..ac68c3ad008e 100644 --- a/tests/unit-global/es.array.filter.js +++ b/tests/unit-global/es.array.filter.js @@ -26,5 +26,6 @@ QUnit.test('Array#filter', assert => { array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; + // eslint-disable-next-line es/no-nonstandard-array-prototype-properties -- @@species assert.same(array.filter(Boolean).foo, 1, '@@species'); }); diff --git a/tests/unit-global/es.array.from.js b/tests/unit-global/es.array.from.js index 28801a751d2f..4c958c0d4720 100644 --- a/tests/unit-global/es.array.from.js +++ b/tests/unit-global/es.array.from.js @@ -91,6 +91,7 @@ QUnit.test('Array.from', assert => { assert.arrayEqual(instance, [1, 2], 'generic, array-like case, elements'); let array = [1, 2, 3]; done = false; + // eslint-disable-next-line es/no-nonstandard-array-prototype-properties -- legacy FF case array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; diff --git a/tests/unit-global/es.array.map.js b/tests/unit-global/es.array.map.js index 8becfb759394..2e2d049c71a7 100644 --- a/tests/unit-global/es.array.map.js +++ b/tests/unit-global/es.array.map.js @@ -30,5 +30,6 @@ QUnit.test('Array#map', assert => { array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; + // eslint-disable-next-line es/no-nonstandard-array-prototype-properties -- @@species assert.same(array.map(Boolean).foo, 1, '@@species'); }); diff --git a/tests/unit-global/es.array.slice.js b/tests/unit-global/es.array.slice.js index 53cf34de2bc9..66de6ab2e880 100644 --- a/tests/unit-global/es.array.slice.js +++ b/tests/unit-global/es.array.slice.js @@ -35,5 +35,6 @@ QUnit.test('Array#slice', assert => { array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; + // eslint-disable-next-line es/no-nonstandard-array-prototype-properties -- @@species assert.same(array.slice().foo, 1, '@@species'); }); diff --git a/tests/unit-global/es.array.splice.js b/tests/unit-global/es.array.splice.js index ef1e51367491..16a39a72373a 100644 --- a/tests/unit-global/es.array.splice.js +++ b/tests/unit-global/es.array.splice.js @@ -43,5 +43,6 @@ QUnit.test('Array#splice', assert => { array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; + // eslint-disable-next-line es/no-nonstandard-array-prototype-properties -- @@species assert.same(array.splice().foo, 1, '@@species'); }); diff --git a/tests/unit-global/es.json.stringify.js b/tests/unit-global/es.json.stringify.js index 01701c2d617a..e97a414849c0 100644 --- a/tests/unit-global/es.json.stringify.js +++ b/tests/unit-global/es.json.stringify.js @@ -393,6 +393,7 @@ if (GLOBAL.JSON?.stringify) { const arr1 = []; const circular2 = [arr1]; + // eslint-disable-next-line es/no-nonstandard-array-prototype-properties -- testing arr1.toJSON = () => circular2; assert.throws(() => stringify(circular2), TypeError, 'value-tojson-array-circular'); @@ -408,12 +409,15 @@ if (GLOBAL.JSON?.stringify) { assert.same(stringify({ toJSON() { return [false]; } }), '[false]', 'value-tojson-result-1'); const arr2 = [true]; + // eslint-disable-next-line es/no-nonstandard-array-prototype-properties -- testing arr2.toJSON = () => { /* empty */ }; assert.same(stringify(arr2), undefined, 'value-tojson-result-2'); const str3 = new String('str'); + // eslint-disable-next-line es/no-nonstandard-string-prototype-properties -- testing str3.toJSON = () => null; assert.same(stringify({ key: str3 }), '{"key":null}', 'value-tojson-result-3'); const num3 = new Number(14); + // eslint-disable-next-line es/no-nonstandard-number-prototype-properties -- testing num3.toJSON = () => ({ key: 7 }); assert.same(stringify([num3]), '[{"key":7}]', 'value-tojson-result-4'); diff --git a/tests/unit-global/es.map.js b/tests/unit-global/es.map.js index 99ab19339541..3bba3cd4726a 100644 --- a/tests/unit-global/es.map.js +++ b/tests/unit-global/es.map.js @@ -32,6 +32,7 @@ QUnit.test('Map', assert => { assert.true(done, '.return #throw'); const array = []; done = false; + // eslint-disable-next-line es/no-nonstandard-array-prototype-properties -- legacy FF case array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; diff --git a/tests/unit-global/es.promise.all.js b/tests/unit-global/es.promise.all.js index 006a208fa8aa..b1b20db9e385 100644 --- a/tests/unit-global/es.promise.all.js +++ b/tests/unit-global/es.promise.all.js @@ -14,6 +14,7 @@ QUnit.test('Promise.all', assert => { assert.true(iterable.called, 'works with iterables: next called'); const array = []; let done = false; + // eslint-disable-next-line es/no-nonstandard-array-prototype-properties -- legacy FF case array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; diff --git a/tests/unit-global/es.promise.constructor.js b/tests/unit-global/es.promise.constructor.js index 11c366a48457..9c18e84b9743 100644 --- a/tests/unit-global/es.promise.constructor.js +++ b/tests/unit-global/es.promise.constructor.js @@ -124,6 +124,7 @@ if (PROTO) QUnit.test('Promise subclassing', assert => { function SubPromise(executor) { const self = new Promise(executor); setPrototypeOf(self, SubPromise.prototype); + // eslint-disable-next-line es/no-nonstandard-promise-prototype-properties -- safe self.mine = 'subclass'; return self; } diff --git a/tests/unit-global/es.promise.race.js b/tests/unit-global/es.promise.race.js index db04f5e06b6b..83c4bc1c126e 100644 --- a/tests/unit-global/es.promise.race.js +++ b/tests/unit-global/es.promise.race.js @@ -14,6 +14,7 @@ QUnit.test('Promise.race', assert => { assert.true(iterable.called, 'works with iterables: next called'); const array = []; let done = false; + // eslint-disable-next-line es/no-nonstandard-array-prototype-properties -- legacy FF case array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; diff --git a/tests/unit-global/es.set.js b/tests/unit-global/es.set.js index 9bd3ae93d480..9ee14d1e3183 100644 --- a/tests/unit-global/es.set.js +++ b/tests/unit-global/es.set.js @@ -53,6 +53,7 @@ QUnit.test('Set', assert => { assert.true(done, '.return #throw'); const array = []; done = false; + // eslint-disable-next-line es/no-nonstandard-array-prototype-properties -- legacy FF case array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; diff --git a/tests/unit-global/es.weak-map.js b/tests/unit-global/es.weak-map.js index 0c082b20f0f8..58c7aec921dc 100644 --- a/tests/unit-global/es.weak-map.js +++ b/tests/unit-global/es.weak-map.js @@ -40,6 +40,7 @@ QUnit.test('WeakMap', assert => { assert.false(('clear' in WeakMap.prototype), 'should not contains `.clear` method'); const array = []; done = false; + // eslint-disable-next-line es/no-nonstandard-array-prototype-properties -- legacy FF case array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; diff --git a/tests/unit-global/es.weak-set.js b/tests/unit-global/es.weak-set.js index 2297acbcb33b..4312240f04a1 100644 --- a/tests/unit-global/es.weak-set.js +++ b/tests/unit-global/es.weak-set.js @@ -34,6 +34,7 @@ QUnit.test('WeakSet', assert => { assert.false(('clear' in WeakSet.prototype), 'should not contains `.clear` method'); const array = []; done = false; + // eslint-disable-next-line es/no-nonstandard-array-prototype-properties -- legacy FF case array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; diff --git a/tests/unit-pure/es.array.concat.js b/tests/unit-pure/es.array.concat.js index 8a1ffc2555cd..ad3e54d46444 100644 --- a/tests/unit-pure/es.array.concat.js +++ b/tests/unit-pure/es.array.concat.js @@ -28,5 +28,6 @@ QUnit.test('Array#concat', assert => { array.constructor = { [Symbol.species]: function () { return { foo: 1 }; } }; + // https://bugs.webkit.org/show_bug.cgi?id=281061 assert.same(concat(array).foo, 1, '@@species'); }); diff --git a/tests/unit-pure/es.array.from.js b/tests/unit-pure/es.array.from.js index aab54db9c110..5fa36f77956c 100644 --- a/tests/unit-pure/es.array.from.js +++ b/tests/unit-pure/es.array.from.js @@ -90,6 +90,7 @@ QUnit.test('Array.from', assert => { assert.arrayEqual(instance, [1, 2], 'generic, array-like case, elements'); let array = [1, 2, 3]; done = false; + // eslint-disable-next-line es/no-nonstandard-array-prototype-properties -- legacy FF case array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; diff --git a/tests/unit-pure/es.json.stringify.js b/tests/unit-pure/es.json.stringify.js index e2a54df76f45..aaf7511f1f44 100644 --- a/tests/unit-pure/es.json.stringify.js +++ b/tests/unit-pure/es.json.stringify.js @@ -394,6 +394,7 @@ if (GLOBAL.JSON?.stringify) { const arr1 = []; const circular2 = [arr1]; + // eslint-disable-next-line es/no-nonstandard-array-prototype-properties -- testing arr1.toJSON = () => circular2; assert.throws(() => stringify(circular2), TypeError, 'value-tojson-array-circular'); @@ -409,12 +410,15 @@ if (GLOBAL.JSON?.stringify) { assert.same(stringify({ toJSON() { return [false]; } }), '[false]', 'value-tojson-result-1'); const arr2 = [true]; + // eslint-disable-next-line es/no-nonstandard-array-prototype-properties -- testing arr2.toJSON = () => { /* empty */ }; assert.same(stringify(arr2), undefined, 'value-tojson-result-2'); const str3 = new String('str'); + // eslint-disable-next-line es/no-nonstandard-string-prototype-properties -- testing str3.toJSON = () => null; assert.same(stringify({ key: str3 }), '{"key":null}', 'value-tojson-result-3'); const num3 = new Number(14); + // eslint-disable-next-line es/no-nonstandard-number-prototype-properties -- testing num3.toJSON = () => ({ key: 7 }); assert.same(stringify([num3]), '[{"key":7}]', 'value-tojson-result-4'); diff --git a/tests/unit-pure/es.map.js b/tests/unit-pure/es.map.js index a7f9ea919aa1..9e07427e6571 100644 --- a/tests/unit-pure/es.map.js +++ b/tests/unit-pure/es.map.js @@ -37,6 +37,7 @@ QUnit.test('Map', assert => { assert.true(done, '.return #throw'); const array = []; done = false; + // eslint-disable-next-line es/no-nonstandard-array-prototype-properties -- legacy FF case array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; diff --git a/tests/unit-pure/es.promise.all.js b/tests/unit-pure/es.promise.all.js index ed463f530299..d5e95abbff8d 100644 --- a/tests/unit-pure/es.promise.all.js +++ b/tests/unit-pure/es.promise.all.js @@ -15,6 +15,7 @@ QUnit.test('Promise.all', assert => { assert.true(iterable.called, 'works with iterables: next called'); const array = []; let done = false; + // eslint-disable-next-line es/no-nonstandard-array-prototype-properties -- legacy FF case array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; diff --git a/tests/unit-pure/es.promise.race.js b/tests/unit-pure/es.promise.race.js index e5a39c1f301b..030013d53c89 100644 --- a/tests/unit-pure/es.promise.race.js +++ b/tests/unit-pure/es.promise.race.js @@ -15,6 +15,7 @@ QUnit.test('Promise.race', assert => { assert.true(iterable.called, 'works with iterables: next called'); const array = []; let done = false; + // eslint-disable-next-line es/no-nonstandard-array-prototype-properties -- legacy FF case array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; diff --git a/tests/unit-pure/es.set.js b/tests/unit-pure/es.set.js index 709133023b9e..75a237c83595 100644 --- a/tests/unit-pure/es.set.js +++ b/tests/unit-pure/es.set.js @@ -56,6 +56,7 @@ QUnit.test('Set', assert => { assert.true(done, '.return #throw'); const array = []; done = false; + // eslint-disable-next-line es/no-nonstandard-array-prototype-properties -- legacy FF case array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; diff --git a/tests/unit-pure/es.weak-map.js b/tests/unit-pure/es.weak-map.js index 76b5bbc0edf0..834f8c64db3d 100644 --- a/tests/unit-pure/es.weak-map.js +++ b/tests/unit-pure/es.weak-map.js @@ -43,6 +43,7 @@ QUnit.test('WeakMap', assert => { assert.false(('clear' in WeakMap.prototype), 'should not contains `.clear` method'); const array = []; done = false; + // eslint-disable-next-line es/no-nonstandard-array-prototype-properties -- legacy FF case array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true; diff --git a/tests/unit-pure/es.weak-set.js b/tests/unit-pure/es.weak-set.js index bb13faeef070..f23b0f586465 100644 --- a/tests/unit-pure/es.weak-set.js +++ b/tests/unit-pure/es.weak-set.js @@ -36,6 +36,7 @@ QUnit.test('WeakSet', assert => { assert.false(('clear' in WeakSet.prototype), 'should not contains `.clear` method'); const array = []; done = false; + // eslint-disable-next-line es/no-nonstandard-array-prototype-properties -- legacy FF case array['@@iterator'] = undefined; array[Symbol.iterator] = function () { done = true;