GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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
Filter options
  • .eslintrc.js
  • lib/internal
    • encoding.js
  • test/parallel
    • test-assert-calltracker-report.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.eslintrc.js‎

Copy file name to clipboardExpand all lines: .eslintrc.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ module.exports = {
287287
'template-curly-spacing': 'error',
288288
'unicode-bom': 'error',
289289
'use-isnan': 'error',
290-
'valid-typeof': 'error',
290+
'valid-typeof': ['error', { requireStringLiterals: true }],
291291

292292
// Custom rules from eslint-plugin-node-core
293293
'node-core/no-unescaped-regexp-dot': 'error',
Collapse file

‎lib/internal/encoding.js‎

Copy file name to clipboardExpand all lines: lib/internal/encoding.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ function validateDecoder(obj) {
6363
}
6464

6565
function validateArgument(prop, expected, propName, expectedName) {
66+
// eslint-disable-next-line valid-typeof
6667
if (typeof prop !== expected)
6768
throw new ERR_INVALID_ARG_TYPE(propName, expectedName, prop);
6869
}
Collapse file

‎test/parallel/test-assert-calltracker-report.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-assert-calltracker-report.js
+3-9Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,16 @@ function foo() {}
1111
const callsfoo = tracker.calls(foo, 1);
1212

1313
// 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');
1715

1816
callsfoo();
1917

2018
// Ensures that foo was removed from the callChecks array after being called the
2119
// expected number of times.
22-
if (typeof tracker.report()[0] === 'undefined') {
23-
process.exit(1);
24-
}
20+
assert.strictEqual(typeof tracker.report()[0], 'undefined');
2521

2622
callsfoo();
2723

2824
// Ensures that foo was added back to the callChecks array after being called
2925
// 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');

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.