doc: enable eslint prefer-template rule
PR-URL: https://github.com/nodejs/node/pull/18831 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matheus Marchini <matheus@sthima.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
parent
3a2e912b2d
commit
d6fc7e3af4
@ -12,6 +12,7 @@ rules:
|
|||||||
no-var: error
|
no-var: error
|
||||||
prefer-const: error
|
prefer-const: error
|
||||||
prefer-rest-params: error
|
prefer-rest-params: error
|
||||||
|
prefer-template: error
|
||||||
|
|
||||||
# Stylistic Issues
|
# Stylistic Issues
|
||||||
no-multiple-empty-lines: [error, {max: 1, maxEOF: 0, maxBOF: 0}]
|
no-multiple-empty-lines: [error, {max: 1, maxEOF: 0, maxBOF: 0}]
|
||||||
|
@ -118,7 +118,7 @@ given module specifier and parent file URL:
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
const baseURL = new URL('file://');
|
const baseURL = new URL('file://');
|
||||||
baseURL.pathname = process.cwd() + '/';
|
baseURL.pathname = `${process.cwd()}/`;
|
||||||
|
|
||||||
export async function resolve(specifier,
|
export async function resolve(specifier,
|
||||||
parentModuleURL = baseURL,
|
parentModuleURL = baseURL,
|
||||||
@ -161,7 +161,7 @@ const builtins = Module.builtinModules;
|
|||||||
const JS_EXTENSIONS = new Set(['.js', '.mjs']);
|
const JS_EXTENSIONS = new Set(['.js', '.mjs']);
|
||||||
|
|
||||||
const baseURL = new URL('file://');
|
const baseURL = new URL('file://');
|
||||||
baseURL.pathname = process.cwd() + '/';
|
baseURL.pathname = `${process.cwd()}/`;
|
||||||
|
|
||||||
export function resolve(specifier, parentModuleURL = baseURL, defaultResolve) {
|
export function resolve(specifier, parentModuleURL = baseURL, defaultResolve) {
|
||||||
if (builtins.includes(specifier)) {
|
if (builtins.includes(specifier)) {
|
||||||
|
@ -422,7 +422,7 @@ const req = http.request(options);
|
|||||||
req.end();
|
req.end();
|
||||||
|
|
||||||
req.on('information', (res) => {
|
req.on('information', (res) => {
|
||||||
console.log('got information prior to main response: ' + res.statusCode);
|
console.log(`Got information prior to main response: ${res.statusCode}`);
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -1852,7 +1852,7 @@ class Counter extends Readable {
|
|||||||
if (i > this._max)
|
if (i > this._max)
|
||||||
this.push(null);
|
this.push(null);
|
||||||
else {
|
else {
|
||||||
const str = '' + i;
|
const str = String(i);
|
||||||
const buf = Buffer.from(str, 'ascii');
|
const buf = Buffer.from(str, 'ascii');
|
||||||
this.push(buf);
|
this.push(buf);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user