Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/api/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ exports = { hello: false }; // Not exported, only available in the module
When the `module.exports` property is being completely replaced by a new
object, it is common to also reassign `exports`:

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

```js
module.exports = exports = function Constructor() {
Expand Down
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ export default [
'default-case-last': 'error',
'dot-notation': 'error',
'eqeqeq': ['error', 'smart'],
'func-name-matching': 'error',
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
'no-constant-condition': ['error', { checkLoops: false }],
'no-constructor-return': 'error',
Expand Down Expand Up @@ -351,6 +350,7 @@ export default [
'node-core/no-duplicate-requires': 'error',
'node-core/prefer-proto': 'error',
'node-core/prefer-optional-chaining': 'error',
'node-core/func-name-matching': ['error', { considerPropertyDescriptor: true }],
},
},
// #endregion
Expand Down
2 changes: 1 addition & 1 deletion lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ function exists(path, callback) {

ObjectDefineProperty(exists, kCustomPromisifiedSymbol, {
__proto__: null,
value: function exists(path) { // eslint-disable-line func-name-matching
value: function exists(path) {
return new Promise((resolve) => fs.exists(path, resolve));
},
});
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/bootstrap/web/exposed-window-or-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ ObjectDefineProperty(globalThis, 'fetch', {
configurable: true,
enumerable: true,
writable: true,
value: function fetch(input, init = undefined) { // eslint-disable-line func-name-matching
value: function fetch(input, init = undefined) {
if (!fetchImpl) { // Implement lazy loading of undici module for fetch function
const undiciModule = require('internal/deps/undici/undici');
fetchImpl = undiciModule.fetch;
Expand Down
33 changes: 17 additions & 16 deletions lib/internal/console/constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const {
} = require('internal/validators');
const { previewEntries } = internalBinding('util');
const { Buffer: { isBuffer } } = require('buffer');
const { assignFunctionName } = require('internal/util');
const {
inspect,
formatWithOptions,
Expand Down Expand Up @@ -172,9 +173,9 @@ const consolePropAttributes = {
// Fixup global.console instanceof global.console.Console
ObjectDefineProperty(Console, SymbolHasInstance, {
__proto__: null,
value(instance) {
value: assignFunctionName(SymbolHasInstance, function(instance) {
return instance[kIsConsole];
},
}),
});

const kColorInspectOptions = { colors: true };
Expand All @@ -187,19 +188,19 @@ ObjectDefineProperties(Console.prototype, {
__proto__: null,
...consolePropAttributes,
// Eager version for the Console constructor
value: function(stdout, stderr) {
value: assignFunctionName(kBindStreamsEager, function(stdout, stderr) {
ObjectDefineProperties(this, {
'_stdout': { __proto__: null, ...consolePropAttributes, value: stdout },
'_stderr': { __proto__: null, ...consolePropAttributes, value: stderr },
});
},
}),
},
[kBindStreamsLazy]: {
__proto__: null,
...consolePropAttributes,
// Lazily load the stdout and stderr from an object so we don't
// create the stdio streams when they are not even accessed
value: function(object) {
value: assignFunctionName(kBindStreamsLazy, function(object) {
let stdout;
let stderr;
ObjectDefineProperties(this, {
Expand All @@ -222,12 +223,12 @@ ObjectDefineProperties(Console.prototype, {
set(value) { stderr = value; },
},
});
},
}),
},
[kBindProperties]: {
__proto__: null,
...consolePropAttributes,
value: function(ignoreErrors, colorMode, groupIndentation = 2) {
value: assignFunctionName(kBindProperties, function(ignoreErrors, colorMode, groupIndentation = 2) {
ObjectDefineProperties(this, {
'_stdoutErrorHandler': {
__proto__: null,
Expand Down Expand Up @@ -262,12 +263,12 @@ ObjectDefineProperties(Console.prototype, {
value: 'console',
},
});
},
}),
},
[kWriteToConsole]: {
__proto__: null,
...consolePropAttributes,
value: function(streamSymbol, string) {
value: assignFunctionName(kWriteToConsole, function(streamSymbol, string) {
const ignoreErrors = this._ignoreErrors;
const groupIndent = internalIndentationMap.get(this) || '';

Expand Down Expand Up @@ -305,12 +306,12 @@ ObjectDefineProperties(Console.prototype, {
} finally {
stream.removeListener('error', noop);
}
},
}),
},
[kGetInspectOptions]: {
__proto__: null,
...consolePropAttributes,
value: function(stream) {
value: assignFunctionName(kGetInspectOptions, function(stream) {
let color = this[kColorMode];
if (color === 'auto') {
color = lazyUtilColors().shouldColorize(stream);
Expand All @@ -325,25 +326,25 @@ ObjectDefineProperties(Console.prototype, {
}

return color ? kColorInspectOptions : kNoColorInspectOptions;
},
}),
},
[kFormatForStdout]: {
__proto__: null,
...consolePropAttributes,
value: function(args) {
value: assignFunctionName(kFormatForStdout, function(args) {
const opts = this[kGetInspectOptions](this._stdout);
ArrayPrototypeUnshift(args, opts);
return ReflectApply(formatWithOptions, null, args);
},
}),
},
[kFormatForStderr]: {
__proto__: null,
...consolePropAttributes,
value: function(args) {
value: assignFunctionName(kFormatForStderr, function(args) {
const opts = this[kGetInspectOptions](this._stderr);
ArrayPrototypeUnshift(args, opts);
return ReflectApply(formatWithOptions, null, args);
},
}),
},
});

Expand Down
2 changes: 1 addition & 1 deletion lib/internal/modules/esm/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ function nextHookFactory(current, meta, { validateArgs, validateOutput }) {
if (next) {
nextNextHook = nextHookFactory(next, meta, { validateArgs, validateOutput });
} else {
// eslint-disable-next-line func-name-matching
// eslint-disable-next-line node-core/func-name-matching
nextNextHook = function chainAdvancedTooFar() {
throw new ERR_INTERNAL_ASSERTION(
`ESM custom loader '${hookName}' advanced beyond the end of the chain.`,
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/modules/esm/translators.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ function loadCJSModule(module, source, url, filename, isMain) {

const cascadedLoader = require('internal/modules/esm/loader').getOrInitializeCascadedLoader();
const __dirname = dirname(filename);
// eslint-disable-next-line func-name-matching,func-style
// eslint-disable-next-line node-core/func-name-matching,func-style
const requireFn = function require(specifier) {
let importAttributes = kEmptyObject;
if (!StringPrototypeStartsWith(specifier, 'node:') && !BuiltinModule.normalizeRequirableId(specifier)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/per_context/domexception.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function throwInvalidThisError(Base, type) {
},
toString: {
__proto__: null,
value() {
value: function toString() {
return `${this.name} [${key}]: ${this.message}`;
},
enumerable: false,
Expand Down
10 changes: 6 additions & 4 deletions lib/internal/streams/writable.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ const {
kOnConstructed,
} = require('internal/streams/utils');

const { assignFunctionName } = require('internal/util');

const { errorOrDestroy } = destroyImpl;

ObjectSetPrototypeOf(Writable.prototype, Stream.prototype);
Expand Down Expand Up @@ -435,12 +437,12 @@ function Writable(options) {

ObjectDefineProperty(Writable, SymbolHasInstance, {
__proto__: null,
value: function(object) {
if (FunctionPrototypeSymbolHasInstance(this, object)) return true;
value: assignFunctionName(SymbolHasInstance, function(instance) {
if (FunctionPrototypeSymbolHasInstance(this, instance)) return true;
if (this !== Writable) return false;

return object && object._writableState instanceof WritableState;
},
return instance && instance._writableState instanceof WritableState;
}),
});

// Otherwise people can pipe Writable streams, which is just wrong.
Expand Down
20 changes: 10 additions & 10 deletions lib/internal/util/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,40 +76,40 @@ module.exports = {
isBigUint64Array,
};

let isCryptoKey;
let isKeyObject;
let isCryptoKeyFn;
let isKeyObjectFn;

ObjectDefineProperties(module.exports, {
isKeyObject: {
__proto__: null,
configurable: false,
enumerable: true,
value(obj) {
value: function isKeyObject(obj) {
if (!process.versions.openssl) {
return false;
}

if (!isKeyObject) {
({ isKeyObject } = require('internal/crypto/keys'));
if (!isKeyObjectFn) {
({ isKeyObject: isKeyObjectFn } = require('internal/crypto/keys'));
}

return isKeyObject(obj);
return isKeyObjectFn(obj);
},
},
isCryptoKey: {
__proto__: null,
configurable: false,
enumerable: true,
value(obj) {
value: function isCryptoKey(obj) {
if (!process.versions.openssl) {
return false;
}

if (!isCryptoKey) {
({ isCryptoKey } = require('internal/crypto/keys'));
if (!isCryptoKeyFn) {
({ isCryptoKey: isCryptoKeyFn } = require('internal/crypto/keys'));
}

return isCryptoKey(obj);
return isCryptoKeyFn(obj);
},
},
});
2 changes: 1 addition & 1 deletion lib/internal/worker/io.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ ObjectDefineProperty(MessagePort.prototype, inspect.custom, {
__proto__: null,
enumerable: false,
writable: false,
value: function inspect() { // eslint-disable-line func-name-matching
value: function inspect() {
let ref;
try {
// This may throw when `this` does not refer to a native object,
Expand Down
16 changes: 8 additions & 8 deletions lib/test/reporters.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ const {

let dot;
let junit;
let spec;
let specFn;
let tap;
let lcov;
let lcovFn;

ObjectDefineProperties(module.exports, {
__proto__: null,
Expand All @@ -35,9 +35,9 @@ ObjectDefineProperties(module.exports, {
__proto__: null,
configurable: true,
enumerable: true,
value: function value() {
spec ??= require('internal/test_runner/reporter/spec');
return ReflectConstruct(spec, arguments);
value: function spec() {
specFn ??= require('internal/test_runner/reporter/spec');
return ReflectConstruct(specFn, arguments);
},
},
tap: {
Expand All @@ -53,9 +53,9 @@ ObjectDefineProperties(module.exports, {
__proto__: null,
configurable: true,
enumerable: true,
value: function value() {
lcov ??= require('internal/test_runner/reporter/lcov');
return ReflectConstruct(lcov, arguments);
value: function lcov() {
lcovFn ??= require('internal/test_runner/reporter/lcov');
return ReflectConstruct(lcovFn, arguments);
},
},
});
5 changes: 3 additions & 2 deletions lib/zlib.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const {
} = require('internal/errors');
const { Transform, finished } = require('stream');
const {
assignFunctionName,
deprecateInstantiation,
} = require('internal/util');
const {
Expand Down Expand Up @@ -937,9 +938,9 @@ function createProperty(ctor) {
__proto__: null,
configurable: true,
enumerable: true,
value: function(options) {
value: assignFunctionName(`create${ctor.name}`, function(options) {
return new ctor(options);
},
}),
};
}

Expand Down
Loading
Loading