Skip to content

Commit a171e58

Browse files
authored
chore: upgrade ESLint (#64)
Upgrades ESLint and also dumbs the rules down to only the built in recommended set. This will lose some nice to have rule configs, but we can always re-enable them later if we feel the need.
1 parent d2fa2b7 commit a171e58

File tree

5 files changed

+849
-1210
lines changed

5 files changed

+849
-1210
lines changed

eslint.config.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import eslintjs from '@eslint/js';
2+
3+
const {configs: eslintConfigs} = eslintjs;
4+
5+
export default [
6+
{
7+
...eslintConfigs.recommended,
8+
files: ['**/*.js']
9+
},
10+
{
11+
files: ['test/**/*.js'],
12+
languageOptions: {
13+
globals: {
14+
describe: 'readonly',
15+
it: 'readonly',
16+
beforeEach: 'readonly',
17+
afterEach: 'readonly',
18+
expect: 'readonly'
19+
}
20+
},
21+
}
22+
];

index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
function isErrorInstance(obj) {
2-
// eslint-disable-next-line prefer-reflect
32
return obj instanceof Error || Object.prototype.toString.call(obj) === '[object Error]';
43
}
54

65
function isRegExp(obj) {
7-
// eslint-disable-next-line prefer-reflect
86
return Object.prototype.toString.call(obj) === '[object RegExp]';
97
}
108

@@ -73,7 +71,7 @@ function compatibleMessage(thrown, errMatcher) {
7371
if (isRegExp(errMatcher)) {
7472
return errMatcher.test(comparisonString);
7573
} else if (typeof errMatcher === 'string') {
76-
return comparisonString.indexOf(errMatcher) !== -1; // eslint-disable-line no-magic-numbers
74+
return comparisonString.indexOf(errMatcher) !== -1;
7775
}
7876

7977
return false;
@@ -100,7 +98,7 @@ function getConstructorName(errorLike) {
10098
// of the error just in case it's a poorly-constructed error. Please see chaijs/chai/issues/45 to know more.
10199
constructorName = errorLike.name;
102100
if (constructorName === '') {
103-
const newConstructorName = (new errorLike().name); // eslint-disable-line new-cap
101+
const newConstructorName = (new errorLike().name);
104102
constructorName = newConstructorName || constructorName;
105103
}
106104
}

0 commit comments

Comments
 (0)