Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: enforce use of trailing commas #46881

Merged
merged 1 commit into from
Mar 6, 2023
Merged
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
34 changes: 0 additions & 34 deletions lib/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@ env:
es6: true

rules:
comma-dangle: [error, {
arrays: always-multiline,
exports: always-multiline,
functions: always-multiline,
imports: always-multiline,
objects: only-multiline,
}]
prefer-object-spread: error
no-buffer-constructor: error
no-mixed-operators:
Expand Down Expand Up @@ -261,30 +254,3 @@ globals:
module: false
internalBinding: false
primordials: false
overrides:
- files:
- ./*/*.js
- ./*.js
- ./internal/child_process/*.js
- ./internal/cluster/*.js
- ./internal/debugger/*.js
- ./internal/events/*.js
- ./internal/fs/*.js
- ./internal/modules/*.js
- ./internal/per_context/*.js
- ./internal/perf/*.js
- ./internal/policy/*.js
- ./internal/process/*.js
- ./internal/readline/*.js
- ./internal/readme.md
- ./internal/repl/*.js
- ./internal/source_map/*.js
- ./internal/streams/*.js
- ./internal/test/*.js
- ./internal/test_runner/**/*.js
- ./internal/tls/*.js
- ./internal/util/parse_args/*.js
- ./internal/watch_mode/*.js
- ./internal/webstreams/*.js
rules:
comma-dangle: [error, always-multiline]
debadree25 marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 5 additions & 5 deletions lib/internal/assert/assertion_error.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const kReadableOperator = {
'Expected "actual" not to be reference-equal to "expected":',
notDeepEqual: 'Expected "actual" not to be loosely deep-equal to:',
notIdentical: 'Values have same structure but are not reference-equal:',
notDeepEqualUnequal: 'Expected values not to be loosely deep-equal:'
notDeepEqualUnequal: 'Expected values not to be loosely deep-equal:',
};

// Comparing short primitives should just show === / !== instead of using the
Expand Down Expand Up @@ -330,11 +330,11 @@ class AssertionError extends Error {
stackStartFn,
details,
// Compatibility with older versions.
stackStartFunction
stackStartFunction,
} = options;
let {
actual,
expected
expected,
} = options;

const limit = Error.stackTraceLimit;
Expand Down Expand Up @@ -429,7 +429,7 @@ class AssertionError extends Error {
value: 'AssertionError [ERR_ASSERTION]',
enumerable: false,
writable: true,
configurable: true
configurable: true,
});
this.code = 'ERR_ASSERTION';
if (details) {
Expand Down Expand Up @@ -478,7 +478,7 @@ class AssertionError extends Error {
const result = inspect(this, {
...ctx,
customInspect: false,
depth: 0
depth: 0,
});

// Reset the properties after inspection.
Expand Down
4 changes: 2 additions & 2 deletions lib/internal/assert/calltracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class CallTrackerContext {
actual: this.#calls.length,
expected: this.#expected,
operator: this.#name,
stack: this.#stackTrace
stack: this.#stackTrace,
};
}
}
Expand Down Expand Up @@ -110,7 +110,7 @@ class CallTracker {
expected,
// eslint-disable-next-line no-restricted-syntax
stackTrace: new Error(),
name: fn.name || 'calls'
name: fn.name || 'calls',
});
const tracked = new Proxy(fn, {
__proto__: null,
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/bootstrap/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function exposeNamespace(target, name, namespaceObject) {
writable: true,
enumerable: false,
configurable: true,
value: namespaceObject
value: namespaceObject,
});
}

Expand Down
6 changes: 3 additions & 3 deletions lib/internal/bootstrap/loaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ ObjectDefineProperty(process, 'moduleLoadList', {
value: moduleLoadList,
configurable: true,
enumerable: true,
writable: false
writable: false,
});


Expand Down Expand Up @@ -181,7 +181,7 @@ let internalBinding;
const loaderId = 'internal/bootstrap/loaders';
const {
builtinIds,
compileFunction
compileFunction,
} = internalBinding('builtins');

const getOwn = (target, property, receiver) => {
Expand Down Expand Up @@ -349,7 +349,7 @@ class BuiltinModule {
const loaderExports = {
internalBinding,
BuiltinModule,
require: requireBuiltin
require: requireBuiltin,
};

function requireBuiltin(id) {
Expand Down
22 changes: 11 additions & 11 deletions lib/internal/bootstrap/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ internalBinding('async_wrap').setupHooks(nativeHooks);

const {
setupTaskQueue,
queueMicrotask
queueMicrotask,
} = require('internal/process/task_queues');

// Non-standard extensions:
Expand Down Expand Up @@ -248,11 +248,11 @@ ObjectDefineProperty(process, 'allowedNodeEnvironmentFlags', {
value,
configurable: true,
enumerable: true,
writable: true
writable: true,
});
},
enumerable: true,
configurable: true
configurable: true,
});

// process.assert
Expand All @@ -277,22 +277,22 @@ const features = {
// code cache even if the binary is built with embedded code cache.
get cached_builtins() {
return binding.hasCachedBuiltins();
}
},
};

ObjectDefineProperty(process, 'features', {
__proto__: null,
enumerable: true,
writable: false,
configurable: false,
value: features
value: features,
});

{
const {
onGlobalUncaughtException,
setUncaughtExceptionCaptureCallback,
hasUncaughtExceptionCaptureCallback
hasUncaughtExceptionCaptureCallback,
} = require('internal/process/execution');

// For legacy reasons this is still called `_fatalException`, even
Expand Down Expand Up @@ -339,14 +339,14 @@ process.emitWarning = emitWarning;
function setupPrepareStackTrace() {
const {
setEnhanceStackForFatalException,
setPrepareStackTraceCallback
setPrepareStackTraceCallback,
} = internalBinding('errors');
const {
prepareStackTrace,
fatalExceptionStackEnhancers: {
beforeInspector,
afterInspector
}
afterInspector,
},
} = require('internal/errors');
// Tell our PrepareStackTraceCallback passed to the V8 API
// to call prepareStackTrace().
Expand All @@ -365,7 +365,7 @@ function setupProcessObject() {
enumerable: false,
writable: true,
configurable: false,
value: 'process'
value: 'process',
});

// Create global.process as getters so that we have a
Expand All @@ -391,7 +391,7 @@ function setupGlobalProxy() {
value: 'global',
writable: false,
enumerable: false,
configurable: true
configurable: true,
});
globalThis.global = globalThis;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if (credentials.implementsPosixCredentials) {
// ---- compare the setups side-by-side -----

const {
codes: { ERR_WORKER_UNSUPPORTED_OPERATION }
codes: { ERR_WORKER_UNSUPPORTED_OPERATION },
} = require('internal/errors');

function wrappedUmask(mask) {
Expand Down
12 changes: 6 additions & 6 deletions lib/internal/bootstrap/switches/does_own_process_state.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ if (credentials.implementsPosixCredentials) {
const {
parseFileMode,
validateArray,
validateString
validateString,
} = require('internal/validators');

function wrapPosixCredentialSetters(credentials) {
const {
codes: {
ERR_INVALID_ARG_TYPE,
ERR_UNKNOWN_CREDENTIAL
}
ERR_UNKNOWN_CREDENTIAL,
},
} = require('internal/errors');
const {
validateUint32
validateUint32,
} = require('internal/validators');

const {
Expand All @@ -45,7 +45,7 @@ function wrapPosixCredentialSetters(credentials) {
setegid: _setegid,
seteuid: _seteuid,
setgid: _setgid,
setuid: _setuid
setuid: _setuid,
} = credentials;

function initgroups(user, extraGroup) {
Expand Down Expand Up @@ -99,7 +99,7 @@ function wrapPosixCredentialSetters(credentials) {
setegid: wrapIdSetter('Group', _setegid),
seteuid: wrapIdSetter('User', _seteuid),
setgid: wrapIdSetter('Group', _setgid),
setuid: wrapIdSetter('User', _setuid)
setuid: wrapIdSetter('User', _setuid),
};
}

Expand Down
16 changes: 8 additions & 8 deletions lib/internal/bootstrap/switches/is_main_thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const rawMethods = internalBinding('process_methods');
const {
namespace: {
addSerializeCallback,
isBuildingSnapshot
isBuildingSnapshot,
},
} = require('internal/v8/startup_snapshot');
// TODO(joyeecheung): deprecate and remove these underscore methods
Expand All @@ -23,7 +23,7 @@ function defineStream(name, getter) {
__proto__: null,
configurable: true,
enumerable: true,
get: getter
get: getter,
});
}

Expand All @@ -34,7 +34,7 @@ defineStream('stderr', getStderr);
// Worker threads don't receive signals.
const {
startListeningIfSignal,
stopListeningIfSignal
stopListeningIfSignal,
} = require('internal/process/signal');
process.on('newListener', startListeningIfSignal);
process.on('removeListener', stopListeningIfSignal);
Expand Down Expand Up @@ -74,13 +74,13 @@ function createWritableStdioStream(fd) {
stream = new net.Socket({
handle: process[kChannelHandle],
readable: false,
writable: true
writable: true,
});
} else {
stream = new net.Socket({
fd,
readable: false,
writable: true
writable: true,
});
}

Expand All @@ -95,7 +95,7 @@ function createWritableStdioStream(fd) {
stream = new Writable({
write(buf, enc, cb) {
cb();
}
},
});
}
}
Expand Down Expand Up @@ -218,14 +218,14 @@ function getStdin() {
handle: process.channel,
readable: true,
writable: false,
manualStart: true
manualStart: true,
});
} else {
stdin = new net.Socket({
fd: fd,
readable: true,
writable: false,
manualStart: true
manualStart: true,
});
}
// Make sure the stdin can't be `.end()`-ed
Expand Down
6 changes: 3 additions & 3 deletions lib/internal/bootstrap/switches/is_not_main_thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function defineStream(name, getter) {
__proto__: null,
configurable: true,
enumerable: true,
get: getter
get: getter,
});
}

Expand All @@ -21,7 +21,7 @@ defineStream('stderr', getStderr);
// Worker threads don't receive signals.
const {
startListeningIfSignal,
stopListeningIfSignal
stopListeningIfSignal,
} = require('internal/process/signal');
process.removeListener('newListener', startListeningIfSignal);
process.removeListener('removeListener', stopListeningIfSignal);
Expand All @@ -30,7 +30,7 @@ process.removeListener('removeListener', stopListeningIfSignal);
// ---- compare the setups side-by-side -----

const {
createWorkerStdio
createWorkerStdio,
} = require('internal/worker/io');

let workerStdio;
Expand Down
Loading