GeezerVison is showing github.com — tools,lib,test: enable ESLint no-regex-spaces rule · nodejs/node@4518fdd
File treeExpand 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 +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -215,6 +215,7 @@ module.exports = { | 215 | 215 | 'no-path-concat': 'error', | 216 | 216 | 'no-proto': 'error', | 217 | 217 | 'no-redeclare': ['error', { 'builtinGlobals': false }], | | 218 | + 'no-regex-spaces': 'error', | 218 | 219 | 'no-restricted-modules': ['error', 'sys'], | 219 | 220 | /* eslint-disable max-len */ | 220 | 221 | 'no-restricted-properties': [ | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/util/inspect.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -188,7 +188,7 @@ const strEscapeSequencesReplacerSingle = /[\x00-\x1f\x5c\x7f-\x9f]|[\ud800-\udbf | 188 | 188 | const keyStrRegExp = /^[a-zA-Z_][a-zA-Z_0-9]*$/; | 189 | 189 | const numberRegExp = /^(0|[1-9][0-9]*)$/; | 190 | 190 |
| 191 | | -const coreModuleRegExp = /^ at (?:[^/\\(]+ \(|)node:(.+):\d+:\d+\)?$/; | | 191 | +const coreModuleRegExp = /^ {4}at (?:[^/\\(]+ \(|)node:(.+):\d+:\d+\)?$/; | 192 | 192 | const nodeModulesRegExp = /[/\\]node_modules[/\\](.+?)(?=[/\\])/g; | 193 | 193 |
| 194 | 194 | const classRegExp = /^(\s+[^(]*?)\s*{/; | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-assert-deep.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -1125,7 +1125,7 @@ assert.throws( | 1125 | 1125 | { | 1126 | 1126 | code: 'ERR_ASSERTION', | 1127 | 1127 | name: 'AssertionError', | 1128 | | - message: /a: \[Getter: 5]\n- a: \[Getter: 6]\n / | | 1128 | + message: /a: \[Getter: 5]\n- {3}a: \[Getter: 6]\n {2}/ | 1129 | 1129 | } | 1130 | 1130 | ); | 1131 | 1131 |
| |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-assert.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -1247,7 +1247,7 @@ assert.throws( | 1247 | 1247 | assert.deepStrictEqual(Array(100).fill(1), 'foobar'); | 1248 | 1248 | } catch (err) { | 1249 | 1249 | threw = true; | 1250 | | - assert.match(inspect(err), /actual: \[Array],\n expected: 'foobar',/); | | 1250 | + assert.match(inspect(err), /actual: \[Array],\n {2}expected: 'foobar',/); | 1251 | 1251 | } | 1252 | 1252 | assert(threw); | 1253 | 1253 | } | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-debugger-address.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -65,7 +65,7 @@ function launchTarget(...args) { | 65 | 65 | .then(() => { | 66 | 66 | assert.match( | 67 | 67 | cli.output, | 68 | | - /> 3 \+\+x;/, | | 68 | + /> 3 {3}\+\+x;/, | 69 | 69 | 'marks the 3rd line'); | 70 | 70 | }) | 71 | 71 | .then(() => cleanup()) | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-events-uncaught-exception-stack.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -9,7 +9,7 @@ process.on('uncaughtException', common.mustCall((err) => { | 9 | 9 | const lines = err.stack.split('\n'); | 10 | 10 | assert.strictEqual(lines[0], 'Error'); | 11 | 11 | lines.slice(1).forEach((line) => { | 12 | | - assert.match(line, /^ at/); | | 12 | + assert.match(line, /^ {4}at/); | 13 | 13 | }); | 14 | 14 | })); | 15 | 15 |
| |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-http2-stream-client.js +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -12,9 +12,9 @@ server.on('stream', common.mustCall((stream) => { | 12 | 12 | assert.strictEqual(stream.aborted, false); | 13 | 13 | const insp = util.inspect(stream); | 14 | 14 | assert.match(insp, /Http2Stream {/); | 15 | | - assert.match(insp, / state:/); | 16 | | - assert.match(insp, / readableState:/); | 17 | | - assert.match(insp, / writableState:/); | | 15 | + assert.match(insp, / {2}state:/); | | 16 | + assert.match(insp, / {2}readableState:/); | | 17 | + assert.match(insp, / {2}writableState:/); | 18 | 18 | stream.end('ok'); | 19 | 19 | })); | 20 | 20 | server.listen(0, common.mustCall(() => { | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-repl-definecommand.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -35,7 +35,7 @@ r.defineCommand('say2', function() { | 35 | 35 | }); | 36 | 36 |
| 37 | 37 | inputStream.write('.help\n'); | 38 | | -assert.match(output, /\n\.say1 help for say1\n/); | | 38 | +assert.match(output, /\n\.say1 {5}help for say1\n/); | 39 | 39 | assert.match(output, /\n\.say2\n/); | 40 | 40 | inputStream.write('.say1 node developer\n'); | 41 | 41 | assert.ok(output.startsWith('hello node developer\n'), | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-repl-underscore.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -179,7 +179,7 @@ function testError() { | 179 | 179 | // The sync error, with individual property echoes | 180 | 180 | /^Uncaught Error: ENOENT: no such file or directory, scandir '.*nonexistent\?'/, | 181 | 181 | /Object\.readdirSync/, | 182 | | - /^ errno: -(2|4058),$/, | | 182 | + /^ {2}errno: -(2|4058),$/, | 183 | 183 | " syscall: 'scandir',", | 184 | 184 | " code: 'ENOENT',", | 185 | 185 | " path: '/nonexistent?'", | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-repl.js +10-10Lines changed: 10 additions & 10 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -571,10 +571,10 @@ const errorTests = [ | 571 | 571 | /^Uncaught Error: Cannot find module 'internal\/repl'/, | 572 | 572 | /^Require stack:/, | 573 | 573 | /^- <repl>/, | 574 | | - /^ at .*/, | 575 | | - /^ at .*/, | 576 | | - /^ at .*/, | 577 | | - /^ at .*/, | | 574 | + /^ {4}at .*/, | | 575 | + /^ {4}at .*/, | | 576 | + /^ {4}at .*/, | | 577 | + /^ {4}at .*/, | 578 | 578 | " code: 'MODULE_NOT_FOUND',", | 579 | 579 | " requireStack: [ '<repl>' ]", | 580 | 580 | '}', | @@ -776,12 +776,12 @@ const errorTests = [ | 776 | 776 | ' group: [Function: group],', | 777 | 777 | ' groupEnd: [Function: groupEnd],', | 778 | 778 | ' table: [Function: table],', | 779 | | - / debug: \[Function: (debug|log)],/, | 780 | | - / info: \[Function: (info|log)],/, | 781 | | - / dirxml: \[Function: (dirxml|log)],/, | 782 | | - / error: \[Function: (error|warn)],/, | 783 | | - / groupCollapsed: \[Function: (groupCollapsed|group)],/, | 784 | | - / Console: \[Function: Console],?/, | | 779 | + / {2}debug: \[Function: (debug|log)],/, | | 780 | + / {2}info: \[Function: (info|log)],/, | | 781 | + / {2}dirxml: \[Function: (dirxml|log)],/, | | 782 | + / {2}error: \[Function: (error|warn)],/, | | 783 | + / {2}groupCollapsed: \[Function: (groupCollapsed|group)],/, | | 784 | + / {2}Console: \[Function: Console],?/, | 785 | 785 | ...process.features.inspector ? [ | 786 | 786 | ' profile: [Function: profile],', | 787 | 787 | ' profileEnd: [Function: profileEnd],', | |
|