Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use flat ESLint config #1125

Merged
merged 7 commits into from Sep 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
692 changes: 346 additions & 346 deletions .eslintrc.js → eslint.config.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Expand Up @@ -41,7 +41,7 @@
"confusing-browser-globals": "^1.0.11",
"david": "^12.0.0",
"es-observable": "git+https://github.com/tc39/proposal-observable.git#d3404f06bc70c7c578a5047dfb3dc813730e3319",
"eslint": "^8.23.1",
"eslint": "^8.24.0",
"eslint-plugin-array-func": "^3.1.7",
"eslint-plugin-es-x": "^5.3.1",
"eslint-plugin-eslint-comments": "^3.2.0",
Expand All @@ -53,6 +53,7 @@
"eslint-plugin-regexp": "^1.9.0",
"eslint-plugin-sonarjs": "~0.15.0",
"eslint-plugin-unicorn": "^43.0.2",
"globals": "^13.17.0",
"jsonc-eslint-parser": "^2.1.0",
"jszip": "^3.10.1",
"karma": "^6.4.1",
Expand Down Expand Up @@ -113,7 +114,7 @@
"copy-compat-table": "zx scripts/copy-compat-table.mjs",
"generate-indexes": "zx scripts/generate-indexes.mjs",
"lint": "run-s init test-lint",
"test-lint": "eslint --ext .js,.mjs,.json ./",
"test-lint": "eslint ./",
"test-unit": "run-s test-unit-karma test-unit-node",
"test-unit-global": "karma start -f=packages/core-js-bundle/index.js,tests/bundles/tests.js",
"test-unit-global-standalone": "run-s init bundle-package bundle-helpers bundle-tests-global test-unit-global",
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js-compat/helpers.js
@@ -1,5 +1,5 @@
'use strict';
// eslint-disable-next-line es-x/no-object-hasown -- safe
// eslint-disable-next-line es/no-object-hasown -- safe
const has = Object.hasOwn || Function.call.bind({}.hasOwnProperty);

