-
-
Save not-an-aardvark/f3cb021e854414128d197dde8d0f62b2 to your computer and use it in GitHub Desktop.
Linting errors in the Node documentation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ tools/eslint/bin/eslint.js doc/ --ext md --rulesdir tools/eslint-rules/ --rule 'strict:off' --rule 'no-undef: off' --rule 'no-unused-vars: off' --rule 'no-restricted-properties: off' -f codeframe | |
error: Extra space after key 'a' (key-spacing) at doc/api/assert.md:66:3: | |
64 | | |
65 | const obj1 = { | |
> 66 | a : { | |
| ^ | |
67 | b : 1 | |
68 | } | |
69 | }; | |
error: Extra space after key 'b' (key-spacing) at doc/api/assert.md:67:5: | |
65 | const obj1 = { | |
66 | a : { | |
> 67 | b : 1 | |
| ^ | |
68 | } | |
69 | }; | |
70 | const obj2 = { | |
error: Extra space after key 'a' (key-spacing) at doc/api/assert.md:71:3: | |
69 | }; | |
70 | const obj2 = { | |
> 71 | a : { | |
| ^ | |
72 | b : 2 | |
73 | } | |
74 | }; | |
error: Extra space after key 'b' (key-spacing) at doc/api/assert.md:72:5: | |
70 | const obj2 = { | |
71 | a : { | |
> 72 | b : 2 | |
| ^ | |
73 | } | |
74 | }; | |
75 | const obj3 = { | |
error: Extra space after key 'a' (key-spacing) at doc/api/assert.md:76:3: | |
74 | }; | |
75 | const obj3 = { | |
> 76 | a : { | |
| ^ | |
77 | b : 1 | |
78 | } | |
79 | }; | |
error: Extra space after key 'b' (key-spacing) at doc/api/assert.md:77:5: | |
75 | const obj3 = { | |
76 | a : { | |
> 77 | b : 1 | |
| ^ | |
78 | } | |
79 | }; | |
80 | const obj4 = Object.create(obj1); | |
error: Extra space after key 'a' (key-spacing) at doc/api/assert.md:325:3: | |
323 | | |
324 | const obj1 = { | |
> 325 | a : { | |
| ^ | |
326 | b : 1 | |
327 | } | |
328 | }; | |
error: Extra space after key 'b' (key-spacing) at doc/api/assert.md:326:5: | |
324 | const obj1 = { | |
325 | a : { | |
> 326 | b : 1 | |
| ^ | |
327 | } | |
328 | }; | |
329 | const obj2 = { | |
error: Extra space after key 'a' (key-spacing) at doc/api/assert.md:330:3: | |
328 | }; | |
329 | const obj2 = { | |
> 330 | a : { | |
| ^ | |
331 | b : 2 | |
332 | } | |
333 | }; | |
error: Extra space after key 'b' (key-spacing) at doc/api/assert.md:331:5: | |
329 | const obj2 = { | |
330 | a : { | |
> 331 | b : 2 | |
| ^ | |
332 | } | |
333 | }; | |
334 | const obj3 = { | |
error: Extra space after key 'a' (key-spacing) at doc/api/assert.md:335:3: | |
333 | }; | |
334 | const obj3 = { | |
> 335 | a : { | |
| ^ | |
336 | b : 1 | |
337 | } | |
338 | }; | |
error: Extra space after key 'b' (key-spacing) at doc/api/assert.md:336:5: | |
334 | const obj3 = { | |
335 | a : { | |
> 336 | b : 1 | |
| ^ | |
337 | } | |
338 | }; | |
339 | const obj4 = Object.create(obj1); | |
error: Missing space before value for key 'a' (key-spacing) at doc/api/assert.md:371:24: | |
369 | const assert = require('assert'); | |
370 | | |
> 371 | assert.notDeepEqual({a:1}, {a:'1'}); | |
| ^ | |
372 | // AssertionError: { a: 1 } notDeepEqual { a: '1' } | |
373 | | |
374 | assert.notDeepStrictEqual({a:1}, {a:'1'}); | |
error: Missing space before value for key 'a' (key-spacing) at doc/api/assert.md:371:31: | |
369 | const assert = require('assert'); | |
370 | | |
> 371 | assert.notDeepEqual({a:1}, {a:'1'}); | |
| ^ | |
372 | // AssertionError: { a: 1 } notDeepEqual { a: '1' } | |
373 | | |
374 | assert.notDeepStrictEqual({a:1}, {a:'1'}); | |
error: Missing space before value for key 'a' (key-spacing) at doc/api/assert.md:374:30: | |
372 | // AssertionError: { a: 1 } notDeepEqual { a: '1' } | |
373 | | |
> 374 | assert.notDeepStrictEqual({a:1}, {a:'1'}); | |
| ^ | |
375 | // OK | |
376 | ``` | |
377 | | |
error: Missing space before value for key 'a' (key-spacing) at doc/api/assert.md:374:37: | |
372 | // AssertionError: { a: 1 } notDeepEqual { a: '1' } | |
373 | | |
> 374 | assert.notDeepStrictEqual({a:1}, {a:'1'}); | |
| ^ | |
375 | // OK | |
376 | ``` | |
377 | | |
error: There should be no spaces inside this paren (space-in-parens) at doc/api/assert.md:545:8: | |
543 | }, | |
544 | function(err) { | |
> 545 | if ( (err instanceof Error) && /value/.test(err) ) { | |
| ^ | |
546 | return true; | |
547 | } | |
548 | }, | |
error: There should be no spaces inside this paren (space-in-parens) at doc/api/assert.md:545:54: | |
543 | }, | |
544 | function(err) { | |
> 545 | if ( (err instanceof Error) && /value/.test(err) ) { | |
| ^ | |
546 | return true; | |
547 | } | |
548 | }, | |
error: Unexpected string as second argument (assert-throws-arguments) at doc/api/assert.md:559:27: | |
557 | ```js | |
558 | // THIS IS A MISTAKE! DO NOT DO THIS! | |
> 559 | assert.throws(myFunction, 'missing foo', 'did not throw with expected message'); | |
| ^ | |
560 | | |
561 | // Do this instead. | |
562 | assert.throws(myFunction, /missing foo/, 'did not throw with expected message'); | |
error: Unexpected whitespace before semicolon (semi-spacing) at doc/api/buffer.md:962:32: | |
960 | const buf = Buffer.allocUnsafe(str.length); | |
961 | | |
> 962 | for (let i = 0; i < str.length ; i++) { | |
| ^ | |
963 | buf[i] = str.charCodeAt(i); | |
964 | } | |
965 | | |
error: Unexpected whitespace before semicolon (semi-spacing) at doc/api/buffer.md:1090:16: | |
1088 | const buf2 = Buffer.allocUnsafe(26).fill('!'); | |
1089 | | |
> 1090 | for (let i = 0 ; i < 26 ; i++) { | |
| ^ | |
1091 | // 97 is the decimal ASCII value for 'a' | |
1092 | buf1[i] = i + 97; | |
1093 | } | |
error: Unexpected whitespace before semicolon (semi-spacing) at doc/api/buffer.md:1090:25: | |
1088 | const buf2 = Buffer.allocUnsafe(26).fill('!'); | |
1089 | | |
> 1090 | for (let i = 0 ; i < 26 ; i++) { | |
| ^ | |
1091 | // 97 is the decimal ASCII value for 'a' | |
1092 | buf1[i] = i + 97; | |
1093 | } | |
error: Unexpected whitespace before semicolon (semi-spacing) at doc/api/buffer.md:1107:16: | |
1105 | const buf = Buffer.allocUnsafe(26); | |
1106 | | |
> 1107 | for (let i = 0 ; i < 26 ; i++) { | |
| ^ | |
1108 | // 97 is the decimal ASCII value for 'a' | |
1109 | buf[i] = i + 97; | |
1110 | } | |
error: Unexpected whitespace before semicolon (semi-spacing) at doc/api/buffer.md:1107:25: | |
1105 | const buf = Buffer.allocUnsafe(26); | |
1106 | | |
> 1107 | for (let i = 0 ; i < 26 ; i++) { | |
| ^ | |
1108 | // 97 is the decimal ASCII value for 'a' | |
1109 | buf[i] = i + 97; | |
1110 | } | |
error: Unexpected whitespace before semicolon (semi-spacing) at doc/api/buffer.md:1874:16: | |
1872 | const buf1 = Buffer.allocUnsafe(26); | |
1873 | | |
> 1874 | for (let i = 0 ; i < 26 ; i++) { | |
| ^ | |
1875 | // 97 is the decimal ASCII value for 'a' | |
1876 | buf1[i] = i + 97; | |
1877 | } | |
error: Unexpected whitespace before semicolon (semi-spacing) at doc/api/buffer.md:1874:25: | |
1872 | const buf1 = Buffer.allocUnsafe(26); | |
1873 | | |
> 1874 | for (let i = 0 ; i < 26 ; i++) { | |
| ^ | |
1875 | // 97 is the decimal ASCII value for 'a' | |
1876 | buf1[i] = i + 97; | |
1877 | } | |
error: '?' should be placed at the end of the line (operator-linebreak) at doc/api/buffer.md:2025:6: | |
2023 | const copy = JSON.parse(json, (key, value) => { | |
2024 | return value && value.type === 'Buffer' | |
> 2025 | ? Buffer.from(value.data) | |
| ^ | |
2026 | : value; | |
2027 | }); | |
2028 | | |
error: ':' should be placed at the end of the line (operator-linebreak) at doc/api/buffer.md:2026:6: | |
2024 | return value && value.type === 'Buffer' | |
2025 | ? Buffer.from(value.data) | |
> 2026 | : value; | |
| ^ | |
2027 | }); | |
2028 | | |
2029 | // Prints: <Buffer 01 02 03 04 05> | |
error: Unexpected whitespace before semicolon (semi-spacing) at doc/api/buffer.md:2052:16: | |
2050 | const buf1 = Buffer.allocUnsafe(26); | |
2051 | | |
> 2052 | for (let i = 0 ; i < 26 ; i++) { | |
| ^ | |
2053 | // 97 is the decimal ASCII value for 'a' | |
2054 | buf1[i] = i + 97; | |
2055 | } | |
error: Unexpected whitespace before semicolon (semi-spacing) at doc/api/buffer.md:2052:25: | |
2050 | const buf1 = Buffer.allocUnsafe(26); | |
2051 | | |
> 2052 | for (let i = 0 ; i < 26 ; i++) { | |
| ^ | |
2053 | // 97 is the decimal ASCII value for 'a' | |
2054 | buf1[i] = i + 97; | |
2055 | } | |
error: Parsing error: Identifier 'bat' has already been declared at doc/api/child_process.md:116:7: | |
114 | | |
115 | // Script with spaces in the filename: | |
> 116 | const bat = spawn('"my script.cmd"', ['a', 'b'], { shell: true }); | |
| ^ | |
117 | // or: | |
118 | exec('"my script.cmd" a b', (err, stdout, stderr) => { | |
119 | // ... | |
error: Parsing error: Unexpected token : at doc/api/child_process.md:200:10: | |
198 | { | |
199 | encoding: 'utf8', | |
> 200 | timeout: 0, | |
| ^ | |
201 | maxBuffer: 200*1024, | |
202 | killSignal: 'SIGTERM', | |
203 | cwd: null, | |
error: Parsing error: Unexpected token : at doc/api/child_process.md:367:6: | |
365 | { | |
366 | cwd: undefined, | |
> 367 | env: process.env | |
| ^ | |
368 | } | |
369 | ``` | |
370 | | |
error: Expected indentation of 27 spaces but found 2 (indent) at doc/api/child_process.md:935:3: | |
933 | | |
934 | const child = spawn('sh', ['-c', | |
> 935 | `node -e "setInterval(() => { | |
| ^ | |
936 | console.log(process.pid, 'is alive') | |
937 | }, 500);"` | |
938 | ], { | |
error: Expected indentation of 0 spaces but found 2 (indent) at doc/api/child_process.md:938:3: | |
936 | console.log(process.pid, 'is alive') | |
937 | }, 500);"` | |
> 938 | ], { | |
| ^ | |
939 | stdio: ['inherit', 'inherit', 'inherit'] | |
940 | }); | |
941 | | |
error: Expected indentation of 14 spaces but found 4 (indent) at doc/api/cluster.md:528:5: | |
526 | cluster.on('exit', (worker, code, signal) => { | |
527 | console.log('worker %d died (%s). restarting...', | |
> 528 | worker.process.pid, signal || code); | |
| ^ | |
529 | cluster.fork(); | |
530 | }); | |
531 | ``` | |
error: Parsing error: Identifier 'Console' has already been declared at doc/api/console.md:72:7: | |
70 | ```js | |
71 | const Console = require('console').Console; | |
> 72 | const Console = console.Console; | |
| ^ | |
73 | ``` | |
74 | | |
75 | ### new Console(stdout[, stderr]) | |
error: Function name `assert` should match property name `value` (func-name-matching) at doc/api/console.md:142:5: | |
140 | const myConsole = Object.create(console, { | |
141 | assert: { | |
> 142 | value: function assert(assertion, message, ...args) { | |
| ^ | |
143 | try { | |
144 | console.assert(assertion, message, ...args); | |
145 | } catch (err) { | |
error: Unnecessary semicolon (no-extra-semi) at doc/api/console.md:277:3: | |
275 | console.time('100-elements'); | |
276 | for (let i = 0; i < 100; i++) { | |
> 277 | ; | |
| ^ | |
278 | } | |
279 | console.timeEnd('100-elements'); | |
280 | // prints 100-elements: 225.438ms | |
error: Line 15 exceeds the maximum line length of 80 (max-len) at doc/api/crypto.md:291:1: | |
289 | }); | |
290 | | |
> 291 | const encrypted = 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504'; | |
| ^ | |
292 | decipher.write(encrypted, 'hex'); | |
293 | decipher.end(); | |
294 | ``` | |
error: Line 4 exceeds the maximum line length of 80 (max-len) at doc/api/crypto.md:315:1: | |
313 | const decipher = crypto.createDecipher('aes192', 'a password'); | |
314 | | |
> 315 | const encrypted = 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504'; | |
| ^ | |
316 | let decrypted = decipher.update(encrypted, 'hex', 'utf8'); | |
317 | decrypted += decipher.final('utf8'); | |
318 | console.log(decrypted); | |
error: Unexpected 'debugger' statement (no-debugger) at doc/api/debugger.md:33:3: | |
31 | global.x = 5; | |
32 | setTimeout(() => { | |
> 33 | debugger; | |
| ^ | |
34 | console.log('world'); | |
35 | }, 1000); | |
36 | console.log('hello'); | |
error: Parsing error: Unexpected token : at doc/api/dns.md:299:10: | |
297 | { | |
298 | flags: 's', | |
> 299 | service: 'SIP+D2U', | |
| ^ | |
300 | regexp: '', | |
301 | replacement: '_sip._udp.example.com', | |
302 | order: 30, | |
error: Parsing error: Unexpected token : at doc/api/dns.md:358:13: | |
356 | { | |
357 | nsname: 'ns.example.com', | |
> 358 | hostmaster: 'root.example.com', | |
| ^ | |
359 | serial: 2013101809, | |
360 | refresh: 10000, | |
361 | retry: 2400, | |
error: Parsing error: Unexpected token : at doc/api/dns.md:388:9: | |
386 | { | |
387 | priority: 10, | |
> 388 | weight: 5, | |
| ^ | |
389 | port: 21223, | |
390 | name: 'service.example.com' | |
391 | } | |
error: setTimeout() must be invoked with at least two arguments (no-restricted-syntax) at doc/api/domain.md:162:7: | |
160 | case '/error': | |
161 | // We do some async stuff, and then... | |
> 162 | setTimeout(() => { | |
| ^ | |
163 | // Whoops! | |
164 | flerb.bark(); | |
165 | }); | |
error: Parsing error: Unexpected token { at doc/api/fs.md:221:7: | |
219 | | |
220 | ```js | |
> 221 | Stats { | |
| ^ | |
222 | dev: 2114, | |
223 | ino: 48064969, | |
224 | mode: 33188, | |
error: Parsing error: Unexpected token : at doc/api/fs.md:635:11: | |
633 | { | |
634 | flags: 'r', | |
> 635 | encoding: null, | |
| ^ | |
636 | fd: null, | |
637 | mode: 0o666, | |
638 | autoClose: true | |
error: Parsing error: Unexpected token : at doc/api/fs.md:701:18: | |
699 | { | |
700 | flags: 'w', | |
> 701 | defaultEncoding: 'utf8', | |
| ^ | |
702 | fd: null, | |
703 | mode: 0o666, | |
704 | autoClose: true | |
error: Parsing error: Unexpected token : at doc/api/http.md:16:19: | |
14 | | |
15 | ```js | |
> 16 | { 'content-length': '123', | |
| ^ | |
17 | 'content-type': 'text/plain', | |
18 | 'connection': 'keep-alive', | |
19 | 'host': 'mysite.com', | |
error: Missing semicolon (semi) at doc/api/http.md:43:20: | |
41 | 'CONNECTION', 'keep-alive', | |
42 | 'Host', 'mysite.com', | |
> 43 | 'accepT', '*/*' ] | |
| ^ | |
44 | ``` | |
45 | | |
46 | ## Class: http.Agent | |
error: There should be no spaces inside this paren (space-in-parens) at doc/api/http.md:312:32: | |
310 | | |
311 | // Create an HTTP tunneling proxy | |
> 312 | const proxy = http.createServer( (req, res) => { | |
| ^ | |
313 | res.writeHead(200, {'Content-Type': 'text/plain'}); | |
314 | res.end('okay'); | |
315 | }); | |
error: There should be no spaces inside this paren (space-in-parens) at doc/api/http.md:408:30: | |
406 | | |
407 | // Create an HTTP server | |
> 408 | const srv = http.createServer( (req, res) => { | |
| ^ | |
409 | res.writeHead(200, {'Content-Type': 'text/plain'}); | |
410 | res.end('okay'); | |
411 | }); | |
error: Missing semicolon (semi) at doc/api/http.md:1464:20: | |
1462 | | |
1463 | ```js | |
> 1464 | '/status?name=ryan' | |
| ^ | |
1465 | ``` | |
1466 | | |
1467 | To parse the url into its parts `require('url').parse(request.url)` | |
error: Strings must use singlequote (quotes) at doc/api/http.md:1573:23: | |
1571 | let error; | |
1572 | if (statusCode !== 200) { | |
> 1573 | error = new Error(`Request Failed.\n` + | |
| ^ | |
1574 | `Status Code: ${statusCode}`); | |
1575 | } else if (!/^application\/json/.test(contentType)) { | |
1576 | error = new Error(`Invalid content-type.\n` + | |
error: Strings must use singlequote (quotes) at doc/api/http.md:1576:23: | |
1574 | `Status Code: ${statusCode}`); | |
1575 | } else if (!/^application\/json/.test(contentType)) { | |
> 1576 | error = new Error(`Invalid content-type.\n` + | |
| ^ | |
1577 | `Expected application/json but received ${contentType}`); | |
1578 | } | |
1579 | if (error) { | |
error: Missing semicolon (semi) at doc/api/modules.md:73:24: | |
71 | | |
72 | ```js | |
> 73 | require.main === module | |
| ^ | |
74 | ``` | |
75 | | |
76 | For a file `foo.js`, this will be `true` if run via `node foo.js`, but | |
error: Unexpected space before function parentheses (space-before-function-paren) at doc/api/modules.md:444:10: | |
442 | | |
443 | ```js | |
> 444 | (function (exports, require, module, __filename, __dirname) { | |
| ^ | |
445 | // Your module code actually lives in here | |
446 | }); | |
447 | ``` | |
error: Parsing error: Unexpected token at doc/api/modules.md:561:16: | |
559 | ```js | |
560 | module.exports = exports = function Constructor() { | |
> 561 | // ... etc. | |
| ^ | |
562 | ``` | |
563 | | |
564 | To illustrate the behavior, imagine this hypothetical implementation of | |
error: Missing semicolon (semi) at doc/api/os.md:164:2: | |
162 | } | |
163 | } | |
> 164 | ] | |
| ^ | |
165 | ``` | |
166 | | |
167 | *Note*: Because `nice` values are UNIX-specific, on Windows the `nice` values of | |
error: Parsing error: Unexpected token : at doc/api/os.md:274:7: | |
272 | } | |
273 | ], | |
> 274 | eth0: [ | |
| ^ | |
275 | { | |
276 | address: '192.168.1.108', | |
277 | netmask: '255.255.255.0', | |
error: Missing semicolon (semi) at doc/api/path.md:77:45: | |
75 | | |
76 | ```js | |
> 77 | path.basename('/foo/bar/baz/asdf/quux.html') | |
| ^ | |
78 | // Returns: 'quux.html' | |
79 | | |
80 | path.basename('/foo/bar/baz/asdf/quux.html', '.html') | |
error: Missing semicolon (semi) at doc/api/path.md:80:54: | |
78 | // Returns: 'quux.html' | |
79 | | |
> 80 | path.basename('/foo/bar/baz/asdf/quux.html', '.html') | |
| ^ | |
81 | // Returns: 'quux' | |
82 | ``` | |
83 | | |
error: Missing semicolon (semi) at doc/api/path.md:102:30: | |
100 | | |
101 | ```js | |
> 102 | console.log(process.env.PATH) | |
| ^ | |
103 | // Prints: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin' | |
104 | | |
105 | process.env.PATH.split(path.delimiter) | |
error: Missing semicolon (semi) at doc/api/path.md:105:39: | |
103 | // Prints: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin' | |
104 | | |
> 105 | process.env.PATH.split(path.delimiter) | |
| ^ | |
106 | // Returns: ['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin'] | |
107 | ``` | |
108 | | |
error: Missing semicolon (semi) at doc/api/path.md:112:30: | |
110 | | |
111 | ```js | |
> 112 | console.log(process.env.PATH) | |
| ^ | |
113 | // Prints: 'C:\Windows\system32;C:\Windows;C:\Program Files\node\' | |
114 | | |
115 | process.env.PATH.split(path.delimiter) | |
error: Missing semicolon (semi) at doc/api/path.md:115:39: | |
113 | // Prints: 'C:\Windows\system32;C:\Windows;C:\Program Files\node\' | |
114 | | |
> 115 | process.env.PATH.split(path.delimiter) | |
| ^ | |
116 | // Returns: ['C:\\Windows\\system32', 'C:\\Windows', 'C:\\Program Files\\node\\'] | |
117 | ``` | |
118 | | |
error: Line 5 exceeds the maximum line length of 80 (max-len) at doc/api/path.md:116:1: | |
114 | | |
115 | process.env.PATH.split(path.delimiter) | |
> 116 | // Returns: ['C:\\Windows\\system32', 'C:\\Windows', 'C:\\Program Files\\node\\'] | |
| ^ | |
117 | ``` | |
118 | | |
119 | ## path.dirname(path) | |
error: Missing semicolon (semi) at doc/api/path.md:138:39: | |
136 | | |
137 | ```js | |
> 138 | path.dirname('/foo/bar/baz/asdf/quux') | |
| ^ | |
139 | // Returns: '/foo/bar/baz/asdf' | |
140 | ``` | |
141 | | |
error: Missing semicolon (semi) at doc/api/path.md:165:27: | |
163 | | |
164 | ```js | |
> 165 | path.extname('index.html') | |
| ^ | |
166 | // Returns: '.html' | |
167 | | |
168 | path.extname('index.coffee.md') | |
error: Missing semicolon (semi) at doc/api/path.md:168:32: | |
166 | // Returns: '.html' | |
167 | | |
> 168 | path.extname('index.coffee.md') | |
| ^ | |
169 | // Returns: '.md' | |
170 | | |
171 | path.extname('index.') | |
error: Missing semicolon (semi) at doc/api/path.md:171:23: | |
169 | // Returns: '.md' | |
170 | | |
> 171 | path.extname('index.') | |
| ^ | |
172 | // Returns: '.' | |
173 | | |
174 | path.extname('index') | |
error: Missing semicolon (semi) at doc/api/path.md:174:22: | |
172 | // Returns: '.' | |
173 | | |
> 174 | path.extname('index') | |
| ^ | |
175 | // Returns: '' | |
176 | | |
177 | path.extname('.index') | |
error: Missing semicolon (semi) at doc/api/path.md:177:23: | |
175 | // Returns: '' | |
176 | | |
> 177 | path.extname('.index') | |
| ^ | |
178 | // Returns: '' | |
179 | ``` | |
180 | | |
error: Missing semicolon (semi) at doc/api/path.md:262:28: | |
260 | | |
261 | ```js | |
> 262 | path.isAbsolute('/foo/bar') // true | |
| ^ | |
263 | path.isAbsolute('/baz/..') // true | |
264 | path.isAbsolute('qux/') // false | |
265 | path.isAbsolute('.') // false | |
error: Missing semicolon (semi) at doc/api/path.md:263:27: | |
261 | ```js | |
262 | path.isAbsolute('/foo/bar') // true | |
> 263 | path.isAbsolute('/baz/..') // true | |
| ^ | |
264 | path.isAbsolute('qux/') // false | |
265 | path.isAbsolute('.') // false | |
266 | ``` | |
error: Missing semicolon (semi) at doc/api/path.md:264:24: | |
262 | path.isAbsolute('/foo/bar') // true | |
263 | path.isAbsolute('/baz/..') // true | |
> 264 | path.isAbsolute('qux/') // false | |
| ^ | |
265 | path.isAbsolute('.') // false | |
266 | ``` | |
267 | | |
error: Missing semicolon (semi) at doc/api/path.md:265:21: | |
263 | path.isAbsolute('/baz/..') // true | |
264 | path.isAbsolute('qux/') // false | |
> 265 | path.isAbsolute('.') // false | |
| ^ | |
266 | ``` | |
267 | | |
268 | On Windows: | |
error: Missing semicolon (semi) at doc/api/path.md:271:28: | |
269 | | |
270 | ```js | |
> 271 | path.isAbsolute('//server') // true | |
| ^ | |
272 | path.isAbsolute('\\\\server') // true | |
273 | path.isAbsolute('C:/foo/..') // true | |
274 | path.isAbsolute('C:\\foo\\..') // true | |
error: Missing semicolon (semi) at doc/api/path.md:272:30: | |
270 | ```js | |
271 | path.isAbsolute('//server') // true | |
> 272 | path.isAbsolute('\\\\server') // true | |
| ^ | |
273 | path.isAbsolute('C:/foo/..') // true | |
274 | path.isAbsolute('C:\\foo\\..') // true | |
275 | path.isAbsolute('bar\\baz') // false | |
error: Missing semicolon (semi) at doc/api/path.md:273:29: | |
271 | path.isAbsolute('//server') // true | |
272 | path.isAbsolute('\\\\server') // true | |
> 273 | path.isAbsolute('C:/foo/..') // true | |
| ^ | |
274 | path.isAbsolute('C:\\foo\\..') // true | |
275 | path.isAbsolute('bar\\baz') // false | |
276 | path.isAbsolute('bar/baz') // false | |
error: Missing semicolon (semi) at doc/api/path.md:274:31: | |
272 | path.isAbsolute('\\\\server') // true | |
273 | path.isAbsolute('C:/foo/..') // true | |
> 274 | path.isAbsolute('C:\\foo\\..') // true | |
| ^ | |
275 | path.isAbsolute('bar\\baz') // false | |
276 | path.isAbsolute('bar/baz') // false | |
277 | path.isAbsolute('.') // false | |
error: Missing semicolon (semi) at doc/api/path.md:275:28: | |
273 | path.isAbsolute('C:/foo/..') // true | |
274 | path.isAbsolute('C:\\foo\\..') // true | |
> 275 | path.isAbsolute('bar\\baz') // false | |
| ^ | |
276 | path.isAbsolute('bar/baz') // false | |
277 | path.isAbsolute('.') // false | |
278 | ``` | |
error: Missing semicolon (semi) at doc/api/path.md:276:27: | |
274 | path.isAbsolute('C:\\foo\\..') // true | |
275 | path.isAbsolute('bar\\baz') // false | |
> 276 | path.isAbsolute('bar/baz') // false | |
| ^ | |
277 | path.isAbsolute('.') // false | |
278 | ``` | |
279 | | |
error: Missing semicolon (semi) at doc/api/path.md:277:21: | |
275 | path.isAbsolute('bar\\baz') // false | |
276 | path.isAbsolute('bar/baz') // false | |
> 277 | path.isAbsolute('.') // false | |
| ^ | |
278 | ``` | |
279 | | |
280 | A [`TypeError`][] is thrown if `path` is not a string. | |
error: Missing semicolon (semi) at doc/api/path.md:300:51: | |
298 | | |
299 | ```js | |
> 300 | path.join('/foo', 'bar', 'baz/asdf', 'quux', '..') | |
| ^ | |
301 | // Returns: '/foo/bar/baz/asdf' | |
302 | | |
303 | path.join('foo', {}, 'bar') | |
error: Missing semicolon (semi) at doc/api/path.md:303:28: | |
301 | // Returns: '/foo/bar/baz/asdf' | |
302 | | |
> 303 | path.join('foo', {}, 'bar') | |
| ^ | |
304 | // throws 'TypeError: Path must be a string. Received {}' | |
305 | ``` | |
306 | | |
error: Missing semicolon (semi) at doc/api/path.md:330:45: | |
328 | | |
329 | ```js | |
> 330 | path.normalize('/foo/bar//baz/asdf/quux/..') | |
| ^ | |
331 | // Returns: '/foo/bar/baz/asdf' | |
332 | ``` | |
333 | | |
error: Missing semicolon (semi) at doc/api/path.md:337:45: | |
335 | | |
336 | ```js | |
> 337 | path.normalize('C:\\temp\\\\foo\\bar\\..\\') | |
| ^ | |
338 | // Returns: 'C:\\temp\\foo\\' | |
339 | ``` | |
340 | | |
error: Missing semicolon (semi) at doc/api/path.md:366:38: | |
364 | | |
365 | ```js | |
> 366 | path.parse('/home/user/dir/file.txt') | |
| ^ | |
367 | // Returns: | |
368 | // { root: '/', | |
369 | // dir: '/home/user/dir', | |
error: Missing semicolon (semi) at doc/api/path.md:388:38: | |
386 | | |
387 | ```js | |
> 388 | path.parse('C:\\path\\dir\\file.txt') | |
| ^ | |
389 | // Returns: | |
390 | // { root: 'C:\\', | |
391 | // dir: 'C:\\path\\dir', | |
error: Missing semicolon (semi) at doc/api/path.md:443:66: | |
441 | | |
442 | ```js | |
> 443 | path.relative('/data/orandea/test/aaa', '/data/orandea/impl/bbb') | |
| ^ | |
444 | // Returns: '../../impl/bbb' | |
445 | ``` | |
446 | | |
error: Missing semicolon (semi) at doc/api/path.md:450:66: | |
448 | | |
449 | ```js | |
> 450 | path.relative('C:\\orandea\\test\\aaa', 'C:\\orandea\\impl\\bbb') | |
| ^ | |
451 | // Returns: '..\\..\\impl\\bbb' | |
452 | ``` | |
453 | | |
error: Missing semicolon (semi) at doc/api/path.md:486:34: | |
484 | | |
485 | ```js | |
> 486 | path.resolve('/foo/bar', './baz') | |
| ^ | |
487 | // Returns: '/foo/bar/baz' | |
488 | | |
489 | path.resolve('/foo/bar', '/tmp/file/') | |
error: Missing semicolon (semi) at doc/api/path.md:489:39: | |
487 | // Returns: '/foo/bar/baz' | |
488 | | |
> 489 | path.resolve('/foo/bar', '/tmp/file/') | |
| ^ | |
490 | // Returns: '/tmp/file' | |
491 | | |
492 | path.resolve('wwwroot', 'static_files/png/', '../gif/image.gif') | |
error: Missing semicolon (semi) at doc/api/path.md:492:65: | |
490 | // Returns: '/tmp/file' | |
491 | | |
> 492 | path.resolve('wwwroot', 'static_files/png/', '../gif/image.gif') | |
| ^ | |
493 | // if the current working directory is /home/myself/node, | |
494 | // this returns '/home/myself/node/wwwroot/static_files/gif/image.gif' | |
495 | ``` | |
error: Missing semicolon (semi) at doc/api/path.md:514:30: | |
512 | | |
513 | ```js | |
> 514 | 'foo/bar/baz'.split(path.sep) | |
| ^ | |
515 | // Returns: ['foo', 'bar', 'baz'] | |
516 | ``` | |
517 | | |
error: Missing semicolon (semi) at doc/api/path.md:521:32: | |
519 | | |
520 | ```js | |
> 521 | 'foo\\bar\\baz'.split(path.sep) | |
| ^ | |
522 | // Returns: ['foo', 'bar', 'baz'] | |
523 | ``` | |
524 | | |
error: Closing curly brace does not appear on the same line as the subsequent block (brace-style) at doc/api/process.md:512:1: | |
510 | process.chdir('/tmp'); | |
511 | console.log(`New directory: ${process.cwd()}`); | |
> 512 | } | |
| ^ | |
513 | catch (err) { | |
514 | console.error(`chdir: ${err}`); | |
515 | } | |
error: Parsing error: Unexpected token : at doc/api/process.md:536:27: | |
534 | target_defaults: | |
535 | { cflags: [], | |
> 536 | default_configuration: 'Release', | |
| ^ | |
537 | defines: [], | |
538 | include_dirs: [], | |
539 | libraries: [] }, | |
error: Parsing error: Unexpected token : at doc/api/process.md:752:8: | |
750 | { | |
751 | TERM: 'xterm-256color', | |
> 752 | SHELL: '/usr/local/bin/bash', | |
| ^ | |
753 | USER: 'maciej', | |
754 | PATH: '~/.bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin', | |
755 | PWD: '/Users/maciej', | |
error: Missing semicolon (semi) at doc/api/process.md:837:14: | |
835 | | |
836 | ```js | |
> 837 | ['--harmony'] | |
| ^ | |
838 | ``` | |
839 | | |
840 | And `process.argv`: | |
error: Missing semicolon (semi) at doc/api/process.md:843:50: | |
841 | | |
842 | ```js | |
> 843 | ['/usr/local/bin/node', 'script.js', '--version'] | |
| ^ | |
844 | ``` | |
845 | | |
846 | ## process.execPath | |
error: Missing semicolon (semi) at doc/api/process.md:859:22: | |
857 | | |
858 | ```js | |
> 859 | '/usr/local/bin/node' | |
| ^ | |
860 | ``` | |
861 | | |
862 | | |
error: Parsing error: Unexpected token : at doc/api/process.md:1180:12: | |
1178 | { | |
1179 | rss: 4935680, | |
> 1180 | heapTotal: 1826816, | |
| ^ | |
1181 | heapUsed: 650472, | |
1182 | external: 49879 | |
1183 | } | |
error: Parsing error: Unexpected token : at doc/api/process.md:1351:6: | |
1349 | { | |
1350 | name: 'node', | |
> 1351 | lts: 'Argon', | |
| ^ | |
1352 | sourceUrl: 'https://nodejs.org/download/release/v4.4.5/node-v4.4.5.tar.gz', | |
1353 | headersUrl: 'https://nodejs.org/download/release/v4.4.5/node-v4.4.5-headers.tar.gz', | |
1354 | libUrl: 'https://nodejs.org/download/release/v4.4.5/win-x64/node.lib' | |
error: Closing curly brace does not appear on the same line as the subsequent block (brace-style) at doc/api/process.md:1401:3: | |
1399 | process.setegid(501); | |
1400 | console.log(`New gid: ${process.getegid()}`); | |
> 1401 | } | |
| ^ | |
1402 | catch (err) { | |
1403 | console.log(`Failed to set gid: ${err}`); | |
1404 | } | |
error: Closing curly brace does not appear on the same line as the subsequent block (brace-style) at doc/api/process.md:1430:3: | |
1428 | process.seteuid(501); | |
1429 | console.log(`New uid: ${process.geteuid()}`); | |
> 1430 | } | |
| ^ | |
1431 | catch (err) { | |
1432 | console.log(`Failed to set uid: ${err}`); | |
1433 | } | |
error: Closing curly brace does not appear on the same line as the subsequent block (brace-style) at doc/api/process.md:1458:3: | |
1456 | process.setgid(501); | |
1457 | console.log(`New gid: ${process.getgid()}`); | |
> 1458 | } | |
| ^ | |
1459 | catch (err) { | |
1460 | console.log(`Failed to set gid: ${err}`); | |
1461 | } | |
error: Closing curly brace does not appear on the same line as the subsequent block (brace-style) at doc/api/process.md:1500:3: | |
1498 | process.setuid(501); | |
1499 | console.log(`New uid: ${process.getuid()}`); | |
> 1500 | } | |
| ^ | |
1501 | catch (err) { | |
1502 | console.log(`Failed to set uid: ${err}`); | |
1503 | } | |
error: Parsing error: Unexpected token : at doc/api/process.md:1716:7: | |
1714 | { | |
1715 | http_parser: '2.3.0', | |
> 1716 | node: '1.1.1', | |
| ^ | |
1717 | v8: '4.1.0.14', | |
1718 | uv: '1.3.0', | |
1719 | zlib: '1.2.8', | |
error: Parsing error: Unexpected token : at doc/api/querystring.md:65:6: | |
63 | { | |
64 | foo: 'bar', | |
> 65 | abc: ['xyz', '123'] | |
| ^ | |
66 | } | |
67 | ``` | |
68 | | |
error: Missing semicolon (semi) at doc/api/querystring.md:83:49: | |
81 | | |
82 | querystring.parse('w=%D6%D0%CE%C4&foo=bar', null, null, | |
> 83 | { decodeURIComponent: gbkDecodeURIComponent }) | |
| ^ | |
84 | ``` | |
85 | | |
86 | ## querystring.stringify(obj[, sep[, eq[, options]]]) | |
error: Missing semicolon (semi) at doc/api/querystring.md:111:71: | |
109 | | |
110 | ```js | |
> 111 | querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' }) | |
| ^ | |
112 | // returns 'foo=bar&baz=qux&baz=quux&corge=' | |
113 | | |
114 | querystring.stringify({ foo: 'bar', baz: 'qux' }, ';', ':') | |
error: Missing semicolon (semi) at doc/api/querystring.md:114:60: | |
112 | // returns 'foo=bar&baz=qux&baz=quux&corge=' | |
113 | | |
> 114 | querystring.stringify({ foo: 'bar', baz: 'qux' }, ';', ':') | |
| ^ | |
115 | // returns 'foo:bar;baz:qux' | |
116 | ``` | |
117 | | |
error: Missing semicolon (semi) at doc/api/querystring.md:127:49: | |
125 | | |
126 | querystring.stringify({ w: '中文', foo: 'bar' }, null, null, | |
> 127 | { encodeURIComponent: gbkEncodeURIComponent }) | |
| ^ | |
128 | ``` | |
129 | | |
130 | ## querystring.unescape(str) | |
error: Missing semicolon (semi) at doc/api/readline.md:417:72: | |
415 | function completer(line) { | |
416 | const completions = '.help .error .exit .quit .q'.split(' '); | |
> 417 | const hits = completions.filter((c) => { return c.indexOf(line) === 0 }); | |
| ^ | |
418 | // show all completions if none found | |
419 | return [hits.length ? hits : completions, line]; | |
420 | } | |
error: Expected space(s) after "switch" (keyword-spacing) at doc/api/readline.md:495:3: | |
493 | | |
494 | rl.on('line', (line) => { | |
> 495 | switch(line.trim()) { | |
| ^ | |
496 | case 'hello': | |
497 | console.log('world!'); | |
498 | break; | |
error: Parsing error: Unexpected token > at doc/api/repl.md:44:1: | |
42 | | |
43 | ```js | |
> 44 | > .editor | |
| ^ | |
45 | // Entering editor mode (^D to finish, ^C to cancel) | |
46 | function welcome(name) { | |
47 | return `Hello ${name}!`; | |
error: Parsing error: Unexpected token > at doc/api/repl.md:79:1: | |
77 | | |
78 | ```js | |
> 79 | > 1 + 1 | |
| ^ | |
80 | 2 | |
81 | > const m = 2 | |
82 | undefined | |
error: Parsing error: Unexpected token node at doc/api/repl.md:107:3: | |
105 | | |
106 | ```js | |
> 107 | $ node repl_test.js | |
| ^ | |
108 | > m | |
109 | 'message' | |
110 | ``` | |
error: Parsing error: Unexpected token > at doc/api/repl.md:136:1: | |
134 | | |
135 | ```js | |
> 136 | > fs.createReadStream('./some/file'); | |
| ^ | |
137 | ``` | |
138 | | |
139 | #### Assignment of the `_` (underscore) variable | |
error: Parsing error: Unexpected token > at doc/api/repl.md:146:1: | |
144 | | |
145 | ```js | |
> 146 | > [ 'a', 'b', 'c' ] | |
| ^ | |
147 | [ 'a', 'b', 'c' ] | |
148 | > _.length | |
149 | 3 | |
error: Parsing error: Unexpected token / at doc/api/repl.md:292:4: | |
290 | | |
291 | ```js | |
> 292 | $ ./node example.js | |
| ^ | |
293 | > m | |
294 | 'test' | |
295 | > m = 1 | |
error: Parsing error: Unexpected token node at doc/api/repl.md:442:3: | |
440 | | |
441 | ```js | |
> 442 | $ node | |
| ^ | |
443 | > const a = [1, 2, 3]; | |
444 | [ 1, 2, 3 ] | |
445 | > a.forEach((v) => { | |
error: There should be no spaces inside this paren (space-in-parens) at doc/api/stream.md:115:33: | |
113 | const http = require('http'); | |
114 | | |
> 115 | const server = http.createServer( (req, res) => { | |
| ^ | |
116 | // req is an http.IncomingMessage, which is a Readable Stream | |
117 | // res is an http.ServerResponse, which is a Writable Stream | |
118 | | |
error: Unexpected space before unary operator '++' (space-unary-ops) at doc/api/stream.md:283:26: | |
281 | ```js | |
282 | const writer = getWritableStreamSomehow(); | |
> 283 | for (var i = 0; i < 100; i ++) { | |
| ^ | |
284 | writer.write(`hello, #${i}!\n`); | |
285 | } | |
286 | writer.end('This is the end\n'); | |
error: Unexpected space before function parentheses (space-before-function-paren) at doc/api/stream.md:486:15: | |
484 | | |
485 | ```js | |
> 486 | function write (data, cb) { | |
| ^ | |
487 | if (!stream.write(data)) { | |
488 | stream.once('drain', cb) | |
489 | } else { | |
error: Missing semicolon (semi) at doc/api/stream.md:488:29: | |
486 | function write (data, cb) { | |
487 | if (!stream.write(data)) { | |
> 488 | stream.once('drain', cb) | |
| ^ | |
489 | } else { | |
490 | process.nextTick(cb) | |
491 | } | |
error: Missing semicolon (semi) at doc/api/stream.md:490:25: | |
488 | stream.once('drain', cb) | |
489 | } else { | |
> 490 | process.nextTick(cb) | |
| ^ | |
491 | } | |
492 | } | |
493 | | |
error: Missing semicolon (semi) at doc/api/stream.md:496:53: | |
494 | // Wait for cb to be called before doing any other write. | |
495 | write('hello', () => { | |
> 496 | console.log('write completed, do more writes now') | |
| ^ | |
497 | }) | |
498 | ``` | |
499 | | |
error: Missing semicolon (semi) at doc/api/stream.md:497:3: | |
495 | write('hello', () => { | |
496 | console.log('write completed, do more writes now') | |
> 497 | }) | |
| ^ | |
498 | ``` | |
499 | | |
500 | A Writable stream in object mode will always ignore the `encoding` argument. | |
error: Missing '()' invoking a constructor (new-parens) at doc/api/stream.md:752:18: | |
750 | | |
751 | ```js | |
> 752 | const readable = new stream.Readable | |
| ^ | |
753 | | |
754 | readable.isPaused() // === false | |
755 | readable.pause() | |
error: Missing semicolon (semi) at doc/api/stream.md:752:37: | |
750 | | |
751 | ```js | |
> 752 | const readable = new stream.Readable | |
| ^ | |
753 | | |
754 | readable.isPaused() // === false | |
755 | readable.pause() | |
error: Missing semicolon (semi) at doc/api/stream.md:754:20: | |
752 | const readable = new stream.Readable | |
753 | | |
> 754 | readable.isPaused() // === false | |
| ^ | |
755 | readable.pause() | |
756 | readable.isPaused() // === true | |
757 | readable.resume() | |
error: Missing semicolon (semi) at doc/api/stream.md:755:17: | |
753 | | |
754 | readable.isPaused() // === false | |
> 755 | readable.pause() | |
| ^ | |
756 | readable.isPaused() // === true | |
757 | readable.resume() | |
758 | readable.isPaused() // === false | |
error: Missing semicolon (semi) at doc/api/stream.md:756:20: | |
754 | readable.isPaused() // === false | |
755 | readable.pause() | |
> 756 | readable.isPaused() // === true | |
| ^ | |
757 | readable.resume() | |
758 | readable.isPaused() // === false | |
759 | ``` | |
error: Missing semicolon (semi) at doc/api/stream.md:757:18: | |
755 | readable.pause() | |
756 | readable.isPaused() // === true | |
> 757 | readable.resume() | |
| ^ | |
758 | readable.isPaused() // === false | |
759 | ``` | |
760 | | |
error: Missing semicolon (semi) at doc/api/stream.md:758:20: | |
756 | readable.isPaused() // === true | |
757 | readable.resume() | |
> 758 | readable.isPaused() // === false | |
| ^ | |
759 | ``` | |
760 | | |
761 | ##### readable.pause() | |
error: Missing '()' invoking a constructor (new-parens) at doc/api/stream.md:1068:17: | |
1066 | const OldReader = require('./old-api-module.js').OldReader; | |
1067 | const Readable = require('stream').Readable; | |
> 1068 | const oreader = new OldReader; | |
| ^ | |
1069 | const myReader = new Readable().wrap(oreader); | |
1070 | | |
1071 | myReader.on('readable', () => { | |
error: Unexpected space before function parentheses (space-before-function-paren) at doc/api/stream.md:1909:42: | |
1907 | | |
1908 | ```js | |
> 1909 | transform.prototype._transform = function (data, encoding, callback) { | |
| ^ | |
1910 | this.push(data); | |
1911 | callback(); | |
1912 | }; | |
error: Unexpected space before function parentheses (space-before-function-paren) at doc/api/stream.md:1914:42: | |
1912 | }; | |
1913 | | |
> 1914 | transform.prototype._transform = function (data, encoding, callback) { | |
| ^ | |
1915 | callback(null, data); | |
1916 | }; | |
1917 | ``` | |
error: Parsing error: Unexpected token ) at doc/api/tls.md:1249:34: | |
1247 | | |
1248 | ```js | |
> 1249 | pair = tls.createSecurePair( ... ); | |
| ^ | |
1250 | pair.encrypted.pipe(socket); | |
1251 | socket.pipe(pair.encrypted); | |
1252 | ``` | |
error: Missing semicolon (semi) at doc/api/url.md:292:38: | |
290 | | |
291 | ```js | |
> 292 | url.resolve('/one/two/three', 'four') // '/one/two/four' | |
| ^ | |
293 | url.resolve('http://example.com/', '/one') // 'http://example.com/one' | |
294 | url.resolve('http://example.com/one', '/two') // 'http://example.com/two' | |
295 | ``` | |
error: Missing semicolon (semi) at doc/api/url.md:293:43: | |
291 | ```js | |
292 | url.resolve('/one/two/three', 'four') // '/one/two/four' | |
> 293 | url.resolve('http://example.com/', '/one') // 'http://example.com/one' | |
| ^ | |
294 | url.resolve('http://example.com/one', '/two') // 'http://example.com/two' | |
295 | ``` | |
296 | | |
error: Missing semicolon (semi) at doc/api/url.md:294:46: | |
292 | url.resolve('/one/two/three', 'four') // '/one/two/four' | |
293 | url.resolve('http://example.com/', '/one') // 'http://example.com/one' | |
> 294 | url.resolve('http://example.com/one', '/two') // 'http://example.com/two' | |
| ^ | |
295 | ``` | |
296 | | |
297 | ## Escaped Characters | |
error: Missing semicolon (semi) at doc/api/url.md:463:39: | |
461 | // Prints https://example.org/foo | |
462 | | |
> 463 | myURL.href = 'https://example.com/bar' | |
| ^ | |
464 | // Prints https://example.com/bar | |
465 | ``` | |
466 | | |
error: Line 19 exceeds the maximum line length of 80 (max-len) at doc/api/util.md:331:1: | |
329 | // Five space padding because that's the size of "Box< ". | |
330 | const padding = ' '.repeat(5); | |
> 331 | const inner = util.inspect(this.value, newOptions).replace(/\n/g, '\n' + padding); | |
| ^ | |
332 | return options.stylize('Box', 'special') + '< ' + inner + ' >'; | |
333 | } | |
334 | } | |
error: Missing '()' invoking a constructor (new-parens) at doc/api/util.md:463:14: | |
461 | util.isArray([]); | |
462 | // Returns: true | |
> 463 | util.isArray(new Array); | |
| ^ | |
464 | // Returns: true | |
465 | util.isArray({}); | |
466 | // Returns: false | |
error: Missing space before opening brace (space-before-blocks) at doc/api/util.md:699:25: | |
697 | util.isObject({}); | |
698 | // Returns: true | |
> 699 | util.isObject(function(){}); | |
| ^ | |
700 | // Returns: false | |
701 | ``` | |
702 | | |
error: Parsing error: Unexpected token : at doc/api/v8.md:122:29: | |
120 | { | |
121 | total_heap_size: 7326976, | |
> 122 | total_heap_size_executable: 4194304, | |
| ^ | |
123 | total_physical_size: 7326976, | |
124 | total_available_size: 1152656, | |
125 | used_heap_size: 3476208, | |
error: 'code' is never reassigned. Use 'const' instead (prefer-const) at doc/api/vm.md:438:5: | |
436 | const vm = require('vm'); | |
437 | | |
> 438 | let code = | |
| ^ | |
439 | `(function(require) { | |
440 | | |
441 | const http = require('http'); | |
error: Expected indentation of 0 spaces but found 1 (indent) at doc/api/vm.md:451:2: | |
449 | })`; | |
450 | | |
> 451 | vm.runInThisContext(code)(require); | |
| ^ | |
452 | ``` | |
453 | | |
454 | *Note*: The `require()` in the above case shares the state with the context it | |
error: Parsing error: Identifier 'zlib' has already been declared at doc/api/zlib.md:91:7: | |
89 | // Running a gzip operation on every request is quite expensive. | |
90 | // It would be much more efficient to cache the compressed buffer. | |
> 91 | const zlib = require('zlib'); | |
| ^ | |
92 | const http = require('http'); | |
93 | const fs = require('fs'); | |
94 | http.createServer((request, response) => { | |
error: Expected indentation of 13 spaces but found 2 (indent) at doc/api/zlib.md:129:3: | |
127 | {finishFlush: zlib.constants.Z_SYNC_FLUSH}, | |
128 | (err, buffer) => { | |
> 129 | if (!err) { | |
| ^ | |
130 | console.log(buffer.toString()); | |
131 | } else { | |
132 | // handle error | |
error: Expected indentation of 11 spaces but found 0 (indent) at doc/api/zlib.md:134:1: | |
132 | // handle error | |
133 | } | |
> 134 | }); | |
| ^ | |
135 | ``` | |
136 | | |
137 | This will not change the behavior in other error-throwing situations, e.g. | |
error: Infix operators must be spaced (space-infix-ops) at doc/api/zlib.md:152:18: | |
150 | | |
151 | ```js | |
> 152 | (1 << (windowBits+2)) + (1 << (memLevel+9)) | |
| ^ | |
153 | ``` | |
154 | | |
155 | That is: 128K for windowBits=15 + 128K for memLevel = 8 | |
error: Multiple spaces found before '(' (no-multi-spaces) at doc/api/zlib.md:152:26: | |
150 | | |
151 | ```js | |
> 152 | (1 << (windowBits+2)) + (1 << (memLevel+9)) | |
| ^ | |
153 | ``` | |
154 | | |
155 | That is: 128K for windowBits=15 + 128K for memLevel = 8 | |
error: Infix operators must be spaced (space-infix-ops) at doc/api/zlib.md:152:41: | |
150 | | |
151 | ```js | |
> 152 | (1 << (windowBits+2)) + (1 << (memLevel+9)) | |
| ^ | |
153 | ``` | |
154 | | |
155 | That is: 128K for windowBits=15 + 128K for memLevel = 8 | |
error: Missing semicolon (semi) at doc/api/zlib.md:152:45: | |
150 | | |
151 | ```js | |
> 152 | (1 << (windowBits+2)) + (1 << (memLevel+9)) | |
| ^ | |
153 | ``` | |
154 | | |
155 | That is: 128K for windowBits=15 + 128K for memLevel = 8 | |
error: Parsing error: Unexpected token : at doc/api/zlib.md:162:27: | |
160 | | |
161 | ```js | |
> 162 | { windowBits: 14, memLevel: 7 } | |
| ^ | |
163 | ``` | |
164 | | |
165 | This will, however, generally degrade compression. | |
error: Missing semicolon (semi) at doc/api/zlib.md:170:16: | |
168 | | |
169 | ```js | |
> 170 | 1 << windowBits | |
| ^ | |
171 | ``` | |
172 | | |
173 | That is, 32K for windowBits=15 (default value) plus a few kilobytes | |
error: Parsing error: Unexpected token return at doc/guides/using-internal-errors.md:55:29: | |
53 | ```js | |
54 | E('EXAMPLE_KEY1', 'This is the error value'); | |
> 55 | E('EXAMPLE_KEY2', (a, b) => return `${a} ${b}`); | |
| ^ | |
56 | ``` | |
57 | | |
58 | The first argument passed to `E()` is the static identifier. The second | |
error: Parsing error: Unexpected token 'use strict' at doc/guides/writing-tests.md:26:5: | |
24 | | |
25 | ```javascript | |
> 26 | 1 'use strict'; | |
| ^ | |
27 | 2 const common = require('../common'); | |
28 | 3 | |
29 | 4 // This test ensures that the http-parser can handle UTF-8 characters | |
164 errors found. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment