Skip to content

Commit

Permalink
[Dev Deps] update eslint, @ljharb/eslint-config
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jan 7, 2020
1 parent 8c8f466 commit e938fda
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 36 deletions.
16 changes: 15 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,19 @@
"strict": [0],

"multiline-comment-style": 1,
}
},

"overrides": [
{
"files": "tests/**",
"rules": {
"max-len": 0,
"max-lines": 0,
"max-statements-per-line": [2, { "max": 2 }],
},
"env": {
"jasmine": true
},
},
],
}
33 changes: 16 additions & 17 deletions es5-sham.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
module.exports = factory();
} else {
// Browser globals (root is window)
root.returnExports = factory();
root.returnExports = factory(); // eslint-disable-line no-param-reassign
}
}(this, function () {

Expand Down Expand Up @@ -86,17 +86,16 @@
// ES5 15.2.3.3
// http://es5.github.com/#x15.2.3.3

var doesGetOwnPropertyDescriptorWork = function doesGetOwnPropertyDescriptorWork(object) {
try {
object.sentinel = 0;
return Object.getOwnPropertyDescriptor(object, 'sentinel').value === 0;
} catch (exception) {
return false;
}
};

// check whether getOwnPropertyDescriptor works if it's given. Otherwise, shim partially.
if (Object.defineProperty) {
var doesGetOwnPropertyDescriptorWork = function doesGetOwnPropertyDescriptorWork(object) {
try {
object.sentinel = 0; // eslint-disable-line no-param-reassign
return Object.getOwnPropertyDescriptor(object, 'sentinel').value === 0;
} catch (exception) {
return false;
}
};
var getOwnPropertyDescriptorWorksOnObject = doesGetOwnPropertyDescriptorWork({});
var getOwnPropertyDescriptorWorksOnDom = typeof document === 'undefined'
|| doesGetOwnPropertyDescriptorWork(document.createElement('div'));
Expand Down Expand Up @@ -152,15 +151,15 @@
// Object.getOwnPropertyDescriptor(Object.prototype, 'toString')
// or any other Object.prototype accessor
if (notPrototypeOfObject) {
object.__proto__ = prototypeOfObject;
object.__proto__ = prototypeOfObject; // eslint-disable-line no-param-reassign
}

var getter = lookupGetter(object, property);
var setter = lookupSetter(object, property);

if (notPrototypeOfObject) {
// Once we have getter and setter we can put values back.
object.__proto__ = prototype;
object.__proto__ = prototype; // eslint-disable-line no-param-reassign
}

if (getter || setter) {
Expand Down Expand Up @@ -405,7 +404,7 @@
// `__proto__` we can safely override `__proto__` while defining
// a property to make sure that we don't hit an inherited
// accessor.
/* eslint-disable no-proto */
/* eslint-disable no-proto, no-param-reassign */
var prototype = object.__proto__;
object.__proto__ = prototypeOfObject;
// Deleting a property anyway since getter / setter may be
Expand All @@ -414,9 +413,9 @@
object[property] = descriptor.value;
// Setting original `__proto__` back now.
object.__proto__ = prototype;
/* eslint-enable no-proto */
/* eslint-enable no-proto, no-param-reassign */
} else {
object[property] = descriptor.value;
object[property] = descriptor.value; // eslint-disable-line no-param-reassign
}
} else {
var hasGetter = 'get' in descriptor;
Expand Down Expand Up @@ -550,9 +549,9 @@
while (owns(object, name)) {
name += '?';
}
object[name] = true;
object[name] = true; // eslint-disable-line no-param-reassign
var returnValue = owns(object, name);
delete object[name];
delete object[name]; // eslint-disable-line no-param-reassign
return returnValue;
};
}
Expand Down
8 changes: 4 additions & 4 deletions es5-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
module.exports = factory();
} else {
// Browser globals (root is window)
root.returnExports = factory();
root.returnExports = factory(); // eslint-disable-line no-param-reassign
}
}(this, function () {
/**
Expand Down Expand Up @@ -106,7 +106,7 @@
if (!forceAssign && (name in object)) {
return;
}
object[name] = method;
object[name] = method; // eslint-disable-line no-param-reassign
};
}
return function defineProperties(object, map, forceAssign) {
Expand Down Expand Up @@ -1930,9 +1930,9 @@
var wrappedReplaceValue = function (match) {
var length = arguments.length;
var originalLastIndex = searchValue.lastIndex;
searchValue.lastIndex = 0;
searchValue.lastIndex = 0; // eslint-disable-line no-param-reassign
var args = searchValue.exec(match) || [];
searchValue.lastIndex = originalLastIndex;
searchValue.lastIndex = originalLastIndex; // eslint-disable-line no-param-reassign
pushCall(args, arguments[length - 2], arguments[length - 1]);
return replaceValue.apply(this, args);
};
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"lint": "eslint tests/helpers/*.js tests/spec/*.js es5-shim.js es5-sham.js"
},
"devDependencies": {
"@ljharb/eslint-config": "^14.0.2",
"eslint": "^6.2.1",
"@ljharb/eslint-config": "^15.1.0",
"eslint": "^6.8.0",
"jasmine-node": "^1.16.2",
"uglify-js": "2.7.3"
},
Expand Down
11 changes: 0 additions & 11 deletions tests/.eslintrc

This file was deleted.

2 changes: 1 addition & 1 deletion tests/spec/s-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ describe('Array', function () {

it('should not be affected by same-index mutation', function () {
var results = [1, 2, 3].filter(function (value, index, array) {
array[index] = 'a';
array[index] = 'a'; // eslint-disable-line no-param-reassign
return true;
});
expect(results).toEqual([1, 2, 3]);
Expand Down
1 change: 1 addition & 0 deletions tests/spec/s-regexp.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ describe('RegExp', function () {

describe('objects', function () {
it('should return correct flags and in correct order', function () {
/* eslint prefer-regex-literals: 0 */
expect(String(new RegExp('pattern'))).toBe('/pattern/');
expect(String(new RegExp('pattern', 'i'))).toBe('/pattern/i');
expect(String(new RegExp('pattern', 'mi'))).toBe('/pattern/im');
Expand Down

0 comments on commit e938fda

Please sign in to comment.