function semver(input) {
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/es/json/index.js
Expand Up @@ -2,5 +2,5 @@ require('../../modules/es.json.stringify');
require('../../modules/es.json.to-string-tag');
var path = require('../../internals/path');

// eslint-disable-next-line es-x/no-json -- safe
// eslint-disable-next-line es/no-json -- safe
module.exports = path.JSON || (path.JSON = { stringify: JSON.stringify });
2 changes: 1 addition & 1 deletion packages/core-js/es/json/stringify.js
Expand Up @@ -2,7 +2,7 @@ require('../../modules/es.json.stringify');
var path = require('../../internals/path');
var apply = require('../../internals/function-apply');

// eslint-disable-next-line es-x/no-json -- safe
// eslint-disable-next-line es/no-json -- safe
if (!path.JSON) path.JSON = { stringify: JSON.stringify };

// eslint-disable-next-line no-unused-vars -- required for `.length`
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/array-buffer-basic-detection.js
@@ -1,2 +1,2 @@
// eslint-disable-next-line es-x/no-typed-arrays -- safe
// eslint-disable-next-line es/no-typed-arrays -- safe
module.exports = typeof ArrayBuffer != 'undefined' && typeof DataView != 'undefined';
2 changes: 1 addition & 1 deletion packages/core-js/internals/array-buffer-non-extensible.js
Expand Up @@ -4,7 +4,7 @@ var fails = require('../internals/fails');
module.exports = fails(function () {
if (typeof ArrayBuffer == 'function') {
var buffer = new ArrayBuffer(8);
// eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-defineproperty -- safe
// eslint-disable-next-line es/no-object-isextensible, es/no-object-defineproperty -- safe
if (Object.isExtensible(buffer)) Object.defineProperty(buffer, 'a', { value: 8 });
}
});
2 changes: 1 addition & 1 deletion packages/core-js/internals/array-copy-within.js
Expand Up @@ -8,7 +8,7 @@ var min = Math.min;

// `Array.prototype.copyWithin` method implementation
// https://tc39.es/ecma262/#sec-array.prototype.copywithin
// eslint-disable-next-line es-x/no-array-prototype-copywithin -- safe
// eslint-disable-next-line es/no-array-prototype-copywithin -- safe
module.exports = [].copyWithin || function copyWithin(target /* = 0 */, start /* = 0, end = @length */) {
var O = toObject(this);
var len = lengthOfArrayLike(O);
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/array-for-each.js
Expand Up @@ -8,5 +8,5 @@ var STRICT_METHOD = arrayMethodIsStrict('forEach');
// https://tc39.es/ecma262/#sec-array.prototype.foreach
module.exports = !STRICT_METHOD ? function forEach(callbackfn /* , thisArg */) {
return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
// eslint-disable-next-line es-x/no-array-prototype-foreach -- safe
// eslint-disable-next-line es/no-array-prototype-foreach -- safe
} : [].forEach;
2 changes: 1 addition & 1 deletion packages/core-js/internals/array-last-index-of.js
@@ -1,5 +1,5 @@
'use strict';
/* eslint-disable es-x/no-array-prototype-lastindexof -- safe */
/* eslint-disable es/no-array-prototype-lastindexof -- safe */
var apply = require('../internals/function-apply');
var toIndexedObject = require('../internals/to-indexed-object');
var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
Expand Down
4 changes: 2 additions & 2 deletions packages/core-js/internals/array-set-length.js
Expand Up @@ -3,15 +3,15 @@ var DESCRIPTORS = require('../internals/descriptors');
var isArray = require('../internals/is-array');

var $TypeError = TypeError;
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;

// Safari < 13 does not throw an error in this case
var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function () {
// makes no sense without proper strict mode support
if (this !== undefined) return true;
try {
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
// eslint-disable-next-line es/no-object-defineproperty -- safe
Object.defineProperty([], 'length', { writable: false }).length = 1;
} catch (error) {
return error instanceof TypeError;
Expand Down
Expand Up @@ -16,7 +16,7 @@ try {
iteratorWithReturn[ITERATOR] = function () {
return this;
};
// eslint-disable-next-line es-x/no-array-from, no-throw-literal -- required for testing
// eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing
Array.from(iteratorWithReturn, function () { throw 2; });
} catch (error) { /* empty */ }

Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/correct-prototype-getter.js
Expand Up @@ -3,6 +3,6 @@ var fails = require('../internals/fails');
module.exports = !fails(function () {
function F() { /* empty */ }
F.prototype.constructor = null;
// eslint-disable-next-line es-x/no-object-getprototypeof -- required for testing
// eslint-disable-next-line es/no-object-getprototypeof -- required for testing
return Object.getPrototypeOf(new F()) !== F.prototype;
});
2 changes: 1 addition & 1 deletion packages/core-js/internals/define-global-property.js
@@ -1,6 +1,6 @@
var global = require('../internals/global');

// eslint-disable-next-line es-x/no-object-defineproperty -- safe
// eslint-disable-next-line es/no-object-defineproperty -- safe
var defineProperty = Object.defineProperty;

module.exports = function (key, value) {
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/descriptors.js
Expand Up @@ -2,6 +2,6 @@ var fails = require('../internals/fails');

// Detect IE8's incomplete defineProperty implementation
module.exports = !fails(function () {
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
});
2 changes: 1 addition & 1 deletion packages/core-js/internals/error-stack-installable.js
Expand Up @@ -4,7 +4,7 @@ var createPropertyDescriptor = require('../internals/create-property-descriptor'
module.exports = !fails(function () {
var error = Error('a');
if (!('stack' in error)) return true;
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
// eslint-disable-next-line es/no-object-defineproperty -- safe
Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7));
return error.stack !== 7;
});
2 changes: 1 addition & 1 deletion packages/core-js/internals/error-to-string.js
Expand Up @@ -10,7 +10,7 @@ var nativeErrorToString = Error.prototype.toString;
var INCORRECT_TO_STRING = fails(function () {
if (DESCRIPTORS) {
// Chrome 32- incorrectly call accessor
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
// eslint-disable-next-line es/no-object-defineproperty -- safe
var object = create(Object.defineProperty({}, 'name', { get: function () {
return this === object;
} }));
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/freezing.js
@@ -1,6 +1,6 @@
var fails = require('../internals/fails');

module.exports = !fails(function () {
// eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-preventextensions -- required for testing
// eslint-disable-next-line es/no-object-isextensible, es/no-object-preventextensions -- required for testing
return Object.isExtensible(Object.preventExtensions({}));
});
2 changes: 1 addition & 1 deletion packages/core-js/internals/function-apply.js
Expand Up @@ -4,7 +4,7 @@ var FunctionPrototype = Function.prototype;
var apply = FunctionPrototype.apply;
var call = FunctionPrototype.call;

// eslint-disable-next-line es-x/no-reflect -- safe
// eslint-disable-next-line es/no-reflect -- safe
module.exports = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () {
return call.apply(apply, arguments);
});
2 changes: 1 addition & 1 deletion packages/core-js/internals/function-bind-native.js
@@ -1,7 +1,7 @@
var fails = require('../internals/fails');

module.exports = !fails(function () {
// eslint-disable-next-line es-x/no-function-prototype-bind -- safe
// eslint-disable-next-line es/no-function-prototype-bind -- safe
var test = (function () { /* empty */ }).bind();
// eslint-disable-next-line no-prototype-builtins -- safe
return typeof test != 'function' || test.hasOwnProperty('prototype');
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/function-name.js
Expand Up @@ -2,7 +2,7 @@ var DESCRIPTORS = require('../internals/descriptors');
var hasOwn = require('../internals/has-own-property');

var FunctionPrototype = Function.prototype;
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;

var EXISTS = hasOwn(FunctionPrototype, 'name');
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/get-map-iterator.js
@@ -1,6 +1,6 @@
var call = require('../internals/function-call');

module.exports = function (it) {
// eslint-disable-next-line es-x/no-map -- safe
// eslint-disable-next-line es/no-map -- safe
return call(Map.prototype.entries, it);
};
2 changes: 1 addition & 1 deletion packages/core-js/internals/get-set-iterator.js
@@ -1,6 +1,6 @@
var call = require('../internals/function-call');

module.exports = function (it) {
// eslint-disable-next-line es-x/no-set -- safe
// eslint-disable-next-line es/no-set -- safe
return call(Set.prototype.values, it);
};
2 changes: 1 addition & 1 deletion packages/core-js/internals/global.js
Expand Up @@ -4,7 +4,7 @@ var check = function (it) {

// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
module.exports =
// eslint-disable-next-line es-x/no-global-this -- safe
// eslint-disable-next-line es/no-global-this -- safe
check(typeof globalThis == 'object' && globalThis) ||
check(typeof window == 'object' && window) ||
// eslint-disable-next-line no-restricted-globals -- safe
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/has-own-property.js
Expand Up @@ -5,7 +5,7 @@ var hasOwnProperty = uncurryThis({}.hasOwnProperty);

// `HasOwnProperty` abstract operation
// https://tc39.es/ecma262/#sec-hasownproperty
// eslint-disable-next-line es-x/no-object-hasown -- safe
// eslint-disable-next-line es/no-object-hasown -- safe
module.exports = Object.hasOwn || function hasOwn(it, key) {
return hasOwnProperty(toObject(it), key);
};
2 changes: 1 addition & 1 deletion packages/core-js/internals/ie8-dom-define.js
Expand Up @@ -4,7 +4,7 @@ var createElement = require('../internals/document-create-element');

// Thanks to IE8 for its funny defineProperty
module.exports = !DESCRIPTORS && !fails(function () {
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
return Object.defineProperty(createElement('div'), 'a', {
get: function () { return 7; }
}).a != 7;
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/is-array.js
Expand Up @@ -2,7 +2,7 @@ var classof = require('../internals/classof-raw');

// `IsArray` abstract operation
// https://tc39.es/ecma262/#sec-isarray
// eslint-disable-next-line es-x/no-array-isarray -- safe
// eslint-disable-next-line es/no-array-isarray -- safe
module.exports = Array.isArray || function isArray(argument) {
return classof(argument) == 'Array';
};
2 changes: 1 addition & 1 deletion packages/core-js/internals/is-integral-number.js
Expand Up @@ -4,7 +4,7 @@ var floor = Math.floor;

// `IsIntegralNumber` abstract operation
// https://tc39.es/ecma262/#sec-isintegralnumber
// eslint-disable-next-line es-x/no-number-isinteger -- safe
// eslint-disable-next-line es/no-number-isinteger -- safe
module.exports = Number.isInteger || function isInteger(it) {
return !isObject(it) && isFinite(it) && floor(it) === it;
};
2 changes: 1 addition & 1 deletion packages/core-js/internals/iterators-core.js
Expand Up @@ -15,7 +15,7 @@ var BUGGY_SAFARI_ITERATORS = false;
// https://tc39.es/ecma262/#sec-%iteratorprototype%-object
var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;

/* eslint-disable es-x/no-array-prototype-keys -- safe */
/* eslint-disable es/no-array-prototype-keys -- safe */
if ([].keys) {
arrayIterator = [].keys();
// Safari 8 has buggy iterators w/o `next`
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/make-built-in.js
Expand Up @@ -8,7 +8,7 @@ var InternalStateModule = require('../internals/internal-state');

var enforceInternalState = InternalStateModule.enforce;
var getInternalState = InternalStateModule.get;
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
// eslint-disable-next-line es/no-object-defineproperty -- safe
var defineProperty = Object.defineProperty;

var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function () {
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/math-expm1.js
@@ -1,4 +1,4 @@
// eslint-disable-next-line es-x/no-math-expm1 -- safe
// eslint-disable-next-line es/no-math-expm1 -- safe
var $expm1 = Math.expm1;
var exp = Math.exp;

Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/math-fround.js
Expand Up @@ -13,7 +13,7 @@ var roundTiesToEven = function (n) {

// `Math.fround` method implementation
// https://tc39.es/ecma262/#sec-math.fround
// eslint-disable-next-line es-x/no-math-fround -- safe
// eslint-disable-next-line es/no-math-fround -- safe
module.exports = Math.fround || function fround(x) {
var n = +x;
var $abs = abs(n);
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/math-log10.js
@@ -1,7 +1,7 @@
var log = Math.log;
var LOG10E = Math.LOG10E;

// eslint-disable-next-line es-x/no-math-log10 -- safe
// eslint-disable-next-line es/no-math-log10 -- safe
module.exports = Math.log10 || function log10(x) {
return log(x) * LOG10E;
};
2 changes: 1 addition & 1 deletion packages/core-js/internals/math-log1p.js
Expand Up @@ -2,7 +2,7 @@ var log = Math.log;

// `Math.log1p` method implementation
// https://tc39.es/ecma262/#sec-math.log1p
// eslint-disable-next-line es-x/no-math-log1p -- safe
// eslint-disable-next-line es/no-math-log1p -- safe
module.exports = Math.log1p || function log1p(x) {
var n = +x;
return n > -1e-8 && n < 1e-8 ? n - n * n / 2 : log(1 + n);
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/math-sign.js
@@ -1,6 +1,6 @@
// `Math.sign` method implementation
// https://tc39.es/ecma262/#sec-math.sign
// eslint-disable-next-line es-x/no-math-sign -- safe
// eslint-disable-next-line es/no-math-sign -- safe
module.exports = Math.sign || function sign(x) {
var n = +x;
// eslint-disable-next-line no-self-compare -- NaN check
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/math-trunc.js
Expand Up @@ -3,7 +3,7 @@ var floor = Math.floor;

// `Math.trunc` method
// https://tc39.es/ecma262/#sec-math.trunc
// eslint-disable-next-line es-x/no-math-trunc -- safe
// eslint-disable-next-line es/no-math-trunc -- safe
module.exports = Math.trunc || function trunc(x) {
var n = +x;
return (n > 0 ? floor : ceil)(n);
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/number-is-finite.js
Expand Up @@ -4,7 +4,7 @@ var globalIsFinite = global.isFinite;

// `Number.isFinite` method
// https://tc39.es/ecma262/#sec-number.isfinite
// eslint-disable-next-line es-x/no-number-isfinite -- safe
// eslint-disable-next-line es/no-number-isfinite -- safe
module.exports = Number.isFinite || function isFinite(it) {
return typeof it == 'number' && globalIsFinite(it);
};
6 changes: 3 additions & 3 deletions packages/core-js/internals/object-assign.js
Expand Up @@ -9,9 +9,9 @@ var propertyIsEnumerableModule = require('../internals/object-property-is-enumer
var toObject = require('../internals/to-object');
var IndexedObject = require('../internals/indexed-object');

// eslint-disable-next-line es-x/no-object-assign -- safe
// eslint-disable-next-line es/no-object-assign -- safe
var $assign = Object.assign;
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
var defineProperty = Object.defineProperty;
var concat = uncurryThis([].concat);

Expand All @@ -31,7 +31,7 @@ module.exports = !$assign || fails(function () {
// should work with symbols and should have deterministic property order (V8 bug)
var A = {};
var B = {};
// eslint-disable-next-line es-x/no-symbol -- safe
// eslint-disable-next-line es/no-symbol -- safe
var symbol = Symbol();
var alphabet = 'abcdefghijklmnopqrst';
A[symbol] = 7;
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/object-create.js
Expand Up @@ -69,7 +69,7 @@ hiddenKeys[IE_PROTO] = true;

// `Object.create` method
// https://tc39.es/ecma262/#sec-object.create
// eslint-disable-next-line es-x/no-object-create -- safe
// eslint-disable-next-line es/no-object-create -- safe
module.exports = Object.create || function create(O, Properties) {
var result;
if (O !== null) {
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/object-define-properties.js
Expand Up @@ -7,7 +7,7 @@ var objectKeys = require('../internals/object-keys');

// `Object.defineProperties` method
// https://tc39.es/ecma262/#sec-object.defineproperties
// eslint-disable-next-line es-x/no-object-defineproperties -- safe
// eslint-disable-next-line es/no-object-defineproperties -- safe
exports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
anObject(O);
var props = toIndexedObject(Properties);
Expand Down
4 changes: 2 additions & 2 deletions packages/core-js/internals/object-define-property.js
Expand Up @@ -5,9 +5,9 @@ var anObject = require('../internals/an-object');
var toPropertyKey = require('../internals/to-property-key');

var $TypeError = TypeError;
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
// eslint-disable-next-line es/no-object-defineproperty -- safe
var $defineProperty = Object.defineProperty;
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
var ENUMERABLE = 'enumerable';
var CONFIGURABLE = 'configurable';
Expand Down
Expand Up @@ -7,7 +7,7 @@ var toPropertyKey = require('../internals/to-property-key');
var hasOwn = require('../internals/has-own-property');
var IE8_DOM_DEFINE = require('../internals/ie8-dom-define');

// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;

// `Object.getOwnPropertyDescriptor` method
Expand Down
@@ -1,4 +1,4 @@
/* eslint-disable es-x/no-object-getownpropertynames -- safe */
/* eslint-disable es/no-object-getownpropertynames -- safe */
var classof = require('../internals/classof-raw');
var toIndexedObject = require('../internals/to-indexed-object');
var $getOwnPropertyNames = require('../internals/object-get-own-property-names').f;
Expand Down