Skip to content

Commit 93ba7d0

Browse files
authored
feat: upgrade dev toolchain (#285)
- Upgrades eslint (8.x, one major behind until we move to flat config) - Upgrades chai (4.x, one major behind until we move to ESM) - Upgrades mocha - Moves from istanbul to c8 for coverage
1 parent bb8ebec commit 93ba7d0

File tree

7 files changed

+1737
-1567
lines changed

7 files changed

+1737
-1567
lines changed

.c8rc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"reporter": ["lcov"],
3+
"include": ["lib/**/*.js"],
4+
"exclude": []
5+
}

.eslintrc.json

Lines changed: 6 additions & 226 deletions
Original file line numberDiff line numberDiff line change
@@ -1,236 +1,16 @@
11
{
22
"root": true,
3+
"extends": [
4+
"eslint:recommended"
5+
],
36
"env": {
47
"node": true,
5-
"es6": true
8+
"es2022": true
69
},
710
"parserOptions": {
8-
"ecmaVersion": 6
11+
"ecmaVersion": "2022",
12+
"sourceType": "module"
913
},
1014
"rules": {
11-
// Possible errors
12-
"comma-dangle": ["error", "never"],
13-
"no-cond-assign": ["error", "except-parens"],
14-
"no-console": "error",
15-
"no-constant-condition": "error",
16-
"no-control-regex": "error",
17-
"no-debugger": "error",
18-
"no-dupe-args": "error",
19-
"no-dupe-keys": "error",
20-
"no-duplicate-case": "error",
21-
"no-empty": "error",
22-
"no-empty-character-class": "error",
23-
"no-ex-assign": "error",
24-
"no-extra-boolean-cast": "error",
25-
"no-extra-parens": ["error", "all", { "conditionalAssign": false, "nestedBinaryExpressions": false }],
26-
"no-extra-semi": "error",
27-
"no-func-assign": "error",
28-
"no-inner-declarations": "off",
29-
"no-invalid-regexp": "error",
30-
"no-irregular-whitespace": "error",
31-
"no-negated-in-lhs": "error",
32-
"no-obj-calls": "error",
33-
"no-regex-spaces": "error",
34-
"no-sparse-arrays": "error",
35-
"no-unexpected-multiline": "error",
36-
"no-unreachable": "error",
37-
"no-unsafe-finally": "off",
38-
"use-isnan": "error",
39-
"valid-jsdoc": "off",
40-
"valid-typeof": "error",
41-
42-
// Best practices
43-
"accessor-pairs": "error",
44-
"array-callback-return": "error",
45-
"block-scoped-var": "off",
46-
"complexity": "off",
47-
"consistent-return": "error",
48-
"curly": ["error", "all"],
49-
"default-case": "off",
50-
"dot-location": ["error", "property"],
51-
"dot-notation": "error",
52-
"eqeqeq": "error",
53-
"guard-for-in": "off",
54-
"no-alert": "error",
55-
"no-caller": "error",
56-
"no-case-declarations": "error",
57-
"no-div-regex": "off",
58-
"no-else-return": "error",
59-
"no-empty-function": "error",
60-
"no-empty-pattern": "error",
61-
"no-eq-null": "error",
62-
"no-eval": "error",
63-
"no-extend-native": "error",
64-
"no-extra-bind": "error",
65-
"no-extra-label": "error",
66-
"no-fallthrough": "error",
67-
"no-floating-decimal": "error",
68-
"no-implicit-coercion": "error",
69-
"no-implicit-globals": "error",
70-
"no-implied-eval": "off",
71-
"no-invalid-this": "error",
72-
"no-iterator": "error",
73-
"no-labels": ["error", { "allowLoop": true }],
74-
"no-lone-blocks": "error",
75-
"no-loop-func": "off",
76-
"no-magic-numbers": "off",
77-
"no-multi-spaces": "error",
78-
"no-multi-str": "error",
79-
"no-native-reassign": "error",
80-
"no-new": "error",
81-
"no-new-func": "error",
82-
"no-new-wrappers": "error",
83-
"no-octal": "error",
84-
"no-octal-escape": "error",
85-
"no-param-reassign": "off",
86-
"no-process-env": "error",
87-
"no-proto": "error",
88-
"no-redeclare": "error",
89-
"no-return-assign": ["error", "except-parens"],
90-
"no-script-url": "off",
91-
"no-self-assign": "error",
92-
"no-self-compare": "error",
93-
"no-sequences": "error",
94-
"no-throw-literal": "error",
95-
"no-unmodified-loop-condition": "error",
96-
"no-unused-expressions": "error",
97-
"no-unused-labels": "error",
98-
"no-useless-call": "error",
99-
"no-useless-concat": "error",
100-
"no-useless-escape": "error",
101-
"no-void": "error",
102-
"no-warning-comments": "off",
103-
"no-with": "error",
104-
"radix": ["error", "as-needed"],
105-
"vars-on-top": "off",
106-
"wrap-iife": ["error", "outside"],
107-
"yoda": ["error", "never"],
108-
109-
// Strict Mode
110-
"strict": ["error", "global"],
111-
112-
// Variables
113-
"init-declarations": "off",
114-
"no-catch-shadow": "error",
115-
"no-delete-var": "error",
116-
"no-label-var": "error",
117-
"no-restricted-globals": "off",
118-
"no-shadow": "error",
119-
"no-shadow-restricted-names": "error",
120-
"no-undef": "error",
121-
"no-undef-init": "error",
122-
"no-undefined": "off",
123-
"no-unused-vars": "error",
124-
"no-use-before-define": ["error", "nofunc"],
125-
126-
// Node.js and CommonJS
127-
"callback-return": "off",
128-
"global-require": "error",
129-
"handle-callback-err": "error",
130-
"no-mixed-requires": ["error", true],
131-
"no-new-require": "error",
132-
"no-path-concat": "error",
133-
"no-process-exit": "error",
134-
"no-restricted-imports": "off",
135-
"no-restricted-modules": "off",
136-
"no-sync": "off",
137-
138-
// Stylistic Issues
139-
"array-bracket-spacing": ["error", "never"],
140-
"block-spacing": ["error", "always"],
141-
"brace-style": ["error", "1tbs", { "allowSingleLine": false }],
142-
"camelcase": ["error", { "properties": "always" }],
143-
"comma-spacing": ["error", { "before": false, "after": true }],
144-
"comma-style": ["error", "last"],
145-
"computed-property-spacing": ["error", "never"],
146-
"consistent-this": "off",
147-
"eol-last": "error",
148-
"func-names": "off",
149-
"func-style": ["error", "declaration"],
150-
"id-blacklist": "off",
151-
"id-length": "off",
152-
"id-match": "off",
153-
"indent": ["error", 4, { "SwitchCase": 1 }],
154-
"jsx-quotes": "off",
155-
"key-spacing": ["error", { "beforeColon": false, "afterColon": true, "mode": "strict" }],
156-
"keyword-spacing": ["error", { "before": true, "after": true }],
157-
"linebreak-style": ["error", "unix"],
158-
"lines-around-comment": "off",
159-
"max-depth": "off",
160-
"max-len": ["error", 120, { "ignoreUrls": true }],
161-
"max-nested-callbacks": "off",
162-
"max-params": "off",
163-
"max-statements": "off",
164-
"max-statements-per-line": ["error", { "max": 1 }],
165-
"new-cap": "error",
166-
"new-parens": "error",
167-
"newline-after-var": "off",
168-
"newline-before-return": "off",
169-
"newline-per-chained-call": "off",
170-
"no-array-constructor": "error",
171-
"no-bitwise": "off",
172-
"no-continue": "off",
173-
"no-inline-comments": "off",
174-
"no-lonely-if": "error",
175-
"no-mixed-spaces-and-tabs": "error",
176-
"no-multiple-empty-lines": "error",
177-
"no-negated-condition": "off",
178-
"no-nested-ternary": "error",
179-
"no-new-object": "error",
180-
"no-plusplus": "off",
181-
"no-restricted-syntax": "off",
182-
"no-spaced-func": "error",
183-
"no-ternary": "off",
184-
"no-trailing-spaces": "error",
185-
"no-underscore-dangle": "off",
186-
"no-unneeded-ternary": "error",
187-
"no-whitespace-before-property": "error",
188-
"object-curly-spacing": ["error", "always"],
189-
"one-var": ["error", "never"],
190-
"one-var-declaration-per-line": ["error", "initializations"],
191-
"operator-assignment": ["error", "always"],
192-
"operator-linebreak": ["error", "after"],
193-
"padded-blocks": ["error", "never"],
194-
"quote-props": ["error", "as-needed"],
195-
"quotes": ["error", "double", { "avoidEscape": true, "allowTemplateLiterals": true }],
196-
"require-jsdoc": "off",
197-
"semi": ["error", "always"],
198-
"semi-spacing": "error",
199-
"sort-imports": "off",
200-
"sort-vars": "off",
201-
"space-before-blocks": ["error", "always"],
202-
"space-before-function-paren": ["error", { "anonymous": "always", "named": "never" }],
203-
"space-in-parens": ["error", "never"],
204-
"space-infix-ops": "error",
205-
"space-unary-ops": ["error", { "words": true, "nonwords": false }],
206-
"spaced-comment": ["error", "always", { "markers": ["///"] }],
207-
"wrap-regex": "off",
208-
209-
// ECMAScript 6
210-
"arrow-body-style": "off", // meh
211-
"arrow-parens": ["error", "as-needed"],
212-
"arrow-spacing": "error",
213-
"constructor-super": "error",
214-
"generator-star-spacing": ["error", "after"],
215-
"no-class-assign": "error",
216-
"no-confusing-arrow": "off",
217-
"no-const-assign": "error",
218-
"no-dupe-class-members": "error",
219-
"no-duplicate-imports": "error",
220-
"no-new-symbol": "error",
221-
"no-this-before-super": "error",
222-
"no-useless-computed-key": "error",
223-
"no-useless-constructor": "error",
224-
"no-var": "error",
225-
"object-shorthand": "error",
226-
"prefer-arrow-callback": "error",
227-
"prefer-const": "error",
228-
"prefer-reflect": "off",
229-
"prefer-rest-params": "off",
230-
"prefer-spread": "off",
231-
"prefer-template": "off",
232-
"require-yield": "error",
233-
"template-curly-spacing": ["error", "never"],
234-
"yield-star-spacing": ["error", "after"]
23515
}
23616
}

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ jobs:
3232
# See supported Node.js release schedule at https://github.com/nodejs/release#release-schedule
3333
chai-version:
3434
- "^4.0.0"
35-
- "^5.0.0"
3635

3736
steps:
3837
- uses: actions/checkout@v4

lib/chai-as-promised.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,10 @@ module.exports = (chai, utils) => {
263263
getterNames.forEach(getterName => {
264264
// Chainable methods are things like `an`, which can work both for `.should.be.an.instanceOf` and as
265265
// `should.be.an("object")`. We need to handle those specially.
266-
const isChainableMethod = Assertion.prototype.__methods.hasOwnProperty(getterName);
266+
const isChainableMethod = Object.prototype.hasOwnProperty.call(
267+
Assertion.prototype.__methods,
268+
getterName
269+
);
267270

268271
if (isChainableMethod) {
269272
Assertion.overwriteChainableMethod(

0 commit comments

Comments
 (0)