Skip to content

Commit bfd0bfd

Browse files
committed
feat: update to 18.20.7
1 parent d7b0036 commit bfd0bfd

File tree

21,176 files changed

+4019127
-654805
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

21,176 files changed

+4019127
-654805
lines changed

.editorconfig

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 2
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
quote_type = single
11+
12+
[vcbuild.bat]
13+
end_of_line = crlf
14+
15+
[Makefile]
16+
indent_size = 8
17+
indent_style = tab
18+
19+
[{deps}/**]
20+
charset = unset
21+
end_of_line = unset
22+
indent_size = unset
23+
indent_style = unset
24+
trim_trailing_whitespace = unset
25+
26+
[{test/fixtures,deps,tools/node_modules,tools/gyp,tools/icu,tools/msvs}/**]
27+
insert_final_newline = false

.eslintignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
node_modules
2+
lib/punycode.js
3+
test/addons/??_*
4+
test/fixtures
5+
test/message/esm_display_syntax_error.mjs
6+
tools/icu
7+
tools/lint-md/lint-md.mjs
8+
benchmark/tmp
9+
benchmark/fixtures
10+
doc/**/*.js
11+
doc/changelogs/CHANGELOG_v1*.md
12+
!doc/changelogs/CHANGELOG_v18.md
13+
!doc/api_assets/*.js
14+
!.eslintrc.js

.eslintrc.js

Lines changed: 356 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,356 @@
1+
'use strict';
2+
3+
/* eslint-env node */
4+
5+
const Module = require('module');
6+
const path = require('path');
7+
8+
const NodePlugin = require('./tools/node_modules/eslint-plugin-node-core');
9+
NodePlugin.RULES_DIR = path.resolve(__dirname, 'tools', 'eslint-rules');
10+
11+
// The Module._findPath() monkeypatching is to make it so that ESLint will work
12+
// if invoked by a globally-installed ESLint or ESLint installed elsewhere
13+
// rather than the one we ship. This makes it possible for IDEs to lint files
14+
// with our rules while people edit them.
15+
const ModuleFindPath = Module._findPath;
16+
const hacks = [
17+
'eslint-plugin-node-core',
18+
'eslint-plugin-jsdoc',
19+
'eslint-plugin-markdown',
20+
'@babel/eslint-parser',
21+
'@babel/plugin-syntax-import-attributes',
22+
];
23+
Module._findPath = (request, paths, isMain) => {
24+
const r = ModuleFindPath(request, paths, isMain);
25+
if (!r && hacks.includes(request)) {
26+
try {
27+
return require.resolve(`./tools/node_modules/${request}`);
28+
} catch {
29+
return require.resolve(
30+
`./tools/node_modules/eslint/node_modules/${request}`);
31+
}
32+
}
33+
return r;
34+
};
35+
36+
module.exports = {
37+
root: true,
38+
env: {
39+
es2022: true,
40+
},
41+
extends: ['eslint:recommended', 'plugin:jsdoc/recommended'],
42+
plugins: ['jsdoc', 'markdown', 'node-core'],
43+
parser: '@babel/eslint-parser',
44+
parserOptions: {
45+
babelOptions: {
46+
plugins: [
47+
Module._findPath('@babel/plugin-syntax-import-attributes'),
48+
],
49+
},
50+
requireConfigFile: false,
51+
sourceType: 'script',
52+
},
53+
overrides: [
54+
{
55+
files: [
56+
'*.mjs',
57+
'test/es-module/test-esm-example-loader.js',
58+
'test/es-module/test-esm-type-flag.js',
59+
'test/es-module/test-esm-type-flag-alias.js',
60+
],
61+
parserOptions: { sourceType: 'module' },
62+
},
63+
{
64+
files: ['**/*.md'],
65+
processor: 'markdown/markdown',
66+
},
67+
{
68+
files: ['**/*.md/*.cjs', '**/*.md/*.js'],
69+
parserOptions: {
70+
sourceType: 'script',
71+
ecmaFeatures: { impliedStrict: true },
72+
},
73+
rules: { strict: 'off' },
74+
},
75+
{
76+
files: [
77+
'**/*.md/*.mjs',
78+
'doc/api/esm.md/*.js',
79+
'doc/api/packages.md/*.js',
80+
],
81+
parserOptions: { sourceType: 'module' },
82+
rules: { 'no-restricted-globals': [
83+
'error',
84+
{
85+
name: '__filename',
86+
message: 'Use import.meta.url instead',
87+
},
88+
{
89+
name: '__dirname',
90+
message: 'Not available in ESM',
91+
},
92+
{
93+
name: 'exports',
94+
message: 'Not available in ESM',
95+
},
96+
{
97+
name: 'module',
98+
message: 'Not available in ESM',
99+
},
100+
{
101+
name: 'require',
102+
message: 'Use import instead',
103+
},
104+
{
105+
name: 'Buffer',
106+
message: 'Import Buffer instead of using the global',
107+
},
108+
{
109+
name: 'process',
110+
message: 'Import process instead of using the global',
111+
},
112+
] },
113+
},
114+
{
115+
files: [
116+
'lib/internal/modules/**/*.js',
117+
],
118+
rules: {
119+
'curly': 'error',
120+
},
121+
},
122+
{
123+
files: [
124+
'lib/internal/test_runner/**/*.js',
125+
],
126+
rules: {
127+
'node-core/set-proto-to-null-in-object': 'error',
128+
},
129+
},
130+
],
131+
rules: {
132+
// ESLint built-in rules
133+
// https://eslint.org/docs/rules/
134+
'accessor-pairs': 'error',
135+
'array-callback-return': 'error',
136+
'arrow-parens': 'error',
137+
'arrow-spacing': 'error',
138+
'block-scoped-var': 'error',
139+
'block-spacing': 'error',
140+
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
141+
'capitalized-comments': ['error', 'always', {
142+
line: {
143+
// Ignore all lines that have less characters than 20 and all lines that
144+
// start with something that looks like a variable name or code.
145+
ignorePattern: '.{0,20}$|[a-z]+ ?[0-9A-Z_.(/=:[#-]|std|http|ssh|ftp',
146+
ignoreInlineComments: true,
147+
ignoreConsecutiveComments: true,
148+
},
149+
block: {
150+
ignorePattern: '.*',
151+
},
152+
}],
153+
'comma-dangle': ['error', 'always-multiline'],
154+
'comma-spacing': 'error',
155+
'comma-style': 'error',
156+
'computed-property-spacing': 'error',
157+
'default-case-last': 'error',
158+
'dot-location': ['error', 'property'],
159+
'dot-notation': 'error',
160+
'eol-last': 'error',
161+
'eqeqeq': ['error', 'smart'],
162+
'func-call-spacing': 'error',
163+
'func-name-matching': 'error',
164+
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
165+
'indent': ['error', 2, {
166+
ArrayExpression: 'first',
167+
CallExpression: { arguments: 'first' },
168+
FunctionDeclaration: { parameters: 'first' },
169+
FunctionExpression: { parameters: 'first' },
170+
MemberExpression: 'off',
171+
ObjectExpression: 'first',
172+
SwitchCase: 1,
173+
}],
174+
'key-spacing': 'error',
175+
'keyword-spacing': 'error',
176+
'linebreak-style': 'error',
177+
'max-len': ['error', {
178+
code: 120,
179+
ignorePattern: '^// Flags:',
180+
ignoreRegExpLiterals: true,
181+
ignoreTemplateLiterals: true,
182+
ignoreUrls: true,
183+
tabWidth: 2,
184+
}],
185+
'new-parens': 'error',
186+
'no-confusing-arrow': 'error',
187+
'no-constant-condition': ['error', { checkLoops: false }],
188+
'no-constructor-return': 'error',
189+
'no-duplicate-imports': 'error',
190+
'no-else-return': 'error',
191+
'no-extra-parens': ['error', 'functions'],
192+
'no-lonely-if': 'error',
193+
'no-mixed-requires': 'error',
194+
'no-multi-spaces': ['error', { ignoreEOLComments: true }],
195+
'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 0, maxBOF: 0 }],
196+
'no-new-require': 'error',
197+
'no-path-concat': 'error',
198+
'no-proto': 'error',
199+
'no-redeclare': ['error', { 'builtinGlobals': false }],
200+
'no-restricted-modules': ['error', 'sys'],
201+
'no-restricted-properties': [
202+
'error',
203+
{
204+
object: 'assert',
205+
property: 'deepEqual',
206+
message: 'Use `assert.deepStrictEqual()`.',
207+
},
208+
{
209+
object: 'assert',
210+
property: 'notDeepEqual',
211+
message: 'Use `assert.notDeepStrictEqual()`.',
212+
},
213+
{
214+
object: 'assert',
215+
property: 'equal',
216+
message: 'Use `assert.strictEqual()` rather than `assert.equal()`.',
217+
},
218+
{
219+
object: 'assert',
220+
property: 'notEqual',
221+
message: 'Use `assert.notStrictEqual()` rather than `assert.notEqual()`.',
222+
},
223+
{
224+
property: '__defineGetter__',
225+
message: '__defineGetter__ is deprecated.',
226+
},
227+
{
228+
property: '__defineSetter__',
229+
message: '__defineSetter__ is deprecated.',
230+
},
231+
],
232+
// If this list is modified, please copy changes that should apply to ./lib
233+
// as well to lib/.eslintrc.yaml.
234+
'no-restricted-syntax': [
235+
'error',
236+
{
237+
selector: "CallExpression[callee.name='setTimeout'][arguments.length<2]",
238+
message: '`setTimeout()` must be invoked with at least two arguments.',
239+
},
240+
{
241+
selector: "CallExpression[callee.name='setInterval'][arguments.length<2]",
242+
message: '`setInterval()` must be invoked with at least two arguments.',
243+
},
244+
{
245+
selector: 'ThrowStatement > CallExpression[callee.name=/Error$/]',
246+
message: 'Use `new` keyword when throwing an `Error`.',
247+
},
248+
{
249+
selector: "CallExpression[callee.name='isNaN']",
250+
message: 'Use Number.isNaN() instead of the global isNaN() function.',
251+
},
252+
],
253+
'no-return-await': 'error',
254+
'no-self-compare': 'error',
255+
'no-tabs': 'error',
256+
'no-template-curly-in-string': 'error',
257+
'no-throw-literal': 'error',
258+
'no-trailing-spaces': 'error',
259+
'no-undef': ['error', { typeof: true }],
260+
'no-undef-init': 'error',
261+
'no-unused-expressions': ['error', { allowShortCircuit: true }],
262+
'no-unused-vars': ['error', { args: 'none', caughtErrors: 'all' }],
263+
'no-use-before-define': ['error', {
264+
classes: true,
265+
functions: false,
266+
variables: false,
267+
}],
268+
'no-useless-call': 'error',
269+
'no-useless-concat': 'error',
270+
'no-useless-constructor': 'error',
271+
'no-useless-return': 'error',
272+
'no-var': 'error',
273+
'no-void': 'error',
274+
'no-whitespace-before-property': 'error',
275+
'object-curly-newline': 'error',
276+
'object-curly-spacing': ['error', 'always'],
277+
'one-var': ['error', { initialized: 'never' }],
278+
'one-var-declaration-per-line': 'error',
279+
'operator-linebreak': ['error', 'after'],
280+
'padding-line-between-statements': [
281+
'error',
282+
{ blankLine: 'always', prev: 'function', next: 'function' },
283+
],
284+
'prefer-const': ['error', { ignoreReadBeforeAssign: true }],
285+
'prefer-object-has-own': 'error',
286+
'quotes': ['error', 'single', { avoidEscape: true }],
287+
'quote-props': ['error', 'consistent'],
288+
'rest-spread-spacing': 'error',
289+
'semi': 'error',
290+
'semi-spacing': 'error',
291+
'space-before-blocks': ['error', 'always'],
292+
'space-before-function-paren': ['error', {
293+
anonymous: 'never',
294+
named: 'never',
295+
asyncArrow: 'always',
296+
}],
297+
'space-in-parens': 'error',
298+
'space-infix-ops': 'error',
299+
'space-unary-ops': 'error',
300+
'spaced-comment': ['error', 'always', {
301+
'block': { 'balanced': true },
302+
'exceptions': ['-'],
303+
}],
304+
'strict': ['error', 'global'],
305+
'symbol-description': 'error',
306+
'template-curly-spacing': 'error',
307+
'unicode-bom': 'error',
308+
'valid-typeof': ['error', { requireStringLiterals: true }],
309+
310+
// ESLint recommended rules that we disable
311+
'no-inner-declarations': 'off',
312+
313+
// JSDoc recommended rules that we disable
314+
'jsdoc/require-jsdoc': 'off',
315+
'jsdoc/require-param-description': 'off',
316+
'jsdoc/newline-after-description': 'off',
317+
'jsdoc/require-returns-description': 'off',
318+
'jsdoc/valid-types': 'off',
319+
'jsdoc/no-defaults': 'off',
320+
'jsdoc/no-undefined-types': 'off',
321+
'jsdoc/require-param': 'off',
322+
'jsdoc/check-tag-names': 'off',
323+
'jsdoc/require-returns': 'off',
324+
325+
// Custom rules from eslint-plugin-node-core
326+
'node-core/no-unescaped-regexp-dot': 'error',
327+
'node-core/no-duplicate-requires': 'error',
328+
},
329+
globals: {
330+
ByteLengthQueuingStrategy: 'readable',
331+
CompressionStream: 'readable',
332+
CountQueuingStrategy: 'readable',
333+
CustomEvent: 'readable',
334+
Crypto: 'readable',
335+
CryptoKey: 'readable',
336+
DecompressionStream: 'readable',
337+
fetch: 'readable',
338+
FormData: 'readable',
339+
ReadableStream: 'readable',
340+
ReadableStreamDefaultReader: 'readable',
341+
ReadableStreamBYOBReader: 'readable',
342+
ReadableStreamBYOBRequest: 'readable',
343+
ReadableByteStreamController: 'readable',
344+
ReadableStreamDefaultController: 'readable',
345+
Response: 'readable',
346+
TextDecoderStream: 'readable',
347+
TextEncoderStream: 'readable',
348+
TransformStream: 'readable',
349+
TransformStreamDefaultController: 'readable',
350+
ShadowRealm: 'readable',
351+
SubtleCrypto: 'readable',
352+
WritableStream: 'readable',
353+
WritableStreamDefaultWriter: 'readable',
354+
WritableStreamDefaultController: 'readable',
355+
},
356+
};

0 commit comments

Comments
 (0)