Commit 6b09d30

Browse files
LiviaMedeiroslouiellan
authored andcommitted
lib,tools: add node-core/func-name-matching lint rule
And rename functions accordingly. Signed-off-by: LiviaMedeiros <livia@cirno.name> Co-authored-by: louiellan <louie.lou.llaneta@gmail.com> PR-URL: #57901 Refs: #57899 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 99b7382 commit 6b09d30

17 files changed

Lines changed: 1491 additions & 50 deletions

File tree

‎doc/api/modules.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ exports = { hello: false }; // Not exported, only available in the module
11331133
When the `module.exports` property is being completely replaced by a new
11341134
object, it is common to also reassign `exports`:
11351135

1136-
<!-- eslint-disable func-name-matching -->
1136+
<!-- eslint-disable node-core/func-name-matching -->
11371137

11381138
```js
11391139
module.exports=exports=functionConstructor() {

‎eslint.config.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ export default [
176176
'default-case-last': 'error',
177177
'dot-notation': 'error',
178178
'eqeqeq': ['error','smart'],
179-
'func-name-matching': 'error',
180179
'func-style': ['error','declaration',{allowArrowFunctions: true}],
181180
'no-constant-condition': ['error',{checkLoops: false}],
182181
'no-constructor-return': 'error',
@@ -388,6 +387,7 @@ export default [
388387
'node-core/no-duplicate-requires': 'error',
389388
'node-core/prefer-proto': 'error',
390389
'node-core/prefer-optional-chaining': 'error',
390+
'node-core/func-name-matching': ['error',{considerPropertyDescriptor: true}],
391391
},
392392
},
393393
// #endregion

‎lib/fs.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ function exists(path, callback) {
267267

268268
ObjectDefineProperty(exists,kCustomPromisifiedSymbol,{
269269
__proto__: null,
270-
value: functionexists(path){// eslint-disable-line func-name-matching
270+
value: functionexists(path){
271271
returnnewPromise((resolve)=>fs.exists(path,resolve));
272272
},
273273
});

‎lib/internal/bootstrap/web/exposed-window-or-worker.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ ObjectDefineProperty(globalThis, 'fetch', {
7575
configurable: true,
7676
enumerable: true,
7777
writable: true,
78-
value: functionfetch(input,init=undefined){// eslint-disable-line func-name-matching
78+
value: functionfetch(input,init=undefined){
7979
if(!fetchImpl){// Implement lazy loading of undici module for fetch function
8080
constundiciModule=require('internal/deps/undici/undici');
8181
fetchImpl=undiciModule.fetch;

‎lib/internal/console/constructor.js‎

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const {
5151
}=require('internal/validators');
5252
const{ previewEntries }=internalBinding('util');
5353
const{Buffer: { isBuffer }}=require('buffer');
54+
const{ assignFunctionName }=require('internal/util');
5455
const{
5556
inspect,
5657
formatWithOptions,
@@ -182,9 +183,9 @@ const consolePropAttributes = {
182183
// Fixup global.console instanceof global.console.Console
183184
ObjectDefineProperty(Console,SymbolHasInstance,{
184185
__proto__: null,
185-
value(instance){
186+
value: assignFunctionName(SymbolHasInstance,function(instance){
186187
returninstance[kIsConsole];
187-
},
188+
}),
188189
});
189190

190191
constkColorInspectOptions={colors: true};
@@ -197,19 +198,19 @@ ObjectDefineProperties(Console.prototype, {
197198
__proto__: null,
198199
...consolePropAttributes,
199200
// Eager version for the Console constructor
200-
value: function(stdout,stderr){
201+
value: assignFunctionName(kBindStreamsEager,function(stdout,stderr){
201202
ObjectDefineProperties(this,{
202203
'_stdout': {__proto__: null, ...consolePropAttributes,value: stdout},
203204
'_stderr': {__proto__: null, ...consolePropAttributes,value: stderr},
204205
});
205-
},
206+
}),
206207
},
207208
[kBindStreamsLazy]: {
208209
__proto__: null,
209210
...consolePropAttributes,
210211
// Lazily load the stdout and stderr from an object so we don't
211212
// create the stdio streams when they are not even accessed
212-
value: function(object){
213+
value: assignFunctionName(kBindStreamsLazy,function(object){
213214
letstdout;
214215
letstderr;
215216
ObjectDefineProperties(this,{
@@ -232,12 +233,12 @@ ObjectDefineProperties(Console.prototype, {
232233
set(value){stderr=value;},
233234
},
234235
});
235-
},
236+
}),
236237
},
237238
[kBindProperties]: {
238239
__proto__: null,
239240
...consolePropAttributes,
240-
value: function(ignoreErrors,colorMode,groupIndentation=2){
241+
value: assignFunctionName(kBindProperties,function(ignoreErrors,colorMode,groupIndentation=2){
241242
ObjectDefineProperties(this,{
242243
'_stdoutErrorHandler': {
243244
__proto__: null,
@@ -277,12 +278,12 @@ ObjectDefineProperties(Console.prototype, {
277278
value: 'console',
278279
},
279280
});
280-
},
281+
}),
281282
},
282283
[kWriteToConsole]: {
283284
__proto__: null,
284285
...consolePropAttributes,
285-
value: function(streamSymbol,string){
286+
value: assignFunctionName(kWriteToConsole,function(streamSymbol,string){
286287
constignoreErrors=this._ignoreErrors;
287288
constgroupIndent=this[kGroupIndentationString];
288289

@@ -320,12 +321,12 @@ ObjectDefineProperties(Console.prototype, {
320321
}finally{
321322
stream.removeListener('error',noop);
322323
}
323-
},
324+
}),
324325
},
325326
[kGetInspectOptions]: {
326327
__proto__: null,
327328
...consolePropAttributes,
328-
value: function(stream){
329+
value: assignFunctionName(kGetInspectOptions,function(stream){
329330
letcolor=this[kColorMode];
330331
if(color==='auto'){
331332
color=lazyUtilColors().shouldColorize(stream);
@@ -341,12 +342,12 @@ ObjectDefineProperties(Console.prototype, {
341342
}
342343

343344
returncolor ? kColorInspectOptions : kNoColorInspectOptions;
344-
},
345+
}),
345346
},
346347
[kFormatForStdout]: {
347348
__proto__: null,
348349
...consolePropAttributes,
349-
value: function(args){
350+
value: assignFunctionName(kFormatForStdout,function(args){
350351
if(args.length===1){
351352
// Fast path: single string, don't call format.
352353
// Avoids ReflectApply and validation overhead.
@@ -358,12 +359,12 @@ ObjectDefineProperties(Console.prototype, {
358359
constopts=this[kGetInspectOptions](this._stdout);
359360
ArrayPrototypeUnshift(args,opts);
360361
returnReflectApply(formatWithOptions,null,args);
361-
},
362+
}),
362363
},
363364
[kFormatForStderr]: {
364365
__proto__: null,
365366
...consolePropAttributes,
366-
value: function(args){
367+
value: assignFunctionName(kFormatForStderr,function(args){
367368
if(args.length===1){
368369
// Fast path: single string, don't call format.
369370
// Avoids ReflectApply and validation overhead.
@@ -375,7 +376,7 @@ ObjectDefineProperties(Console.prototype, {
375376
constopts=this[kGetInspectOptions](this._stderr);
376377
ArrayPrototypeUnshift(args,opts);
377378
returnReflectApply(formatWithOptions,null,args);
378-
},
379+
}),
379380
},
380381
});
381382

‎lib/internal/modules/esm/hooks.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ function nextHookFactory(current, meta, { validateArgs, validateOutput }) {
758758
if(next){
759759
nextNextHook=nextHookFactory(next,meta,{ validateArgs, validateOutput });
760760
}else{
761-
// eslint-disable-next-line func-name-matching
761+
// eslint-disable-next-line node-core/func-name-matching
762762
nextNextHook=functionchainAdvancedTooFar(){
763763
thrownewERR_INTERNAL_ASSERTION(
764764
`ESM custom loader '${hookName}' advanced beyond the end of the chain.`,

‎lib/internal/modules/esm/translators.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ function loadCJSModuleWithSpecialRequire(module, source, url, filename, isMain,
120120
}
121121
constcascadedLoader=require('internal/modules/esm/loader').getOrInitializeCascadedLoader();
122122
const__dirname=dirname(filename);
123-
// eslint-disable-next-line func-name-matching,func-style
123+
// eslint-disable-next-line node-core/func-name-matching,func-style
124124
constrequireFn=functionrequire(specifier){
125125
letimportAttributes=kEmptyObject;
126126
if(!StringPrototypeStartsWith(specifier,'node:')&&!BuiltinModule.normalizeRequirableId(specifier)){

‎lib/internal/per_context/domexception.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function throwInvalidThisError(Base, type) {
3838
},
3939
toString: {
4040
__proto__: null,
41-
value(){
41+
value: functiontoString(){
4242
return`${this.name} [${key}]: ${this.message}`;
4343
},
4444
enumerable: false,

‎lib/internal/streams/writable.js‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ const {
8484
kOnConstructed,
8585
}=require('internal/streams/utils');
8686

87+
const{ assignFunctionName }=require('internal/util');
88+
8789
const{ errorOrDestroy }=destroyImpl;
8890

8991
ObjectSetPrototypeOf(Writable.prototype,Stream.prototype);
@@ -434,12 +436,12 @@ function Writable(options) {
434436

435437
ObjectDefineProperty(Writable,SymbolHasInstance,{
436438
__proto__: null,
437-
value: function(object){
438-
if(FunctionPrototypeSymbolHasInstance(this,object))returntrue;
439+
value: assignFunctionName(SymbolHasInstance,function(instance){
440+
if(FunctionPrototypeSymbolHasInstance(this,instance))returntrue;
439441
if(this!==Writable)returnfalse;
440442

441-
returnobject&&object._writableStateinstanceofWritableState;
442-
},
443+
returninstance&&instance._writableStateinstanceofWritableState;
444+
}),
443445
});
444446

445447
// Otherwise people can pipe Writable streams, which is just wrong.

‎lib/internal/test_runner/mock/mock_timers.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ class MockTimers {
644644
__proto__: null,
645645
configurable: true,
646646
writable: true,
647-
value: functionvalue(delay){
647+
value: functiontimeout(delay){
648648
validateUint32(delay,'delay',false);
649649
constcontroller=newAbortController();
650650
// Don't keep an unused binding to the timer; mock tick controls it

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Commit 6b09d30

Browse files
LiviaMedeiroslouiellan
authored andcommitted
lib,tools: add node-core/func-name-matching lint rule
And rename functions accordingly. Signed-off-by: LiviaMedeiros <livia@cirno.name> Co-authored-by: louiellan <louie.lou.llaneta@gmail.com> PR-URL: #57901 Refs: #57899 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 99b7382 commit 6b09d30

17 files changed

Lines changed: 1491 additions & 50 deletions

File tree

‎doc/api/modules.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ exports = { hello: false }; // Not exported, only available in the module
11331133
When the `module.exports` property is being completely replaced by a new
11341134
object, it is common to also reassign `exports`:
11351135

1136-
<!-- eslint-disable func-name-matching -->
1136+
<!-- eslint-disable node-core/func-name-matching -->
11371137

11381138
```js
11391139
module.exports=exports=functionConstructor() {

‎eslint.config.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ export default [
176176
'default-case-last': 'error',
177177
'dot-notation': 'error',
178178
'eqeqeq': ['error','smart'],
179-
'func-name-matching': 'error',
180179
'func-style': ['error','declaration',{allowArrowFunctions: true}],
181180
'no-constant-condition': ['error',{checkLoops: false}],
182181
'no-constructor-return': 'error',
@@ -388,6 +387,7 @@ export default [
388387
'node-core/no-duplicate-requires': 'error',
389388
'node-core/prefer-proto': 'error',
390389
'node-core/prefer-optional-chaining': 'error',
390+
'node-core/func-name-matching': ['error',{considerPropertyDescriptor: true}],
391391
},
392392
},
393393
// #endregion

‎lib/fs.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ function exists(path, callback) {
267267

268268
ObjectDefineProperty(exists,kCustomPromisifiedSymbol,{
269269
__proto__: null,
270-
value: functionexists(path){// eslint-disable-line func-name-matching
270+
value: functionexists(path){
271271
returnnewPromise((resolve)=>fs.exists(path,resolve));
272272
},
273273
});

‎lib/internal/bootstrap/web/exposed-window-or-worker.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ ObjectDefineProperty(globalThis, 'fetch', {
7575
configurable: true,
7676
enumerable: true,
7777
writable: true,
78-
value: functionfetch(input,init=undefined){// eslint-disable-line func-name-matching
78+
value: functionfetch(input,init=undefined){
7979
if(!fetchImpl){// Implement lazy loading of undici module for fetch function
8080
constundiciModule=require('internal/deps/undici/undici');
8181
fetchImpl=undiciModule.fetch;

‎lib/internal/console/constructor.js‎

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const {
5151
}=require('internal/validators');
5252
const{ previewEntries }=internalBinding('util');
5353
const{Buffer: { isBuffer }}=require('buffer');
54+
const{ assignFunctionName }=require('internal/util');
5455
const{
5556
inspect,
5657
formatWithOptions,
@@ -182,9 +183,9 @@ const consolePropAttributes = {
182183
// Fixup global.console instanceof global.console.Console
183184
ObjectDefineProperty(Console,SymbolHasInstance,{
184185
__proto__: null,
185-
value(instance){
186+
value: assignFunctionName(SymbolHasInstance,function(instance){
186187
returninstance[kIsConsole];
187-
},
188+
}),
188189
});
189190

190191
constkColorInspectOptions={colors: true};
@@ -197,19 +198,19 @@ ObjectDefineProperties(Console.prototype, {
197198
__proto__: null,
198199
...consolePropAttributes,
199200
// Eager version for the Console constructor
200-
value: function(stdout,stderr){
201+
value: assignFunctionName(kBindStreamsEager,function(stdout,stderr){
201202
ObjectDefineProperties(this,{
202203
'_stdout': {__proto__: null, ...consolePropAttributes,value: stdout},
203204
'_stderr': {__proto__: null, ...consolePropAttributes,value: stderr},
204205
});
205-
},
206+
}),
206207
},
207208
[kBindStreamsLazy]: {
208209
__proto__: null,
209210
...consolePropAttributes,
210211
// Lazily load the stdout and stderr from an object so we don't
211212
// create the stdio streams when they are not even accessed
212-
value: function(object){
213+
value: assignFunctionName(kBindStreamsLazy,function(object){
213214
letstdout;
214215
letstderr;
215216
ObjectDefineProperties(this,{
@@ -232,12 +233,12 @@ ObjectDefineProperties(Console.prototype, {
232233
set(value){stderr=value;},
233234
},
234235
});
235-
},
236+
}),
236237
},
237238
[kBindProperties]: {
238239
__proto__: null,
239240
...consolePropAttributes,
240-
value: function(ignoreErrors,colorMode,groupIndentation=2){
241+
value: assignFunctionName(kBindProperties,function(ignoreErrors,colorMode,groupIndentation=2){
241242
ObjectDefineProperties(this,{
242243
'_stdoutErrorHandler': {
243244
__proto__: null,
@@ -277,12 +278,12 @@ ObjectDefineProperties(Console.prototype, {
277278
value: 'console',
278279
},
279280
});
280-
},
281+
}),
281282
},
282283
[kWriteToConsole]: {
283284
__proto__: null,
284285
...consolePropAttributes,
285-
value: function(streamSymbol,string){
286+
value: assignFunctionName(kWriteToConsole,function(streamSymbol,string){
286287
constignoreErrors=this._ignoreErrors;
287288
constgroupIndent=this[kGroupIndentationString];
288289

@@ -320,12 +321,12 @@ ObjectDefineProperties(Console.prototype, {
320321
}finally{
321322
stream.removeListener('error',noop);
322323
}
323-
},
324+
}),
324325
},
325326
[kGetInspectOptions]: {
326327
__proto__: null,
327328
...consolePropAttributes,
328-
value: function(stream){
329+
value: assignFunctionName(kGetInspectOptions,function(stream){
329330
letcolor=this[kColorMode];
330331
if(color==='auto'){
331332
color=lazyUtilColors().shouldColorize(stream);
@@ -341,12 +342,12 @@ ObjectDefineProperties(Console.prototype, {
341342
}
342343

343344
returncolor ? kColorInspectOptions : kNoColorInspectOptions;
344-
},
345+
}),
345346
},
346347
[kFormatForStdout]: {
347348
__proto__: null,
348349
...consolePropAttributes,
349-
value: function(args){
350+
value: assignFunctionName(kFormatForStdout,function(args){
350351
if(args.length===1){
351352
// Fast path: single string, don't call format.
352353
// Avoids ReflectApply and validation overhead.
@@ -358,12 +359,12 @@ ObjectDefineProperties(Console.prototype, {
358359
constopts=this[kGetInspectOptions](this._stdout);
359360
ArrayPrototypeUnshift(args,opts);
360361
returnReflectApply(formatWithOptions,null,args);
361-
},
362+
}),
362363
},
363364
[kFormatForStderr]: {
364365
__proto__: null,
365366
...consolePropAttributes,
366-
value: function(args){
367+
value: assignFunctionName(kFormatForStderr,function(args){
367368
if(args.length===1){
368369
// Fast path: single string, don't call format.
369370
// Avoids ReflectApply and validation overhead.
@@ -375,7 +376,7 @@ ObjectDefineProperties(Console.prototype, {
375376
constopts=this[kGetInspectOptions](this._stderr);
376377
ArrayPrototypeUnshift(args,opts);
377378
returnReflectApply(formatWithOptions,null,args);
378-
},
379+
}),
379380
},
380381
});
381382

‎lib/internal/modules/esm/hooks.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ function nextHookFactory(current, meta, { validateArgs, validateOutput }) {
758758
if(next){
759759
nextNextHook=nextHookFactory(next,meta,{ validateArgs, validateOutput });
760760
}else{
761-
// eslint-disable-next-line func-name-matching
761+
// eslint-disable-next-line node-core/func-name-matching
762762
nextNextHook=functionchainAdvancedTooFar(){
763763
thrownewERR_INTERNAL_ASSERTION(
764764
`ESM custom loader '${hookName}' advanced beyond the end of the chain.`,

‎lib/internal/modules/esm/translators.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ function loadCJSModuleWithSpecialRequire(module, source, url, filename, isMain,
120120
}
121121
constcascadedLoader=require('internal/modules/esm/loader').getOrInitializeCascadedLoader();
122122
const__dirname=dirname(filename);
123-
// eslint-disable-next-line func-name-matching,func-style
123+
// eslint-disable-next-line node-core/func-name-matching,func-style
124124
constrequireFn=functionrequire(specifier){
125125
letimportAttributes=kEmptyObject;
126126
if(!StringPrototypeStartsWith(specifier,'node:')&&!BuiltinModule.normalizeRequirableId(specifier)){

‎lib/internal/per_context/domexception.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function throwInvalidThisError(Base, type) {
3838
},
3939
toString: {
4040
__proto__: null,
41-
value(){
41+
value: functiontoString(){
4242
return`${this.name} [${key}]: ${this.message}`;
4343
},
4444
enumerable: false,

‎lib/internal/streams/writable.js‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ const {
8484
kOnConstructed,
8585
}=require('internal/streams/utils');
8686

87+
const{ assignFunctionName }=require('internal/util');
88+
8789
const{ errorOrDestroy }=destroyImpl;
8890

8991
ObjectSetPrototypeOf(Writable.prototype,Stream.prototype);
@@ -434,12 +436,12 @@ function Writable(options) {
434436

435437
ObjectDefineProperty(Writable,SymbolHasInstance,{
436438
__proto__: null,
437-
value: function(object){
438-
if(FunctionPrototypeSymbolHasInstance(this,object))returntrue;
439+
value: assignFunctionName(SymbolHasInstance,function(instance){
440+
if(FunctionPrototypeSymbolHasInstance(this,instance))returntrue;
439441
if(this!==Writable)returnfalse;
440442

441-
returnobject&&object._writableStateinstanceofWritableState;
442-
},
443+
returninstance&&instance._writableStateinstanceofWritableState;
444+
}),
443445
});
444446

445447
// Otherwise people can pipe Writable streams, which is just wrong.

‎lib/internal/test_runner/mock/mock_timers.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ class MockTimers {
644644
__proto__: null,
645645
configurable: true,
646646
writable: true,
647-
value: functionvalue(delay){
647+
value: functiontimeout(delay){
648648
validateUint32(delay,'delay',false);
649649
constcontroller=newAbortController();
650650
// Don't keep an unused binding to the timer; mock tick controls it

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit 6b09d30

Browse files
LiviaMedeiroslouiellan
authored andcommitted
lib,tools: add node-core/func-name-matching lint rule
And rename functions accordingly. Signed-off-by: LiviaMedeiros <livia@cirno.name> Co-authored-by: louiellan <louie.lou.llaneta@gmail.com> PR-URL: #57901 Refs: #57899 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 99b7382 commit 6b09d30

17 files changed

Lines changed: 1491 additions & 50 deletions

File tree

‎doc/api/modules.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ exports = { hello: false }; // Not exported, only available in the module
11331133
When the `module.exports` property is being completely replaced by a new
11341134
object, it is common to also reassign `exports`:
11351135

1136-
<!-- eslint-disable func-name-matching -->
1136+
<!-- eslint-disable node-core/func-name-matching -->
11371137

11381138
```js
11391139
module.exports=exports=functionConstructor() {

‎eslint.config.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ export default [
176176
'default-case-last': 'error',
177177
'dot-notation': 'error',
178178
'eqeqeq': ['error','smart'],
179-
'func-name-matching': 'error',
180179
'func-style': ['error','declaration',{allowArrowFunctions: true}],
181180
'no-constant-condition': ['error',{checkLoops: false}],
182181
'no-constructor-return': 'error',
@@ -388,6 +387,7 @@ export default [
388387
'node-core/no-duplicate-requires': 'error',
389388
'node-core/prefer-proto': 'error',
390389
'node-core/prefer-optional-chaining': 'error',
390+
'node-core/func-name-matching': ['error',{considerPropertyDescriptor: true}],
391391
},
392392
},
393393
// #endregion

‎lib/fs.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ function exists(path, callback) {
267267

268268
ObjectDefineProperty(exists,kCustomPromisifiedSymbol,{
269269
__proto__: null,
270-
value: functionexists(path){// eslint-disable-line func-name-matching
270+
value: functionexists(path){
271271
returnnewPromise((resolve)=>fs.exists(path,resolve));
272272
},
273273
});

‎lib/internal/bootstrap/web/exposed-window-or-worker.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ ObjectDefineProperty(globalThis, 'fetch', {
7575
configurable: true,
7676
enumerable: true,
7777
writable: true,
78-
value: functionfetch(input,init=undefined){// eslint-disable-line func-name-matching
78+
value: functionfetch(input,init=undefined){
7979
if(!fetchImpl){// Implement lazy loading of undici module for fetch function
8080
constundiciModule=require('internal/deps/undici/undici');
8181
fetchImpl=undiciModule.fetch;

‎lib/internal/console/constructor.js‎

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const {
5151
}=require('internal/validators');
5252
const{ previewEntries }=internalBinding('util');
5353
const{Buffer: { isBuffer }}=require('buffer');
54+
const{ assignFunctionName }=require('internal/util');
5455
const{
5556
inspect,
5657
formatWithOptions,
@@ -182,9 +183,9 @@ const consolePropAttributes = {
182183
// Fixup global.console instanceof global.console.Console
183184
ObjectDefineProperty(Console,SymbolHasInstance,{
184185
__proto__: null,
185-
value(instance){
186+
value: assignFunctionName(SymbolHasInstance,function(instance){
186187
returninstance[kIsConsole];
187-
},
188+
}),
188189
});
189190

190191
constkColorInspectOptions={colors: true};
@@ -197,19 +198,19 @@ ObjectDefineProperties(Console.prototype, {
197198
__proto__: null,
198199
...consolePropAttributes,
199200
// Eager version for the Console constructor
200-
value: function(stdout,stderr){
201+
value: assignFunctionName(kBindStreamsEager,function(stdout,stderr){
201202
ObjectDefineProperties(this,{
202203
'_stdout': {__proto__: null, ...consolePropAttributes,value: stdout},
203204
'_stderr': {__proto__: null, ...consolePropAttributes,value: stderr},
204205
});
205-
},
206+
}),
206207
},
207208
[kBindStreamsLazy]: {
208209
__proto__: null,
209210
...consolePropAttributes,
210211
// Lazily load the stdout and stderr from an object so we don't
211212
// create the stdio streams when they are not even accessed
212-
value: function(object){
213+
value: assignFunctionName(kBindStreamsLazy,function(object){
213214
letstdout;
214215
letstderr;
215216
ObjectDefineProperties(this,{
@@ -232,12 +233,12 @@ ObjectDefineProperties(Console.prototype, {
232233
set(value){stderr=value;},
233234
},
234235
});
235-
},
236+
}),
236237
},
237238
[kBindProperties]: {
238239
__proto__: null,
239240
...consolePropAttributes,
240-
value: function(ignoreErrors,colorMode,groupIndentation=2){
241+
value: assignFunctionName(kBindProperties,function(ignoreErrors,colorMode,groupIndentation=2){
241242
ObjectDefineProperties(this,{
242243
'_stdoutErrorHandler': {
243244
__proto__: null,
@@ -277,12 +278,12 @@ ObjectDefineProperties(Console.prototype, {
277278
value: 'console',
278279
},
279280
});
280-
},
281+
}),
281282
},
282283
[kWriteToConsole]: {
283284
__proto__: null,
284285
...consolePropAttributes,
285-
value: function(streamSymbol,string){
286+
value: assignFunctionName(kWriteToConsole,function(streamSymbol,string){
286287
constignoreErrors=this._ignoreErrors;
287288
constgroupIndent=this[kGroupIndentationString];
288289

@@ -320,12 +321,12 @@ ObjectDefineProperties(Console.prototype, {
320321
}finally{
321322
stream.removeListener('error',noop);
322323
}
323-
},
324+
}),
324325
},
325326
[kGetInspectOptions]: {
326327
__proto__: null,
327328
...consolePropAttributes,
328-
value: function(stream){
329+
value: assignFunctionName(kGetInspectOptions,function(stream){
329330
letcolor=this[kColorMode];
330331
if(color==='auto'){
331332
color=lazyUtilColors().shouldColorize(stream);
@@ -341,12 +342,12 @@ ObjectDefineProperties(Console.prototype, {
341342
}
342343

343344
returncolor ? kColorInspectOptions : kNoColorInspectOptions;
344-
},
345+
}),
345346
},
346347
[kFormatForStdout]: {
347348
__proto__: null,
348349
...consolePropAttributes,
349-
value: function(args){
350+
value: assignFunctionName(kFormatForStdout,function(args){
350351
if(args.length===1){
351352
// Fast path: single string, don't call format.
352353
// Avoids ReflectApply and validation overhead.
@@ -358,12 +359,12 @@ ObjectDefineProperties(Console.prototype, {
358359
constopts=this[kGetInspectOptions](this._stdout);
359360
ArrayPrototypeUnshift(args,opts);
360361
returnReflectApply(formatWithOptions,null,args);
361-
},
362+
}),
362363
},
363364
[kFormatForStderr]: {
364365
__proto__: null,
365366
...consolePropAttributes,
366-
value: function(args){
367+
value: assignFunctionName(kFormatForStderr,function(args){
367368
if(args.length===1){
368369
// Fast path: single string, don't call format.
369370
// Avoids ReflectApply and validation overhead.
@@ -375,7 +376,7 @@ ObjectDefineProperties(Console.prototype, {
375376
constopts=this[kGetInspectOptions](this._stderr);
376377
ArrayPrototypeUnshift(args,opts);
377378
returnReflectApply(formatWithOptions,null,args);
378-
},
379+
}),
379380
},
380381
});
381382

‎lib/internal/modules/esm/hooks.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ function nextHookFactory(current, meta, { validateArgs, validateOutput }) {
758758
if(next){
759759
nextNextHook=nextHookFactory(next,meta,{ validateArgs, validateOutput });
760760
}else{
761-
// eslint-disable-next-line func-name-matching
761+
// eslint-disable-next-line node-core/func-name-matching
762762
nextNextHook=functionchainAdvancedTooFar(){
763763
thrownewERR_INTERNAL_ASSERTION(
764764
`ESM custom loader '${hookName}' advanced beyond the end of the chain.`,

‎lib/internal/modules/esm/translators.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ function loadCJSModuleWithSpecialRequire(module, source, url, filename, isMain,
120120
}
121121
constcascadedLoader=require('internal/modules/esm/loader').getOrInitializeCascadedLoader();
122122
const__dirname=dirname(filename);
123-
// eslint-disable-next-line func-name-matching,func-style
123+
// eslint-disable-next-line node-core/func-name-matching,func-style
124124
constrequireFn=functionrequire(specifier){
125125
letimportAttributes=kEmptyObject;
126126
if(!StringPrototypeStartsWith(specifier,'node:')&&!BuiltinModule.normalizeRequirableId(specifier)){

‎lib/internal/per_context/domexception.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function throwInvalidThisError(Base, type) {
3838
},
3939
toString: {
4040
__proto__: null,
41-
value(){
41+
value: functiontoString(){
4242
return`${this.name} [${key}]: ${this.message}`;
4343
},
4444
enumerable: false,

‎lib/internal/streams/writable.js‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ const {
8484
kOnConstructed,
8585
}=require('internal/streams/utils');
8686

87+
const{ assignFunctionName }=require('internal/util');
88+
8789
const{ errorOrDestroy }=destroyImpl;
8890

8991
ObjectSetPrototypeOf(Writable.prototype,Stream.prototype);
@@ -434,12 +436,12 @@ function Writable(options) {
434436

435437
ObjectDefineProperty(Writable,SymbolHasInstance,{
436438
__proto__: null,
437-
value: function(object){
438-
if(FunctionPrototypeSymbolHasInstance(this,object))returntrue;
439+
value: assignFunctionName(SymbolHasInstance,function(instance){
440+
if(FunctionPrototypeSymbolHasInstance(this,instance))returntrue;
439441
if(this!==Writable)returnfalse;
440442

441-
returnobject&&object._writableStateinstanceofWritableState;
442-
},
443+
returninstance&&instance._writableStateinstanceofWritableState;
444+
}),
443445
});
444446

445447
// Otherwise people can pipe Writable streams, which is just wrong.

‎lib/internal/test_runner/mock/mock_timers.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ class MockTimers {
644644
__proto__: null,
645645
configurable: true,
646646
writable: true,
647-
value: functionvalue(delay){
647+
value: functiontimeout(delay){
648648
validateUint32(delay,'delay',false);
649649
constcontroller=newAbortController();
650650
// Don't keep an unused binding to the timer; mock tick controls it

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit 6b09d30

Browse files
LiviaMedeiroslouiellan
authored andcommitted
lib,tools: add node-core/func-name-matching lint rule
And rename functions accordingly. Signed-off-by: LiviaMedeiros <livia@cirno.name> Co-authored-by: louiellan <louie.lou.llaneta@gmail.com> PR-URL: #57901 Refs: #57899 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 99b7382 commit 6b09d30

17 files changed

Lines changed: 1491 additions & 50 deletions

File tree

‎doc/api/modules.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ exports = { hello: false }; // Not exported, only available in the module
11331133
When the `module.exports` property is being completely replaced by a new
11341134
object, it is common to also reassign `exports`:
11351135

1136-
<!-- eslint-disable func-name-matching -->
1136+
<!-- eslint-disable node-core/func-name-matching -->
11371137

11381138
```js
11391139
module.exports=exports=functionConstructor() {

‎eslint.config.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ export default [
176176
'default-case-last': 'error',
177177
'dot-notation': 'error',
178178
'eqeqeq': ['error','smart'],
179-
'func-name-matching': 'error',
180179
'func-style': ['error','declaration',{allowArrowFunctions: true}],
181180
'no-constant-condition': ['error',{checkLoops: false}],
182181
'no-constructor-return': 'error',
@@ -388,6 +387,7 @@ export default [
388387
'node-core/no-duplicate-requires': 'error',
389388
'node-core/prefer-proto': 'error',
390389
'node-core/prefer-optional-chaining': 'error',
390+
'node-core/func-name-matching': ['error',{considerPropertyDescriptor: true}],
391391
},
392392
},
393393
// #endregion

‎lib/fs.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ function exists(path, callback) {
267267

268268
ObjectDefineProperty(exists,kCustomPromisifiedSymbol,{
269269
__proto__: null,
270-
value: functionexists(path){// eslint-disable-line func-name-matching
270+
value: functionexists(path){
271271
returnnewPromise((resolve)=>fs.exists(path,resolve));
272272
},
273273
});

‎lib/internal/bootstrap/web/exposed-window-or-worker.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ ObjectDefineProperty(globalThis, 'fetch', {
7575
configurable: true,
7676
enumerable: true,
7777
writable: true,
78-
value: functionfetch(input,init=undefined){// eslint-disable-line func-name-matching
78+
value: functionfetch(input,init=undefined){
7979
if(!fetchImpl){// Implement lazy loading of undici module for fetch function
8080
constundiciModule=require('internal/deps/undici/undici');
8181
fetchImpl=undiciModule.fetch;

‎lib/internal/console/constructor.js‎

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const {
5151
}=require('internal/validators');
5252
const{ previewEntries }=internalBinding('util');
5353
const{Buffer: { isBuffer }}=require('buffer');
54+
const{ assignFunctionName }=require('internal/util');
5455
const{
5556
inspect,
5657
formatWithOptions,
@@ -182,9 +183,9 @@ const consolePropAttributes = {
182183
// Fixup global.console instanceof global.console.Console
183184
ObjectDefineProperty(Console,SymbolHasInstance,{
184185
__proto__: null,
185-
value(instance){
186+
value: assignFunctionName(SymbolHasInstance,function(instance){
186187
returninstance[kIsConsole];
187-
},
188+
}),
188189
});
189190

190191
constkColorInspectOptions={colors: true};
@@ -197,19 +198,19 @@ ObjectDefineProperties(Console.prototype, {
197198
__proto__: null,
198199
...consolePropAttributes,
199200
// Eager version for the Console constructor
200-
value: function(stdout,stderr){
201+
value: assignFunctionName(kBindStreamsEager,function(stdout,stderr){
201202
ObjectDefineProperties(this,{
202203
'_stdout': {__proto__: null, ...consolePropAttributes,value: stdout},
203204
'_stderr': {__proto__: null, ...consolePropAttributes,value: stderr},
204205
});
205-
},
206+
}),
206207
},
207208
[kBindStreamsLazy]: {
208209
__proto__: null,
209210
...consolePropAttributes,
210211
// Lazily load the stdout and stderr from an object so we don't
211212
// create the stdio streams when they are not even accessed
212-
value: function(object){
213+
value: assignFunctionName(kBindStreamsLazy,function(object){
213214
letstdout;
214215
letstderr;
215216
ObjectDefineProperties(this,{
@@ -232,12 +233,12 @@ ObjectDefineProperties(Console.prototype, {
232233
set(value){stderr=value;},
233234
},
234235
});
235-
},
236+
}),
236237
},
237238
[kBindProperties]: {
238239
__proto__: null,
239240
...consolePropAttributes,
240-
value: function(ignoreErrors,colorMode,groupIndentation=2){
241+
value: assignFunctionName(kBindProperties,function(ignoreErrors,colorMode,groupIndentation=2){
241242
ObjectDefineProperties(this,{
242243
'_stdoutErrorHandler': {
243244
__proto__: null,
@@ -277,12 +278,12 @@ ObjectDefineProperties(Console.prototype, {
277278
value: 'console',
278279
},
279280
});
280-
},
281+
}),
281282
},
282283
[kWriteToConsole]: {
283284
__proto__: null,
284285
...consolePropAttributes,
285-
value: function(streamSymbol,string){
286+
value: assignFunctionName(kWriteToConsole,function(streamSymbol,string){
286287
constignoreErrors=this._ignoreErrors;
287288
constgroupIndent=this[kGroupIndentationString];
288289

@@ -320,12 +321,12 @@ ObjectDefineProperties(Console.prototype, {
320321
}finally{
321322
stream.removeListener('error',noop);
322323
}
323-
},
324+
}),
324325
},
325326
[kGetInspectOptions]: {
326327
__proto__: null,
327328
...consolePropAttributes,
328-
value: function(stream){
329+
value: assignFunctionName(kGetInspectOptions,function(stream){
329330
letcolor=this[kColorMode];
330331
if(color==='auto'){
331332
color=lazyUtilColors().shouldColorize(stream);
@@ -341,12 +342,12 @@ ObjectDefineProperties(Console.prototype, {
341342
}
342343

343344
returncolor ? kColorInspectOptions : kNoColorInspectOptions;
344-
},
345+
}),
345346
},
346347
[kFormatForStdout]: {
347348
__proto__: null,
348349
...consolePropAttributes,
349-
value: function(args){
350+
value: assignFunctionName(kFormatForStdout,function(args){
350351
if(args.length===1){
351352
// Fast path: single string, don't call format.
352353
// Avoids ReflectApply and validation overhead.
@@ -358,12 +359,12 @@ ObjectDefineProperties(Console.prototype, {
358359
constopts=this[kGetInspectOptions](this._stdout);
359360
ArrayPrototypeUnshift(args,opts);
360361
returnReflectApply(formatWithOptions,null,args);
361-
},
362+
}),
362363
},
363364
[kFormatForStderr]: {
364365
__proto__: null,
365366
...consolePropAttributes,
366-
value: function(args){
367+
value: assignFunctionName(kFormatForStderr,function(args){
367368
if(args.length===1){
368369
// Fast path: single string, don't call format.
369370
// Avoids ReflectApply and validation overhead.
@@ -375,7 +376,7 @@ ObjectDefineProperties(Console.prototype, {
375376
constopts=this[kGetInspectOptions](this._stderr);
376377
ArrayPrototypeUnshift(args,opts);
377378
returnReflectApply(formatWithOptions,null,args);
378-
},
379+
}),
379380
},
380381
});
381382

‎lib/internal/modules/esm/hooks.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ function nextHookFactory(current, meta, { validateArgs, validateOutput }) {
758758
if(next){
759759
nextNextHook=nextHookFactory(next,meta,{ validateArgs, validateOutput });
760760
}else{
761-
// eslint-disable-next-line func-name-matching
761+
// eslint-disable-next-line node-core/func-name-matching
762762
nextNextHook=functionchainAdvancedTooFar(){
763763
thrownewERR_INTERNAL_ASSERTION(
764764
`ESM custom loader '${hookName}' advanced beyond the end of the chain.`,

‎lib/internal/modules/esm/translators.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ function loadCJSModuleWithSpecialRequire(module, source, url, filename, isMain,
120120
}
121121
constcascadedLoader=require('internal/modules/esm/loader').getOrInitializeCascadedLoader();
122122
const__dirname=dirname(filename);
123-
// eslint-disable-next-line func-name-matching,func-style
123+
// eslint-disable-next-line node-core/func-name-matching,func-style
124124
constrequireFn=functionrequire(specifier){
125125
letimportAttributes=kEmptyObject;
126126
if(!StringPrototypeStartsWith(specifier,'node:')&&!BuiltinModule.normalizeRequirableId(specifier)){

‎lib/internal/per_context/domexception.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function throwInvalidThisError(Base, type) {
3838
},
3939
toString: {
4040
__proto__: null,
41-
value(){
41+
value: functiontoString(){
4242
return`${this.name} [${key}]: ${this.message}`;
4343
},
4444
enumerable: false,

‎lib/internal/streams/writable.js‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ const {
8484
kOnConstructed,
8585
}=require('internal/streams/utils');
8686

87+
const{ assignFunctionName }=require('internal/util');
88+
8789
const{ errorOrDestroy }=destroyImpl;
8890

8991
ObjectSetPrototypeOf(Writable.prototype,Stream.prototype);
@@ -434,12 +436,12 @@ function Writable(options) {
434436

435437
ObjectDefineProperty(Writable,SymbolHasInstance,{
436438
__proto__: null,
437-
value: function(object){
438-
if(FunctionPrototypeSymbolHasInstance(this,object))returntrue;
439+
value: assignFunctionName(SymbolHasInstance,function(instance){
440+
if(FunctionPrototypeSymbolHasInstance(this,instance))returntrue;
439441
if(this!==Writable)returnfalse;
440442

441-
returnobject&&object._writableStateinstanceofWritableState;
442-
},
443+
returninstance&&instance._writableStateinstanceofWritableState;
444+
}),
443445
});
444446

445447
// Otherwise people can pipe Writable streams, which is just wrong.

‎lib/internal/test_runner/mock/mock_timers.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ class MockTimers {
644644
__proto__: null,
645645
configurable: true,
646646
writable: true,
647-
value: functionvalue(delay){
647+
value: functiontimeout(delay){
648648
validateUint32(delay,'delay',false);
649649
constcontroller=newAbortController();
650650
// Don't keep an unused binding to the timer; mock tick controls it

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Commit 6b09d30

Browse files
LiviaMedeiroslouiellan
authored andcommitted
lib,tools: add node-core/func-name-matching lint rule
And rename functions accordingly. Signed-off-by: LiviaMedeiros <livia@cirno.name> Co-authored-by: louiellan <louie.lou.llaneta@gmail.com> PR-URL: #57901 Refs: #57899 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 99b7382 commit 6b09d30

17 files changed

Lines changed: 1491 additions & 50 deletions

File tree

‎doc/api/modules.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ exports = { hello: false }; // Not exported, only available in the module
11331133
When the `module.exports` property is being completely replaced by a new
11341134
object, it is common to also reassign `exports`:
11351135

1136-
<!-- eslint-disable func-name-matching -->
1136+
<!-- eslint-disable node-core/func-name-matching -->
11371137

11381138
```js
11391139
module.exports=exports=functionConstructor() {

‎eslint.config.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ export default [
176176
'default-case-last': 'error',
177177
'dot-notation': 'error',
178178
'eqeqeq': ['error','smart'],
179-
'func-name-matching': 'error',
180179
'func-style': ['error','declaration',{allowArrowFunctions: true}],
181180
'no-constant-condition': ['error',{checkLoops: false}],
182181
'no-constructor-return': 'error',
@@ -388,6 +387,7 @@ export default [
388387
'node-core/no-duplicate-requires': 'error',
389388
'node-core/prefer-proto': 'error',
390389
'node-core/prefer-optional-chaining': 'error',
390+
'node-core/func-name-matching': ['error',{considerPropertyDescriptor: true}],
391391
},
392392
},
393393
// #endregion

‎lib/fs.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ function exists(path, callback) {
267267

268268
ObjectDefineProperty(exists,kCustomPromisifiedSymbol,{
269269
__proto__: null,
270-
value: functionexists(path){// eslint-disable-line func-name-matching
270+
value: functionexists(path){
271271
returnnewPromise((resolve)=>fs.exists(path,resolve));
272272
},
273273
});

‎lib/internal/bootstrap/web/exposed-window-or-worker.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ ObjectDefineProperty(globalThis, 'fetch', {
7575
configurable: true,
7676
enumerable: true,
7777
writable: true,
78-
value: functionfetch(input,init=undefined){// eslint-disable-line func-name-matching
78+
value: functionfetch(input,init=undefined){
7979
if(!fetchImpl){// Implement lazy loading of undici module for fetch function
8080
constundiciModule=require('internal/deps/undici/undici');
8181
fetchImpl=undiciModule.fetch;

‎lib/internal/console/constructor.js‎

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const {
5151
}=require('internal/validators');
5252
const{ previewEntries }=internalBinding('util');
5353
const{Buffer: { isBuffer }}=require('buffer');
54+
const{ assignFunctionName }=require('internal/util');
5455
const{
5556
inspect,
5657
formatWithOptions,
@@ -182,9 +183,9 @@ const consolePropAttributes = {
182183
// Fixup global.console instanceof global.console.Console
183184
ObjectDefineProperty(Console,SymbolHasInstance,{
184185
__proto__: null,
185-
value(instance){
186+
value: assignFunctionName(SymbolHasInstance,function(instance){
186187
returninstance[kIsConsole];
187-
},
188+
}),
188189
});
189190

190191
constkColorInspectOptions={colors: true};
@@ -197,19 +198,19 @@ ObjectDefineProperties(Console.prototype, {
197198
__proto__: null,
198199
...consolePropAttributes,
199200
// Eager version for the Console constructor
200-
value: function(stdout,stderr){
201+
value: assignFunctionName(kBindStreamsEager,function(stdout,stderr){
201202
ObjectDefineProperties(this,{
202203
'_stdout': {__proto__: null, ...consolePropAttributes,value: stdout},
203204
'_stderr': {__proto__: null, ...consolePropAttributes,value: stderr},
204205
});
205-
},
206+
}),
206207
},
207208
[kBindStreamsLazy]: {
208209
__proto__: null,
209210
...consolePropAttributes,
210211
// Lazily load the stdout and stderr from an object so we don't
211212
// create the stdio streams when they are not even accessed
212-
value: function(object){
213+
value: assignFunctionName(kBindStreamsLazy,function(object){
213214
letstdout;
214215
letstderr;
215216
ObjectDefineProperties(this,{
@@ -232,12 +233,12 @@ ObjectDefineProperties(Console.prototype, {
232233
set(value){stderr=value;},
233234
},
234235
});
235-
},
236+
}),
236237
},
237238
[kBindProperties]: {
238239
__proto__: null,
239240
...consolePropAttributes,
240-
value: function(ignoreErrors,colorMode,groupIndentation=2){
241+
value: assignFunctionName(kBindProperties,function(ignoreErrors,colorMode,groupIndentation=2){
241242
ObjectDefineProperties(this,{
242243
'_stdoutErrorHandler': {
243244
__proto__: null,
@@ -277,12 +278,12 @@ ObjectDefineProperties(Console.prototype, {
277278
value: 'console',
278279
},
279280
});
280-
},
281+
}),
281282
},
282283
[kWriteToConsole]: {
283284
__proto__: null,
284285
...consolePropAttributes,
285-
value: function(streamSymbol,string){
286+
value: assignFunctionName(kWriteToConsole,function(streamSymbol,string){
286287
constignoreErrors=this._ignoreErrors;
287288
constgroupIndent=this[kGroupIndentationString];
288289

@@ -320,12 +321,12 @@ ObjectDefineProperties(Console.prototype, {
320321
}finally{
321322
stream.removeListener('error',noop);
322323
}
323-
},
324+
}),
324325
},
325326
[kGetInspectOptions]: {
326327
__proto__: null,
327328
...consolePropAttributes,
328-
value: function(stream){
329+
value: assignFunctionName(kGetInspectOptions,function(stream){
329330
letcolor=this[kColorMode];
330331
if(color==='auto'){
331332
color=lazyUtilColors().shouldColorize(stream);
@@ -341,12 +342,12 @@ ObjectDefineProperties(Console.prototype, {
341342
}
342343

343344
returncolor ? kColorInspectOptions : kNoColorInspectOptions;
344-
},
345+
}),
345346
},
346347
[kFormatForStdout]: {
347348
__proto__: null,
348349
...consolePropAttributes,
349-
value: function(args){
350+
value: assignFunctionName(kFormatForStdout,function(args){
350351
if(args.length===1){
351352
// Fast path: single string, don't call format.
352353
// Avoids ReflectApply and validation overhead.
@@ -358,12 +359,12 @@ ObjectDefineProperties(Console.prototype, {
358359
constopts=this[kGetInspectOptions](this._stdout);
359360
ArrayPrototypeUnshift(args,opts);
360361
returnReflectApply(formatWithOptions,null,args);
361-
},
362+
}),
362363
},
363364
[kFormatForStderr]: {
364365
__proto__: null,
365366
...consolePropAttributes,
366-
value: function(args){
367+
value: assignFunctionName(kFormatForStderr,function(args){
367368
if(args.length===1){
368369
// Fast path: single string, don't call format.
369370
// Avoids ReflectApply and validation overhead.
@@ -375,7 +376,7 @@ ObjectDefineProperties(Console.prototype, {
375376
constopts=this[kGetInspectOptions](this._stderr);
376377
ArrayPrototypeUnshift(args,opts);
377378
returnReflectApply(formatWithOptions,null,args);
378-
},
379+
}),
379380
},
380381
});
381382

‎lib/internal/modules/esm/hooks.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ function nextHookFactory(current, meta, { validateArgs, validateOutput }) {
758758
if(next){
759759
nextNextHook=nextHookFactory(next,meta,{ validateArgs, validateOutput });
760760
}else{
761-
// eslint-disable-next-line func-name-matching
761+
// eslint-disable-next-line node-core/func-name-matching
762762
nextNextHook=functionchainAdvancedTooFar(){
763763
thrownewERR_INTERNAL_ASSERTION(
764764
`ESM custom loader '${hookName}' advanced beyond the end of the chain.`,

‎lib/internal/modules/esm/translators.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ function loadCJSModuleWithSpecialRequire(module, source, url, filename, isMain,
120120
}
121121
constcascadedLoader=require('internal/modules/esm/loader').getOrInitializeCascadedLoader();
122122
const__dirname=dirname(filename);
123-
// eslint-disable-next-line func-name-matching,func-style
123+
// eslint-disable-next-line node-core/func-name-matching,func-style
124124
constrequireFn=functionrequire(specifier){
125125
letimportAttributes=kEmptyObject;
126126
if(!StringPrototypeStartsWith(specifier,'node:')&&!BuiltinModule.normalizeRequirableId(specifier)){

‎lib/internal/per_context/domexception.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function throwInvalidThisError(Base, type) {
3838
},
3939
toString: {
4040
__proto__: null,
41-
value(){
41+
value: functiontoString(){
4242
return`${this.name} [${key}]: ${this.message}`;
4343
},
4444
enumerable: false,

‎lib/internal/streams/writable.js‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ const {
8484
kOnConstructed,
8585
}=require('internal/streams/utils');
8686

87+
const{ assignFunctionName }=require('internal/util');
88+
8789
const{ errorOrDestroy }=destroyImpl;
8890

8991
ObjectSetPrototypeOf(Writable.prototype,Stream.prototype);
@@ -434,12 +436,12 @@ function Writable(options) {
434436

435437
ObjectDefineProperty(Writable,SymbolHasInstance,{
436438
__proto__: null,
437-
value: function(object){
438-
if(FunctionPrototypeSymbolHasInstance(this,object))returntrue;
439+
value: assignFunctionName(SymbolHasInstance,function(instance){
440+
if(FunctionPrototypeSymbolHasInstance(this,instance))returntrue;
439441
if(this!==Writable)returnfalse;
440442

441-
returnobject&&object._writableStateinstanceofWritableState;
442-
},
443+
returninstance&&instance._writableStateinstanceofWritableState;
444+
}),
443445
});
444446

445447
// Otherwise people can pipe Writable streams, which is just wrong.

‎lib/internal/test_runner/mock/mock_timers.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ class MockTimers {
644644
__proto__: null,
645645
configurable: true,
646646
writable: true,
647-
value: functionvalue(delay){
647+
value: functiontimeout(delay){
648648
validateUint32(delay,'delay',false);
649649
constcontroller=newAbortController();
650650
// Don't keep an unused binding to the timer; mock tick controls it

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit 6b09d30

Browse files
LiviaMedeiroslouiellan
authored andcommitted
lib,tools: add node-core/func-name-matching lint rule
And rename functions accordingly. Signed-off-by: LiviaMedeiros <livia@cirno.name> Co-authored-by: louiellan <louie.lou.llaneta@gmail.com> PR-URL: #57901 Refs: #57899 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 99b7382 commit 6b09d30

17 files changed

Lines changed: 1491 additions & 50 deletions

File tree

‎doc/api/modules.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ exports = { hello: false }; // Not exported, only available in the module
11331133
When the `module.exports` property is being completely replaced by a new
11341134
object, it is common to also reassign `exports`:
11351135

1136-
<!-- eslint-disable func-name-matching -->
1136+
<!-- eslint-disable node-core/func-name-matching -->
11371137

11381138
```js
11391139
module.exports=exports=functionConstructor() {

‎eslint.config.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ export default [
176176
'default-case-last': 'error',
177177
'dot-notation': 'error',
178178
'eqeqeq': ['error','smart'],
179-
'func-name-matching': 'error',
180179
'func-style': ['error','declaration',{allowArrowFunctions: true}],
181180
'no-constant-condition': ['error',{checkLoops: false}],
182181
'no-constructor-return': 'error',
@@ -388,6 +387,7 @@ export default [
388387
'node-core/no-duplicate-requires': 'error',
389388
'node-core/prefer-proto': 'error',
390389
'node-core/prefer-optional-chaining': 'error',
390+
'node-core/func-name-matching': ['error',{considerPropertyDescriptor: true}],
391391
},
392392
},
393393
// #endregion

‎lib/fs.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ function exists(path, callback) {
267267

268268
ObjectDefineProperty(exists,kCustomPromisifiedSymbol,{
269269
__proto__: null,
270-
value: functionexists(path){// eslint-disable-line func-name-matching
270+
value: functionexists(path){
271271
returnnewPromise((resolve)=>fs.exists(path,resolve));
272272
},
273273
});

‎lib/internal/bootstrap/web/exposed-window-or-worker.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ ObjectDefineProperty(globalThis, 'fetch', {
7575
configurable: true,
7676
enumerable: true,
7777
writable: true,
78-
value: functionfetch(input,init=undefined){// eslint-disable-line func-name-matching
78+
value: functionfetch(input,init=undefined){
7979
if(!fetchImpl){// Implement lazy loading of undici module for fetch function
8080
constundiciModule=require('internal/deps/undici/undici');
8181
fetchImpl=undiciModule.fetch;

‎lib/internal/console/constructor.js‎

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const {
5151
}=require('internal/validators');
5252
const{ previewEntries }=internalBinding('util');
5353
const{Buffer: { isBuffer }}=require('buffer');
54+
const{ assignFunctionName }=require('internal/util');
5455
const{
5556
inspect,
5657
formatWithOptions,
@@ -182,9 +183,9 @@ const consolePropAttributes = {
182183
// Fixup global.console instanceof global.console.Console
183184
ObjectDefineProperty(Console,SymbolHasInstance,{
184185
__proto__: null,
185-
value(instance){
186+
value: assignFunctionName(SymbolHasInstance,function(instance){
186187
returninstance[kIsConsole];
187-
},
188+
}),
188189
});
189190

190191
constkColorInspectOptions={colors: true};
@@ -197,19 +198,19 @@ ObjectDefineProperties(Console.prototype, {
197198
__proto__: null,
198199
...consolePropAttributes,
199200
// Eager version for the Console constructor
200-
value: function(stdout,stderr){
201+
value: assignFunctionName(kBindStreamsEager,function(stdout,stderr){
201202
ObjectDefineProperties(this,{
202203
'_stdout': {__proto__: null, ...consolePropAttributes,value: stdout},
203204
'_stderr': {__proto__: null, ...consolePropAttributes,value: stderr},
204205
});
205-
},
206+
}),
206207
},
207208
[kBindStreamsLazy]: {
208209
__proto__: null,
209210
...consolePropAttributes,
210211
// Lazily load the stdout and stderr from an object so we don't
211212
// create the stdio streams when they are not even accessed
212-
value: function(object){
213+
value: assignFunctionName(kBindStreamsLazy,function(object){
213214
letstdout;
214215
letstderr;
215216
ObjectDefineProperties(this,{
@@ -232,12 +233,12 @@ ObjectDefineProperties(Console.prototype, {
232233
set(value){stderr=value;},
233234
},
234235
});
235-
},
236+
}),
236237
},
237238
[kBindProperties]: {
238239
__proto__: null,
239240
...consolePropAttributes,
240-
value: function(ignoreErrors,colorMode,groupIndentation=2){
241+
value: assignFunctionName(kBindProperties,function(ignoreErrors,colorMode,groupIndentation=2){
241242
ObjectDefineProperties(this,{
242243
'_stdoutErrorHandler': {
243244
__proto__: null,
@@ -277,12 +278,12 @@ ObjectDefineProperties(Console.prototype, {
277278
value: 'console',
278279
},
279280
});
280-
},
281+
}),
281282
},
282283
[kWriteToConsole]: {
283284
__proto__: null,
284285
...consolePropAttributes,
285-
value: function(streamSymbol,string){
286+
value: assignFunctionName(kWriteToConsole,function(streamSymbol,string){
286287
constignoreErrors=this._ignoreErrors;
287288
constgroupIndent=this[kGroupIndentationString];
288289

@@ -320,12 +321,12 @@ ObjectDefineProperties(Console.prototype, {
320321
}finally{
321322
stream.removeListener('error',noop);
322323
}
323-
},
324+
}),
324325
},
325326
[kGetInspectOptions]: {
326327
__proto__: null,
327328
...consolePropAttributes,
328-
value: function(stream){
329+
value: assignFunctionName(kGetInspectOptions,function(stream){
329330
letcolor=this[kColorMode];
330331
if(color==='auto'){
331332
color=lazyUtilColors().shouldColorize(stream);
@@ -341,12 +342,12 @@ ObjectDefineProperties(Console.prototype, {
341342
}
342343

343344
returncolor ? kColorInspectOptions : kNoColorInspectOptions;
344-
},
345+
}),
345346
},
346347
[kFormatForStdout]: {
347348
__proto__: null,
348349
...consolePropAttributes,
349-
value: function(args){
350+
value: assignFunctionName(kFormatForStdout,function(args){
350351
if(args.length===1){
351352
// Fast path: single string, don't call format.
352353
// Avoids ReflectApply and validation overhead.
@@ -358,12 +359,12 @@ ObjectDefineProperties(Console.prototype, {
358359
constopts=this[kGetInspectOptions](this._stdout);
359360
ArrayPrototypeUnshift(args,opts);
360361
returnReflectApply(formatWithOptions,null,args);
361-
},
362+
}),
362363
},
363364
[kFormatForStderr]: {
364365
__proto__: null,
365366
...consolePropAttributes,
366-
value: function(args){
367+
value: assignFunctionName(kFormatForStderr,function(args){
367368
if(args.length===1){
368369
// Fast path: single string, don't call format.
369370
// Avoids ReflectApply and validation overhead.
@@ -375,7 +376,7 @@ ObjectDefineProperties(Console.prototype, {
375376
constopts=this[kGetInspectOptions](this._stderr);
376377
ArrayPrototypeUnshift(args,opts);
377378
returnReflectApply(formatWithOptions,null,args);
378-
},
379+
}),
379380
},
380381
});
381382

‎lib/internal/modules/esm/hooks.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ function nextHookFactory(current, meta, { validateArgs, validateOutput }) {
758758
if(next){
759759
nextNextHook=nextHookFactory(next,meta,{ validateArgs, validateOutput });
760760
}else{
761-
// eslint-disable-next-line func-name-matching
761+
// eslint-disable-next-line node-core/func-name-matching
762762
nextNextHook=functionchainAdvancedTooFar(){
763763
thrownewERR_INTERNAL_ASSERTION(
764764
`ESM custom loader '${hookName}' advanced beyond the end of the chain.`,

‎lib/internal/modules/esm/translators.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ function loadCJSModuleWithSpecialRequire(module, source, url, filename, isMain,
120120
}
121121
constcascadedLoader=require('internal/modules/esm/loader').getOrInitializeCascadedLoader();
122122
const__dirname=dirname(filename);
123-
// eslint-disable-next-line func-name-matching,func-style
123+
// eslint-disable-next-line node-core/func-name-matching,func-style
124124
constrequireFn=functionrequire(specifier){
125125
letimportAttributes=kEmptyObject;
126126
if(!StringPrototypeStartsWith(specifier,'node:')&&!BuiltinModule.normalizeRequirableId(specifier)){

‎lib/internal/per_context/domexception.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function throwInvalidThisError(Base, type) {
3838
},
3939
toString: {
4040
__proto__: null,
41-
value(){
41+
value: functiontoString(){
4242
return`${this.name} [${key}]: ${this.message}`;
4343
},
4444
enumerable: false,

‎lib/internal/streams/writable.js‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ const {
8484
kOnConstructed,
8585
}=require('internal/streams/utils');
8686

87+
const{ assignFunctionName }=require('internal/util');
88+
8789
const{ errorOrDestroy }=destroyImpl;
8890

8991
ObjectSetPrototypeOf(Writable.prototype,Stream.prototype);
@@ -434,12 +436,12 @@ function Writable(options) {
434436

435437
ObjectDefineProperty(Writable,SymbolHasInstance,{
436438
__proto__: null,
437-
value: function(object){
438-
if(FunctionPrototypeSymbolHasInstance(this,object))returntrue;
439+
value: assignFunctionName(SymbolHasInstance,function(instance){
440+
if(FunctionPrototypeSymbolHasInstance(this,instance))returntrue;
439441
if(this!==Writable)returnfalse;
440442

441-
returnobject&&object._writableStateinstanceofWritableState;
442-
},
443+
returninstance&&instance._writableStateinstanceofWritableState;
444+
}),
443445
});
444446

445447
// Otherwise people can pipe Writable streams, which is just wrong.

‎lib/internal/test_runner/mock/mock_timers.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ class MockTimers {
644644
__proto__: null,
645645
configurable: true,
646646
writable: true,
647-
value: functionvalue(delay){
647+
value: functiontimeout(delay){
648648
validateUint32(delay,'delay',false);
649649
constcontroller=newAbortController();
650650
// Don't keep an unused binding to the timer; mock tick controls it

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit 6b09d30

Browse files
LiviaMedeiroslouiellan
authored andcommitted
lib,tools: add node-core/func-name-matching lint rule
And rename functions accordingly. Signed-off-by: LiviaMedeiros <livia@cirno.name> Co-authored-by: louiellan <louie.lou.llaneta@gmail.com> PR-URL: #57901 Refs: #57899 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 99b7382 commit 6b09d30

17 files changed

Lines changed: 1491 additions & 50 deletions

File tree

‎doc/api/modules.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ exports = { hello: false }; // Not exported, only available in the module
11331133
When the `module.exports` property is being completely replaced by a new
11341134
object, it is common to also reassign `exports`:
11351135

1136-
<!-- eslint-disable func-name-matching -->
1136+
<!-- eslint-disable node-core/func-name-matching -->
11371137

11381138
```js
11391139
module.exports=exports=functionConstructor() {

‎eslint.config.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ export default [
176176
'default-case-last': 'error',
177177
'dot-notation': 'error',
178178
'eqeqeq': ['error','smart'],
179-
'func-name-matching': 'error',
180179
'func-style': ['error','declaration',{allowArrowFunctions: true}],
181180
'no-constant-condition': ['error',{checkLoops: false}],
182181
'no-constructor-return': 'error',
@@ -388,6 +387,7 @@ export default [
388387
'node-core/no-duplicate-requires': 'error',
389388
'node-core/prefer-proto': 'error',
390389
'node-core/prefer-optional-chaining': 'error',
390+
'node-core/func-name-matching': ['error',{considerPropertyDescriptor: true}],
391391
},
392392
},
393393
// #endregion

‎lib/fs.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ function exists(path, callback) {
267267

268268
ObjectDefineProperty(exists,kCustomPromisifiedSymbol,{
269269
__proto__: null,
270-
value: functionexists(path){// eslint-disable-line func-name-matching
270+
value: functionexists(path){
271271
returnnewPromise((resolve)=>fs.exists(path,resolve));
272272
},
273273
});

‎lib/internal/bootstrap/web/exposed-window-or-worker.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ ObjectDefineProperty(globalThis, 'fetch', {
7575
configurable: true,
7676
enumerable: true,
7777
writable: true,
78-
value: functionfetch(input,init=undefined){// eslint-disable-line func-name-matching
78+
value: functionfetch(input,init=undefined){
7979
if(!fetchImpl){// Implement lazy loading of undici module for fetch function
8080
constundiciModule=require('internal/deps/undici/undici');
8181
fetchImpl=undiciModule.fetch;

‎lib/internal/console/constructor.js‎

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const {
5151
}=require('internal/validators');
5252
const{ previewEntries }=internalBinding('util');
5353
const{Buffer: { isBuffer }}=require('buffer');
54+
const{ assignFunctionName }=require('internal/util');
5455
const{
5556
inspect,
5657
formatWithOptions,
@@ -182,9 +183,9 @@ const consolePropAttributes = {
182183
// Fixup global.console instanceof global.console.Console
183184
ObjectDefineProperty(Console,SymbolHasInstance,{
184185
__proto__: null,
185-
value(instance){
186+
value: assignFunctionName(SymbolHasInstance,function(instance){
186187
returninstance[kIsConsole];
187-
},
188+
}),
188189
});
189190

190191
constkColorInspectOptions={colors: true};
@@ -197,19 +198,19 @@ ObjectDefineProperties(Console.prototype, {
197198
__proto__: null,
198199
...consolePropAttributes,
199200
// Eager version for the Console constructor
200-
value: function(stdout,stderr){
201+
value: assignFunctionName(kBindStreamsEager,function(stdout,stderr){
201202
ObjectDefineProperties(this,{
202203
'_stdout': {__proto__: null, ...consolePropAttributes,value: stdout},
203204
'_stderr': {__proto__: null, ...consolePropAttributes,value: stderr},
204205
});
205-
},
206+
}),
206207
},
207208
[kBindStreamsLazy]: {
208209
__proto__: null,
209210
...consolePropAttributes,
210211
// Lazily load the stdout and stderr from an object so we don't
211212
// create the stdio streams when they are not even accessed
212-
value: function(object){
213+
value: assignFunctionName(kBindStreamsLazy,function(object){
213214
letstdout;
214215
letstderr;
215216
ObjectDefineProperties(this,{
@@ -232,12 +233,12 @@ ObjectDefineProperties(Console.prototype, {
232233
set(value){stderr=value;},
233234
},
234235
});
235-
},
236+
}),
236237
},
237238
[kBindProperties]: {
238239
__proto__: null,
239240
...consolePropAttributes,
240-
value: function(ignoreErrors,colorMode,groupIndentation=2){
241+
value: assignFunctionName(kBindProperties,function(ignoreErrors,colorMode,groupIndentation=2){
241242
ObjectDefineProperties(this,{
242243
'_stdoutErrorHandler': {
243244
__proto__: null,
@@ -277,12 +278,12 @@ ObjectDefineProperties(Console.prototype, {
277278
value: 'console',
278279
},
279280
});
280-
},
281+
}),
281282
},
282283
[kWriteToConsole]: {
283284
__proto__: null,
284285
...consolePropAttributes,
285-
value: function(streamSymbol,string){
286+
value: assignFunctionName(kWriteToConsole,function(streamSymbol,string){
286287
constignoreErrors=this._ignoreErrors;
287288
constgroupIndent=this[kGroupIndentationString];
288289

@@ -320,12 +321,12 @@ ObjectDefineProperties(Console.prototype, {
320321
}finally{
321322
stream.removeListener('error',noop);
322323
}
323-
},
324+
}),
324325
},
325326
[kGetInspectOptions]: {
326327
__proto__: null,
327328
...consolePropAttributes,
328-
value: function(stream){
329+
value: assignFunctionName(kGetInspectOptions,function(stream){
329330
letcolor=this[kColorMode];
330331
if(color==='auto'){
331332
color=lazyUtilColors().shouldColorize(stream);
@@ -341,12 +342,12 @@ ObjectDefineProperties(Console.prototype, {
341342
}
342343

343344
returncolor ? kColorInspectOptions : kNoColorInspectOptions;
344-
},
345+
}),
345346
},
346347
[kFormatForStdout]: {
347348
__proto__: null,
348349
...consolePropAttributes,
349-
value: function(args){
350+
value: assignFunctionName(kFormatForStdout,function(args){
350351
if(args.length===1){
351352
// Fast path: single string, don't call format.
352353
// Avoids ReflectApply and validation overhead.
@@ -358,12 +359,12 @@ ObjectDefineProperties(Console.prototype, {
358359
constopts=this[kGetInspectOptions](this._stdout);
359360
ArrayPrototypeUnshift(args,opts);
360361
returnReflectApply(formatWithOptions,null,args);
361-
},
362+
}),
362363
},
363364
[kFormatForStderr]: {
364365
__proto__: null,
365366
...consolePropAttributes,
366-
value: function(args){
367+
value: assignFunctionName(kFormatForStderr,function(args){
367368
if(args.length===1){
368369
// Fast path: single string, don't call format.
369370
// Avoids ReflectApply and validation overhead.
@@ -375,7 +376,7 @@ ObjectDefineProperties(Console.prototype, {
375376
constopts=this[kGetInspectOptions](this._stderr);
376377
ArrayPrototypeUnshift(args,opts);
377378
returnReflectApply(formatWithOptions,null,args);
378-
},
379+
}),
379380
},
380381
});
381382

‎lib/internal/modules/esm/hooks.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ function nextHookFactory(current, meta, { validateArgs, validateOutput }) {
758758
if(next){
759759
nextNextHook=nextHookFactory(next,meta,{ validateArgs, validateOutput });
760760
}else{
761-
// eslint-disable-next-line func-name-matching
761+
// eslint-disable-next-line node-core/func-name-matching
762762
nextNextHook=functionchainAdvancedTooFar(){
763763
thrownewERR_INTERNAL_ASSERTION(
764764
`ESM custom loader '${hookName}' advanced beyond the end of the chain.`,

‎lib/internal/modules/esm/translators.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ function loadCJSModuleWithSpecialRequire(module, source, url, filename, isMain,
120120
}
121121
constcascadedLoader=require('internal/modules/esm/loader').getOrInitializeCascadedLoader();
122122
const__dirname=dirname(filename);
123-
// eslint-disable-next-line func-name-matching,func-style
123+
// eslint-disable-next-line node-core/func-name-matching,func-style
124124
constrequireFn=functionrequire(specifier){
125125
letimportAttributes=kEmptyObject;
126126
if(!StringPrototypeStartsWith(specifier,'node:')&&!BuiltinModule.normalizeRequirableId(specifier)){

‎lib/internal/per_context/domexception.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function throwInvalidThisError(Base, type) {
3838
},
3939
toString: {
4040
__proto__: null,
41-
value(){
41+
value: functiontoString(){
4242
return`${this.name} [${key}]: ${this.message}`;
4343
},
4444
enumerable: false,

‎lib/internal/streams/writable.js‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ const {
8484
kOnConstructed,
8585
}=require('internal/streams/utils');
8686

87+
const{ assignFunctionName }=require('internal/util');
88+
8789
const{ errorOrDestroy }=destroyImpl;
8890

8991
ObjectSetPrototypeOf(Writable.prototype,Stream.prototype);
@@ -434,12 +436,12 @@ function Writable(options) {
434436

435437
ObjectDefineProperty(Writable,SymbolHasInstance,{
436438
__proto__: null,
437-
value: function(object){
438-
if(FunctionPrototypeSymbolHasInstance(this,object))returntrue;
439+
value: assignFunctionName(SymbolHasInstance,function(instance){
440+
if(FunctionPrototypeSymbolHasInstance(this,instance))returntrue;
439441
if(this!==Writable)returnfalse;
440442

441-
returnobject&&object._writableStateinstanceofWritableState;
442-
},
443+
returninstance&&instance._writableStateinstanceofWritableState;
444+
}),
443445
});
444446

445447
// Otherwise people can pipe Writable streams, which is just wrong.

‎lib/internal/test_runner/mock/mock_timers.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ class MockTimers {
644644
__proto__: null,
645645
configurable: true,
646646
writable: true,
647-
value: functionvalue(delay){
647+
value: functiontimeout(delay){
648648
validateUint32(delay,'delay',false);
649649
constcontroller=newAbortController();
650650
// Don't keep an unused binding to the timer; mock tick controls it

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Commit 6b09d30

Browse files
LiviaMedeiroslouiellan
authored andcommitted
lib,tools: add node-core/func-name-matching lint rule
And rename functions accordingly. Signed-off-by: LiviaMedeiros <livia@cirno.name> Co-authored-by: louiellan <louie.lou.llaneta@gmail.com> PR-URL: #57901 Refs: #57899 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 99b7382 commit 6b09d30

17 files changed

Lines changed: 1491 additions & 50 deletions

File tree

‎doc/api/modules.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ exports = { hello: false }; // Not exported, only available in the module
11331133
When the `module.exports` property is being completely replaced by a new
11341134
object, it is common to also reassign `exports`:
11351135

1136-
<!-- eslint-disable func-name-matching -->
1136+
<!-- eslint-disable node-core/func-name-matching -->
11371137

11381138
```js
11391139
module.exports=exports=functionConstructor() {

‎eslint.config.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ export default [
176176
'default-case-last': 'error',
177177
'dot-notation': 'error',
178178
'eqeqeq': ['error','smart'],
179-
'func-name-matching': 'error',
180179
'func-style': ['error','declaration',{allowArrowFunctions: true}],
181180
'no-constant-condition': ['error',{checkLoops: false}],
182181
'no-constructor-return': 'error',
@@ -388,6 +387,7 @@ export default [
388387
'node-core/no-duplicate-requires': 'error',
389388
'node-core/prefer-proto': 'error',
390389
'node-core/prefer-optional-chaining': 'error',
390+
'node-core/func-name-matching': ['error',{considerPropertyDescriptor: true}],
391391
},
392392
},
393393
// #endregion

‎lib/fs.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ function exists(path, callback) {
267267

268268
ObjectDefineProperty(exists,kCustomPromisifiedSymbol,{
269269
__proto__: null,
270-
value: functionexists(path){// eslint-disable-line func-name-matching
270+
value: functionexists(path){
271271
returnnewPromise((resolve)=>fs.exists(path,resolve));
272272
},
273273
});

‎lib/internal/bootstrap/web/exposed-window-or-worker.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ ObjectDefineProperty(globalThis, 'fetch', {
7575
configurable: true,
7676
enumerable: true,
7777
writable: true,
78-
value: functionfetch(input,init=undefined){// eslint-disable-line func-name-matching
78+
value: functionfetch(input,init=undefined){
7979
if(!fetchImpl){// Implement lazy loading of undici module for fetch function
8080
constundiciModule=require('internal/deps/undici/undici');
8181
fetchImpl=undiciModule.fetch;

‎lib/internal/console/constructor.js‎

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const {
5151
}=require('internal/validators');
5252
const{ previewEntries }=internalBinding('util');
5353
const{Buffer: { isBuffer }}=require('buffer');
54+
const{ assignFunctionName }=require('internal/util');
5455
const{
5556
inspect,
5657
formatWithOptions,
@@ -182,9 +183,9 @@ const consolePropAttributes = {
182183
// Fixup global.console instanceof global.console.Console
183184
ObjectDefineProperty(Console,SymbolHasInstance,{
184185
__proto__: null,
185-
value(instance){
186+
value: assignFunctionName(SymbolHasInstance,function(instance){
186187
returninstance[kIsConsole];
187-
},
188+
}),
188189
});
189190

190191
constkColorInspectOptions={colors: true};
@@ -197,19 +198,19 @@ ObjectDefineProperties(Console.prototype, {
197198
__proto__: null,
198199
...consolePropAttributes,
199200
// Eager version for the Console constructor
200-
value: function(stdout,stderr){
201+
value: assignFunctionName(kBindStreamsEager,function(stdout,stderr){
201202
ObjectDefineProperties(this,{
202203
'_stdout': {__proto__: null, ...consolePropAttributes,value: stdout},
203204
'_stderr': {__proto__: null, ...consolePropAttributes,value: stderr},
204205
});
205-
},
206+
}),
206207
},
207208
[kBindStreamsLazy]: {
208209
__proto__: null,
209210
...consolePropAttributes,
210211
// Lazily load the stdout and stderr from an object so we don't
211212
// create the stdio streams when they are not even accessed
212-
value: function(object){
213+
value: assignFunctionName(kBindStreamsLazy,function(object){
213214
letstdout;
214215
letstderr;
215216
ObjectDefineProperties(this,{
@@ -232,12 +233,12 @@ ObjectDefineProperties(Console.prototype, {
232233
set(value){stderr=value;},
233234
},
234235
});
235-
},
236+
}),
236237
},
237238
[kBindProperties]: {
238239
__proto__: null,
239240
...consolePropAttributes,
240-
value: function(ignoreErrors,colorMode,groupIndentation=2){
241+
value: assignFunctionName(kBindProperties,function(ignoreErrors,colorMode,groupIndentation=2){
241242
ObjectDefineProperties(this,{
242243
'_stdoutErrorHandler': {
243244
__proto__: null,
@@ -277,12 +278,12 @@ ObjectDefineProperties(Console.prototype, {
277278
value: 'console',
278279
},
279280
});
280-
},
281+
}),
281282
},
282283
[kWriteToConsole]: {
283284
__proto__: null,
284285
...consolePropAttributes,
285-
value: function(streamSymbol,string){
286+
value: assignFunctionName(kWriteToConsole,function(streamSymbol,string){
286287
constignoreErrors=this._ignoreErrors;
287288
constgroupIndent=this[kGroupIndentationString];
288289

@@ -320,12 +321,12 @@ ObjectDefineProperties(Console.prototype, {
320321
}finally{
321322
stream.removeListener('error',noop);
322323
}
323-
},
324+
}),
324325
},
325326
[kGetInspectOptions]: {
326327
__proto__: null,
327328
...consolePropAttributes,
328-
value: function(stream){
329+
value: assignFunctionName(kGetInspectOptions,function(stream){
329330
letcolor=this[kColorMode];
330331
if(color==='auto'){
331332
color=lazyUtilColors().shouldColorize(stream);
@@ -341,12 +342,12 @@ ObjectDefineProperties(Console.prototype, {
341342
}
342343

343344
returncolor ? kColorInspectOptions : kNoColorInspectOptions;
344-
},
345+
}),
345346
},
346347
[kFormatForStdout]: {
347348
__proto__: null,
348349
...consolePropAttributes,
349-
value: function(args){
350+
value: assignFunctionName(kFormatForStdout,function(args){
350351
if(args.length===1){
351352
// Fast path: single string, don't call format.
352353
// Avoids ReflectApply and validation overhead.
@@ -358,12 +359,12 @@ ObjectDefineProperties(Console.prototype, {
358359
constopts=this[kGetInspectOptions](this._stdout);
359360
ArrayPrototypeUnshift(args,opts);
360361
returnReflectApply(formatWithOptions,null,args);
361-
},
362+
}),
362363
},
363364
[kFormatForStderr]: {
364365
__proto__: null,
365366
...consolePropAttributes,
366-
value: function(args){
367+
value: assignFunctionName(kFormatForStderr,function(args){
367368
if(args.length===1){
368369
// Fast path: single string, don't call format.
369370
// Avoids ReflectApply and validation overhead.
@@ -375,7 +376,7 @@ ObjectDefineProperties(Console.prototype, {
375376
constopts=this[kGetInspectOptions](this._stderr);
376377
ArrayPrototypeUnshift(args,opts);
377378
returnReflectApply(formatWithOptions,null,args);
378-
},
379+
}),
379380
},
380381
});
381382

‎lib/internal/modules/esm/hooks.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ function nextHookFactory(current, meta, { validateArgs, validateOutput }) {
758758
if(next){
759759
nextNextHook=nextHookFactory(next,meta,{ validateArgs, validateOutput });
760760
}else{
761-
// eslint-disable-next-line func-name-matching
761+
// eslint-disable-next-line node-core/func-name-matching
762762
nextNextHook=functionchainAdvancedTooFar(){
763763
thrownewERR_INTERNAL_ASSERTION(
764764
`ESM custom loader '${hookName}' advanced beyond the end of the chain.`,

‎lib/internal/modules/esm/translators.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ function loadCJSModuleWithSpecialRequire(module, source, url, filename, isMain,
120120
}
121121
constcascadedLoader=require('internal/modules/esm/loader').getOrInitializeCascadedLoader();
122122
const__dirname=dirname(filename);
123-
// eslint-disable-next-line func-name-matching,func-style
123+
// eslint-disable-next-line node-core/func-name-matching,func-style
124124
constrequireFn=functionrequire(specifier){
125125
letimportAttributes=kEmptyObject;
126126
if(!StringPrototypeStartsWith(specifier,'node:')&&!BuiltinModule.normalizeRequirableId(specifier)){

‎lib/internal/per_context/domexception.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function throwInvalidThisError(Base, type) {
3838
},
3939
toString: {
4040
__proto__: null,
41-
value(){
41+
value: functiontoString(){
4242
return`${this.name} [${key}]: ${this.message}`;
4343
},
4444
enumerable: false,

‎lib/internal/streams/writable.js‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ const {
8484
kOnConstructed,
8585
}=require('internal/streams/utils');
8686

87+
const{ assignFunctionName }=require('internal/util');
88+
8789
const{ errorOrDestroy }=destroyImpl;
8890

8991
ObjectSetPrototypeOf(Writable.prototype,Stream.prototype);
@@ -434,12 +436,12 @@ function Writable(options) {
434436

435437
ObjectDefineProperty(Writable,SymbolHasInstance,{
436438
__proto__: null,
437-
value: function(object){
438-
if(FunctionPrototypeSymbolHasInstance(this,object))returntrue;
439+
value: assignFunctionName(SymbolHasInstance,function(instance){
440+
if(FunctionPrototypeSymbolHasInstance(this,instance))returntrue;
439441
if(this!==Writable)returnfalse;
440442

441-
returnobject&&object._writableStateinstanceofWritableState;
442-
},
443+
returninstance&&instance._writableStateinstanceofWritableState;
444+
}),
443445
});
444446

445447
// Otherwise people can pipe Writable streams, which is just wrong.

‎lib/internal/test_runner/mock/mock_timers.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ class MockTimers {
644644
__proto__: null,
645645
configurable: true,
646646
writable: true,
647-
value: functionvalue(delay){
647+
value: functiontimeout(delay){
648648
validateUint32(delay,'delay',false);
649649
constcontroller=newAbortController();
650650
// Don't keep an unused binding to the timer; mock tick controls it

0 commit comments

Comments
 (0)