GeezerVison is showing github.com — tools: improve valid-typeof lint rule · nodejs/node@4254315
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: .eslintrc.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -287,7 +287,7 @@ module.exports = { |
287 | 287 | 'template-curly-spacing': 'error', |
288 | 288 | 'unicode-bom': 'error', |
289 | 289 | 'use-isnan': 'error', |
290 | | - 'valid-typeof': 'error', |
| 290 | + 'valid-typeof': ['error', { requireStringLiterals: true }], |
291 | 291 |
|
292 | 292 | // Custom rules from eslint-plugin-node-core |
293 | 293 | 'node-core/no-unescaped-regexp-dot': 'error', |
|
Collapse file
Copy file name to clipboardExpand all lines: lib/internal/encoding.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -63,6 +63,7 @@ function validateDecoder(obj) { |
63 | 63 | } |
64 | 64 |
|
65 | 65 | function validateArgument(prop, expected, propName, expectedName) { |
| 66 | + // eslint-disable-next-line valid-typeof |
66 | 67 | if (typeof prop !== expected) |
67 | 68 | throw new ERR_INVALID_ARG_TYPE(propName, expectedName, prop); |
68 | 69 | } |
|
Collapse file
Copy file name to clipboardExpand all lines: test/parallel/test-assert-calltracker-report.js +3-9Lines changed: 3 additions & 9 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -11,22 +11,16 @@ function foo() {} |
11 | 11 | const callsfoo = tracker.calls(foo, 1); |
12 | 12 |
|
13 | 13 | // Ensures that foo was added to the callChecks array. |
14 | | -if (tracker.report()[0].operator !== 'foo') { |
15 | | - process.exit(1); |
16 | | -} |
| 14 | +assert.strictEqual(tracker.report()[0].operator, 'foo'); |
17 | 15 |
|
18 | 16 | callsfoo(); |
19 | 17 |
|
20 | 18 | // Ensures that foo was removed from the callChecks array after being called the |
21 | 19 | // expected number of times. |
22 | | -if (typeof tracker.report()[0] === 'undefined') { |
23 | | - process.exit(1); |
24 | | -} |
| 20 | +assert.strictEqual(typeof tracker.report()[0], 'undefined'); |
25 | 21 |
|
26 | 22 | callsfoo(); |
27 | 23 |
|
28 | 24 | // Ensures that foo was added back to the callChecks array after being called |
29 | 25 | // more than the expected number of times. |
30 | | -if (tracker.report()[0].operator !== 'foo') { |
31 | | - process.exit(1); |
32 | | -} |
| 26 | +assert.strictEqual(tracker.report()[0].operator, 'foo'); |