GeezerVison is showing github.com — doc: remove unnecessary `<!-- eslint-` magic comments · nodejs/node@2648efd
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: doc/api/assert.md +2-2Lines changed: 2 additions & 2 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2036,7 +2036,7 @@ If no arguments are passed in at all `message` will be set to the string: | 2036 | 2036 | Be aware that in the `repl` the error message will be different to the one | 2037 | 2037 | thrown in a file! See below for further details. | 2038 | 2038 |
| 2039 | | -<!-- eslint-skip --> | | 2039 | +<!-- eslint-disable no-restricted-syntax --> | 2040 | 2040 |
| 2041 | 2041 | ```mjs | 2042 | 2042 | import assert from 'node:assert/strict'; | @@ -2073,7 +2073,7 @@ assert.ok(0); | 2073 | 2073 | // assert.ok(0) | 2074 | 2074 | ``` | 2075 | 2075 |
| 2076 | | -<!-- eslint-skip --> | | 2076 | +<!-- eslint-disable no-restricted-syntax --> | 2077 | 2077 |
| 2078 | 2078 | ```cjs | 2079 | 2079 | const assert = require('node:assert/strict'); | |
Collapse file Copy file name to clipboardExpand all lines: doc/api/console.md +2-6Lines changed: 2 additions & 6 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -240,9 +240,7 @@ added: v8.3.0 | 240 | 240 | Maintains an internal counter specific to `label` and outputs to `stdout` the | 241 | 241 | number of times `console.count()` has been called with the given `label`. | 242 | 242 |
| 243 | | -<!-- eslint-skip --> | 244 | | - | 245 | | -```js | | 243 | +```console | 246 | 244 | > console.count() | 247 | 245 | default: 1 | 248 | 246 | undefined | @@ -274,9 +272,7 @@ added: v8.3.0 | 274 | 272 |
| 275 | 273 | Resets the internal counter specific to `label`. | 276 | 274 |
| 277 | | -<!-- eslint-skip --> | 278 | | - | 279 | | -```js | | 275 | +```console | 280 | 276 | > console.count('abc'); | 281 | 277 | abc: 1 | 282 | 278 | undefined | |
Collapse file Copy file name to clipboardExpand all lines: doc/api/crypto.md -2Lines changed: 0 additions & 2 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 53 | 53 | } | 54 | 54 | ``` | 55 | 55 |
| 56 | | -<!-- eslint-enable no-global-assign --> | 57 | | - | 58 | 56 | When using the lexical ESM `import` keyword, the error can only be | 59 | 57 | caught if a handler for `process.on('uncaughtException')` is registered | 60 | 58 | _before_ any attempt to load the module is made (using, for instance, | |
Collapse file Copy file name to clipboardExpand all lines: doc/api/dns.md +36-60Lines changed: 36 additions & 60 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -205,14 +205,12 @@ Returns an array of IP address strings, formatted according to [RFC 5952][], | 205 | 205 | that are currently configured for DNS resolution. A string will include a port | 206 | 206 | section if a custom port is used. | 207 | 207 |
| 208 | | -<!-- eslint-disable @stylistic/js/semi--> | 209 | | - | 210 | | -```js | | 208 | +```json | 211 | 209 | [ | 212 | | - '8.8.8.8', | 213 | | - '2001:4860:4860::8888', | 214 | | - '8.8.8.8:1053', | 215 | | - '[2001:4860:4860::8888]:1053', | | 210 | + "8.8.8.8", | | 211 | + "2001:4860:4860::8888", | | 212 | + "8.8.8.8:1053", | | 213 | + "[2001:4860:4860::8888]:1053", | 216 | 214 | ] | 217 | 215 | ``` | 218 | 216 |
| @@ -559,8 +557,6 @@ will be present on the object: | 559 | 557 |
| 560 | 558 | Here is an example of the `ret` object passed to the callback: | 561 | 559 |
| 562 | | -<!-- eslint-disable @stylistic/js/semi --> | 563 | | - | 564 | 560 | ```js | 565 | 561 | [ { type: 'A', address: '127.0.0.1', ttl: 299 }, | 566 | 562 | { type: 'CNAME', value: 'example.com' }, | @@ -574,7 +570,7 @@ Here is an example of the `ret` object passed to the callback: | 574 | 570 | refresh: 900, | 575 | 571 | retry: 900, | 576 | 572 | expire: 1800, | 577 | | - minttl: 60 } ] | | 573 | + minttl: 60 } ]; | 578 | 574 | ``` | 579 | 575 |
| 580 | 576 | DNS server operators may choose not to respond to `ANY` | @@ -678,17 +674,15 @@ function will contain an array of objects with the following properties: | 678 | 674 | * `order` | 679 | 675 | * `preference` | 680 | 676 |
| 681 | | -<!-- eslint-skip --> | 682 | | - | 683 | 677 | ```js | 684 | | -{ | | 678 | +({ | 685 | 679 | flags: 's', | 686 | 680 | service: 'SIP+D2U', | 687 | 681 | regexp: '', | 688 | 682 | replacement: '_sip._udp.example.com', | 689 | 683 | order: 30, | 690 | | - preference: 100 | 691 | | -} | | 684 | + preference: 100, | | 685 | +}); | 692 | 686 | ``` | 693 | 687 |
| 694 | 688 | ## `dns.resolveNs(hostname, callback)` | @@ -763,18 +757,16 @@ be an object with the following properties: | 763 | 757 | * `expire` | 764 | 758 | * `minttl` | 765 | 759 |
| 766 | | -<!-- eslint-skip --> | 767 | | - | 768 | 760 | ```js | 769 | | -{ | | 761 | +({ | 770 | 762 | nsname: 'ns.example.com', | 771 | 763 | hostmaster: 'root.example.com', | 772 | 764 | serial: 2013101809, | 773 | 765 | refresh: 10000, | 774 | 766 | retry: 2400, | 775 | 767 | expire: 604800, | 776 | | - minttl: 3600 | 777 | | -} | | 768 | + minttl: 3600, | | 769 | +}); | 778 | 770 | ``` | 779 | 771 |
| 780 | 772 | ## `dns.resolveSrv(hostname, callback)` | @@ -803,15 +795,13 @@ be an array of objects with the following properties: | 803 | 795 | * `port` | 804 | 796 | * `name` | 805 | 797 |
| 806 | | -<!-- eslint-skip --> | 807 | | - | 808 | 798 | ```js | 809 | | -{ | | 799 | +({ | 810 | 800 | priority: 10, | 811 | 801 | weight: 5, | 812 | 802 | port: 21223, | 813 | | - name: 'service.example.com' | 814 | | -} | | 803 | + name: 'service.example.com', | | 804 | +}); | 815 | 805 | ``` | 816 | 806 |
| 817 | 807 | ## `dns.resolveTlsa(hostname, callback)` | @@ -840,15 +830,13 @@ array of objects with these properties: | 840 | 830 | * `match` | 841 | 831 | * `data` | 842 | 832 |
| 843 | | -<!-- eslint-skip --> | 844 | | - | 845 | 833 | ```js | 846 | | -{ | | 834 | +({ | 847 | 835 | certUsage: 3, | 848 | 836 | selector: 1, | 849 | 837 | match: 1, | 850 | | - data: [ArrayBuffer] | 851 | | -} | | 838 | + data: [ArrayBuffer], | | 839 | +}); | 852 | 840 | ``` | 853 | 841 |
| 854 | 842 | ## `dns.resolveTxt(hostname, callback)` | @@ -1081,14 +1069,12 @@ Returns an array of IP address strings, formatted according to [RFC 5952][], | 1081 | 1069 | that are currently configured for DNS resolution. A string will include a port | 1082 | 1070 | section if a custom port is used. | 1083 | 1071 |
| 1084 | | -<!-- eslint-disable @stylistic/js/semi--> | 1085 | | - | 1086 | | -```js | | 1072 | +```json | 1087 | 1073 | [ | 1088 | | - '8.8.8.8', | 1089 | | - '2001:4860:4860::8888', | 1090 | | - '8.8.8.8:1053', | 1091 | | - '[2001:4860:4860::8888]:1053', | | 1074 | + "8.8.8.8", | | 1075 | + "2001:4860:4860::8888", | | 1076 | + "8.8.8.8:1053", | | 1077 | + "[2001:4860:4860::8888]:1053" | 1092 | 1078 | ] | 1093 | 1079 | ``` | 1094 | 1080 |
| @@ -1329,8 +1315,6 @@ present on the object: | 1329 | 1315 |
| 1330 | 1316 | Here is an example of the result object: | 1331 | 1317 |
| 1332 | | -<!-- eslint-disable @stylistic/js/semi --> | 1333 | | - | 1334 | 1318 | ```js | 1335 | 1319 | [ { type: 'A', address: '127.0.0.1', ttl: 299 }, | 1336 | 1320 | { type: 'CNAME', value: 'example.com' }, | @@ -1344,7 +1328,7 @@ Here is an example of the result object: | 1344 | 1328 | refresh: 900, | 1345 | 1329 | retry: 900, | 1346 | 1330 | expire: 1800, | 1347 | | - minttl: 60 } ] | | 1331 | + minttl: 60 } ]; | 1348 | 1332 | ``` | 1349 | 1333 |
| 1350 | 1334 | ### `dnsPromises.resolveCaa(hostname)` | @@ -1407,17 +1391,15 @@ of objects with the following properties: | 1407 | 1391 | * `order` | 1408 | 1392 | * `preference` | 1409 | 1393 |
| 1410 | | -<!-- eslint-skip --> | 1411 | | - | 1412 | 1394 | ```js | 1413 | | -{ | | 1395 | +({ | 1414 | 1396 | flags: 's', | 1415 | 1397 | service: 'SIP+D2U', | 1416 | 1398 | regexp: '', | 1417 | 1399 | replacement: '_sip._udp.example.com', | 1418 | 1400 | order: 30, | 1419 | | - preference: 100 | 1420 | | -} | | 1401 | + preference: 100, | | 1402 | +}); | 1421 | 1403 | ``` | 1422 | 1404 |
| 1423 | 1405 | ### `dnsPromises.resolveNs(hostname)` | @@ -1465,18 +1447,16 @@ following properties: | 1465 | 1447 | * `expire` | 1466 | 1448 | * `minttl` | 1467 | 1449 |
| 1468 | | -<!-- eslint-skip --> | 1469 | | - | 1470 | 1450 | ```js | 1471 | | -{ | | 1451 | +({ | 1472 | 1452 | nsname: 'ns.example.com', | 1473 | 1453 | hostmaster: 'root.example.com', | 1474 | 1454 | serial: 2013101809, | 1475 | 1455 | refresh: 10000, | 1476 | 1456 | retry: 2400, | 1477 | 1457 | expire: 604800, | 1478 | | - minttl: 3600 | 1479 | | -} | | 1458 | + minttl: 3600, | | 1459 | +}); | 1480 | 1460 | ``` | 1481 | 1461 |
| 1482 | 1462 | ### `dnsPromises.resolveSrv(hostname)` | @@ -1496,15 +1476,13 @@ the following properties: | 1496 | 1476 | * `port` | 1497 | 1477 | * `name` | 1498 | 1478 |
| 1499 | | -<!-- eslint-skip --> | 1500 | | - | 1501 | 1479 | ```js | 1502 | | -{ | | 1480 | +({ | 1503 | 1481 | priority: 10, | 1504 | 1482 | weight: 5, | 1505 | 1483 | port: 21223, | 1506 | | - name: 'service.example.com' | 1507 | | -} | | 1484 | + name: 'service.example.com', | | 1485 | +}); | 1508 | 1486 | ``` | 1509 | 1487 |
| 1510 | 1488 | ### `dnsPromises.resolveTlsa(hostname)` | @@ -1526,15 +1504,13 @@ with these properties: | 1526 | 1504 | * `match` | 1527 | 1505 | * `data` | 1528 | 1506 |
| 1529 | | -<!-- eslint-skip --> | 1530 | | - | 1531 | 1507 | ```js | 1532 | | -{ | | 1508 | +({ | 1533 | 1509 | certUsage: 3, | 1534 | 1510 | selector: 1, | 1535 | 1511 | match: 1, | 1536 | | - data: [ArrayBuffer] | 1537 | | -} | | 1512 | + data: [ArrayBuffer], | | 1513 | +}); | 1538 | 1514 | ``` | 1539 | 1515 |
| 1540 | 1516 | ### `dnsPromises.resolveTxt(hostname)` | |
Collapse file Copy file name to clipboardExpand all lines: doc/api/esm.md -2Lines changed: 0 additions & 2 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -564,8 +564,6 @@ console.log(cjs === cjsSugar); | 564 | 564 | This Module Namespace Exotic Object can be directly observed either when using | 565 | 565 | `import * as m from 'cjs'` or a dynamic import: | 566 | 566 |
| 567 | | -<!-- eslint-skip --> | 568 | | -
| 569 | 567 | ```js | 570 | 568 | import * as m from 'cjs'; | 571 | 569 | console.log(m); | |
Collapse file Copy file name to clipboardExpand all lines: doc/api/http.md +7-9Lines changed: 7 additions & 9 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -39,15 +39,13 @@ property, which is an array of `[key, value, key2, value2, ...]`. For | 39 | 39 | example, the previous message header object might have a `rawHeaders` | 40 | 40 | list like the following: | 41 | 41 |
| 42 | | -<!-- eslint-disable @stylistic/js/semi --> | 43 | | - | 44 | | -```js | 45 | | -[ 'ConTent-Length', '123456', | 46 | | - 'content-LENGTH', '123', | 47 | | - 'content-type', 'text/plain', | 48 | | - 'CONNECTION', 'keep-alive', | 49 | | - 'Host', 'example.com', | 50 | | - 'accepT', '*/*' ] | | 42 | +```json | | 43 | +[ "ConTent-Length", "123456", | | 44 | + "content-LENGTH", "123", | | 45 | + "content-type", "text/plain", | | 46 | + "CONNECTION", "keep-alive", | | 47 | + "Host", "example.com", | | 48 | + "accepT", "*/*" ] | 51 | 49 | ``` | 52 | 50 |
| 53 | 51 | ## Class: `http.Agent` | |
Collapse file Copy file name to clipboardExpand all lines: doc/api/http2.md +2-4Lines changed: 2 additions & 4 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -4281,10 +4281,8 @@ Accept: text/plain | 4281 | 4281 |
| 4282 | 4282 | Then `request.url` will be: | 4283 | 4283 |
| 4284 | | -<!-- eslint-disable @stylistic/js/semi --> | 4285 | | - | 4286 | | -```js | 4287 | | -'/status?name=ryan' | | 4284 | +```json | | 4285 | +"/status?name=ryan" | 4288 | 4286 | ``` | 4289 | 4287 |
| 4290 | 4288 | To parse the url into its parts, `new URL()` can be used: | |
Collapse file Copy file name to clipboardExpand all lines: doc/api/module.md +1-5Lines changed: 1 addition & 5 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1149,21 +1149,17 @@ export async function load(url, context, nextLoad) { | 1149 | 1149 | Unlike synchronous hooks, the asynchronous hooks would not run for these modules loaded in the file | 1150 | 1150 | that calls `register()`: | 1151 | 1151 |
| 1152 | | -<!-- eslint-disable no-restricted-globals --> | 1153 | | -
| 1154 | 1152 | ```mjs | 1155 | 1153 | // register-hooks.js | 1156 | 1154 | import { register, createRequire } from 'node:module'; | 1157 | 1155 | register('./hooks.mjs', import.meta.url); | 1158 | 1156 |
| 1159 | 1157 | // Asynchronous hooks does not affect modules loaded via custom require() | 1160 | 1158 | // functions created by module.createRequire(). | 1161 | | -const userRequire = createRequire(__filename); | | 1159 | +const userRequire = createRequire(import.meta.filename); | 1162 | 1160 | userRequire('./my-app-2.cjs'); // Hooks won't affect this | 1163 | 1161 | ``` | 1164 | 1162 |
| 1165 | | -<!-- eslint-enable no-restricted-globals --> | 1166 | | -
| 1167 | 1163 | ```cjs | 1168 | 1164 | // register-hooks.js | 1169 | 1165 | const { register, createRequire } = require('node:module'); | |
Collapse file Copy file name to clipboardExpand all lines: doc/api/modules.md +2-6Lines changed: 2 additions & 6 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -262,8 +262,6 @@ the default export in the `.default` property, similar to the results returned b | 262 | 262 | To customize what should be returned by `require(esm)` directly, the ES Module can export the | 263 | 263 | desired value using the string name `"module.exports"`. | 264 | 264 |
| 265 | | -<!-- eslint-disable @stylistic/js/semi --> | 266 | | - | 267 | 265 | ```mjs | 268 | 266 | // point.mjs | 269 | 267 | export default class Point { | @@ -273,7 +271,7 @@ export default class Point { | 273 | 271 | // `distance` is lost to CommonJS consumers of this module, unless it's | 274 | 272 | // added to `Point` as a static property. | 275 | 273 | export function distance(a, b) { return Math.sqrt((b.x - a.x) ** 2 + (b.y - a.y) ** 2); } | 276 | | -export { Point as 'module.exports' } | | 274 | +export { Point as 'module.exports' }; | 277 | 275 | ``` | 278 | 276 |
| 279 | 277 | <!-- eslint-disable node-core/no-duplicate-requires --> | @@ -293,8 +291,6 @@ named exports, the module can make sure that the default export is an object wit | 293 | 291 | named exports attached to it as properties. For example with the example above, | 294 | 292 | `distance` can be attached to the default export, the `Point` class, as a static method. | 295 | 293 |
| 296 | | -<!-- eslint-disable @stylistic/js/semi --> | 297 | | - | 298 | 294 | ```mjs | 299 | 295 | export function distance(a, b) { return Math.sqrt((b.x - a.x) ** 2 + (b.y - a.y) ** 2); } | 300 | 296 |
| @@ -303,7 +299,7 @@ export default class Point { | 303 | 299 | static distance = distance; | 304 | 300 | } | 305 | 301 |
| 306 | | -export { Point as 'module.exports' } | | 302 | +export { Point as 'module.exports' }; | 307 | 303 | ``` | 308 | 304 |
| 309 | 305 | <!-- eslint-disable node-core/no-duplicate-requires --> | |
|