Skip to content

Commit f9ddd77

Browse files
committed
tools: add lint rule to keep primordials in ASCII order
PR-URL: #52592 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Jacob Smith <[email protected]> Reviewed-By: Moshe Atlow <[email protected]>
1 parent eeb80ad commit f9ddd77

File tree

96 files changed

+336
-189
lines changed

Some content is hidden

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

96 files changed

+336
-189
lines changed

lib/.eslintrc.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ rules:
185185
- groups: [['&&', '||']]
186186

187187
# Custom rules in tools/eslint-rules
188+
node-core/alphabetize-primordials: error
188189
node-core/avoid-prototype-pollution: error
189190
node-core/lowercase-name-for-primitive: error
190191
node-core/non-ascii-character: error
@@ -266,3 +267,7 @@ globals:
266267
module: false
267268
internalBinding: false
268269
primordials: false
270+
overrides:
271+
- files: [internal/per_context/primordials.js]
272+
rules:
273+
node-core/alphabetize-primordials: [error, {enforceTopPosition: false}]

lib/_http_common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323

2424
const {
2525
MathMin,
26-
Symbol,
2726
RegExpPrototypeExec,
27+
Symbol,
2828
} = primordials;
2929
const { setImmediate } = require('timers');
3030

lib/_http_outgoing.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ const {
2929
NumberPrototypeToString,
3030
ObjectDefineProperty,
3131
ObjectKeys,
32-
ObjectValues,
3332
ObjectPrototypeHasOwnProperty,
3433
ObjectSetPrototypeOf,
34+
ObjectValues,
3535
RegExpPrototypeExec,
3636
SafeSet,
3737
StringPrototypeToLowerCase,

lib/_http_server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ const {
2828
MathMin,
2929
ObjectKeys,
3030
ObjectSetPrototypeOf,
31-
RegExpPrototypeExec,
3231
ReflectApply,
32+
RegExpPrototypeExec,
3333
Symbol,
3434
SymbolAsyncDispose,
3535
SymbolFor,

lib/_tls_common.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121

2222
'use strict';
2323

24-
const tls = require('tls');
25-
2624
const {
2725
ArrayPrototypePush,
2826
JSONParse,
2927
RegExpPrototypeSymbolReplace,
3028
} = primordials;
3129

30+
const tls = require('tls');
31+
3232
const {
3333
codes: {
3434
ERR_TLS_INVALID_PROTOCOL_VERSION,

lib/async_hooks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ const {
99
FunctionPrototypeBind,
1010
NumberIsSafeInteger,
1111
ObjectDefineProperties,
12+
ObjectFreeze,
1213
ObjectIs,
1314
ReflectApply,
1415
Symbol,
15-
ObjectFreeze,
1616
} = primordials;
1717

1818
const {

lib/buffer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ const {
4141
StringPrototypeTrim,
4242
SymbolSpecies,
4343
SymbolToPrimitive,
44+
TypedArrayPrototypeFill,
4445
TypedArrayPrototypeGetBuffer,
4546
TypedArrayPrototypeGetByteLength,
4647
TypedArrayPrototypeGetByteOffset,
47-
TypedArrayPrototypeFill,
4848
TypedArrayPrototypeGetLength,
4949
TypedArrayPrototypeSet,
5050
TypedArrayPrototypeSlice,

lib/child_process.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ const {
2828
ArrayPrototypeJoin,
2929
ArrayPrototypeLastIndexOf,
3030
ArrayPrototypePush,
31+
ArrayPrototypePushApply,
3132
ArrayPrototypeSlice,
3233
ArrayPrototypeSort,
3334
ArrayPrototypeSplice,
3435
ArrayPrototypeUnshift,
35-
ArrayPrototypePushApply,
3636
NumberIsInteger,
3737
ObjectAssign,
3838
ObjectDefineProperty,

lib/crypto.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
'use strict';
2626

2727
const {
28-
ObjectDefineProperty,
2928
ObjectDefineProperties,
29+
ObjectDefineProperty,
3030
} = primordials;
3131

3232
const {

lib/diagnostics_channel.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ const {
55
ArrayPrototypeIndexOf,
66
ArrayPrototypePush,
77
ArrayPrototypeSplice,
8-
SafeFinalizationRegistry,
98
ObjectDefineProperty,
109
ObjectGetPrototypeOf,
1110
ObjectSetPrototypeOf,
1211
Promise,
1312
PromisePrototypeThen,
14-
PromiseResolve,
1513
PromiseReject,
14+
PromiseResolve,
1615
ReflectApply,
16+
SafeFinalizationRegistry,
1717
SafeMap,
1818
SymbolHasInstance,
1919
} = primordials;

0 commit comments

Comments
 (0)