tools: enforce use of trailing commas in `tools/`

PR-URL: https://github.com/nodejs/node/pull/45889
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
This commit is contained in:
Antoine du Hamel 2022-12-18 17:39:39 +01:00 committed by GitHub
parent 9d1d94819f
commit 3ce4cef4e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 128 additions and 121 deletions

View File

@ -68,7 +68,7 @@ module.exports = {
files: ['**/*.md/*.cjs', '**/*.md/*.js'],
parserOptions: {
sourceType: 'script',
ecmaFeatures: { impliedStrict: true }
ecmaFeatures: { impliedStrict: true },
},
rules: { strict: 'off' },
},
@ -103,11 +103,11 @@ module.exports = {
},
{
name: 'Buffer',
message: 'Import Buffer instead of using the global'
message: 'Import Buffer instead of using the global',
},
{
name: 'process',
message: 'Import process instead of using the global'
message: 'Import process instead of using the global',
},
] },
},
@ -134,13 +134,7 @@ module.exports = {
ignorePattern: '.*',
},
}],
'comma-dangle': ['error', {
arrays: 'always-multiline',
exports: 'only-multiline',
functions: 'only-multiline',
imports: 'only-multiline',
objects: 'only-multiline',
}],
'comma-dangle': ['error', 'always-multiline'],
'comma-spacing': 'error',
'comma-style': 'error',
'computed-property-spacing': 'error',

View File

@ -5,4 +5,11 @@ env:
es6: true
rules:
comma-dangle: [error, {
arrays: always-multiline,
exports: only-multiline,
functions: only-multiline,
imports: only-multiline,
objects: only-multiline,
}]
prefer-arrow-callback: error

View File

@ -15,4 +15,3 @@ rules:
# Stylistic Issues
no-multiple-empty-lines: [error, {max: 1, maxEOF: 0, maxBOF: 0}]
comma-dangle: [error, always-multiline]

View File

@ -2,6 +2,13 @@ env:
es6: true
rules:
comma-dangle: [error, {
arrays: always-multiline,
exports: only-multiline,
functions: only-multiline,
imports: only-multiline,
objects: only-multiline,
}]
prefer-object-spread: error
no-buffer-constructor: error
no-mixed-operators:

View File

@ -31,7 +31,7 @@ async function buildAddon(dir) {
await execFile(process.execPath, [nodeGyp, 'rebuild', `--directory=${dir}`],
{
stdio: 'inherit',
env: { ...process.env, MAKEFLAGS: '-j1' }
env: { ...process.env, MAKEFLAGS: '-j1' },
});
// We buffer the output and print it out once the process is done in order

View File

@ -38,7 +38,7 @@ tree.children.forEach((node) => {
await Promise.all(
Object.keys(addons).flatMap(
(header) => verifyFiles(addons[header].files, header)
(header) => verifyFiles(addons[header].files, header),
));
function verifyFiles(files, blockName) {
@ -82,8 +82,8 @@ ${files[name].replace(
sources: files.map(({ name }) => name),
includes: ['../common.gypi'],
},
]
})
],
}),
});
const dirCreation = mkdir(dir);

View File

@ -96,8 +96,8 @@ all = all.slice(0, apiStart.index + apiStart[0].length)
'\n</head>',
buildCSSForFlavoredJS(new Set(Array.from(
apicontent.matchAll(/(?<=<pre class="with-)\d+(?=-chars">)/g),
(x) => Number(x[0])
))) + '\n</head>'
(x) => Number(x[0]),
))) + '\n</head>',
) +
apicontent +
all.slice(apiEnd);

View File

@ -18,7 +18,7 @@ const results = {
modules: [],
classes: [],
globals: [],
methods: []
methods: [],
};
// Identify files that should be skipped. As files are processed, they
@ -33,7 +33,7 @@ for (const link of toc.match(/<a.*?>/g)) {
if (!jsonFiles.includes(json) || seen.has(json)) continue;
const data = JSON.parse(
fs.readFileSync(new URL(`./${json}`, source), 'utf8')
.replace(/<a href=\\"#/g, `<a href=\\"${href}#`)
.replace(/<a href=\\"#/g, `<a href=\\"${href}#`),
);
for (const property in data) {

View File

@ -27,7 +27,7 @@ function execSync(command) {
try {
return child_process.execSync(
command,
{ stdio: ['ignore', null, 'ignore'] }
{ stdio: ['ignore', null, 'ignore'] },
).toString().trim();
} catch {
return '';

View File

@ -27,7 +27,7 @@ const testHeading = (headingNode, expectedDeprecationCode) => {
assert.strictEqual(
headingNode?.children[0]?.value.substring(0, 9),
`${expectedDeprecationCode}: `,
'Ill-formed or out-of-order deprecation code.'
'Ill-formed or out-of-order deprecation code.',
);
} catch (e) {
throw addMarkdownPathToErrorStack(e, headingNode);
@ -39,7 +39,7 @@ const testYAMLComment = (commentNode) => {
assert.match(
commentNode?.value?.substring(0, 21),
/^<!-- YAML\r?\nchanges:\r?\n/,
'Missing or ill-formed YAML comment.'
'Missing or ill-formed YAML comment.',
);
} catch (e) {
throw addMarkdownPathToErrorStack(e, commentNode);
@ -51,7 +51,7 @@ const testDeprecationType = (paragraphNode) => {
assert.strictEqual(
paragraphNode?.children[0]?.value?.substring(0, 6),
'Type: ',
'Missing deprecation type.'
'Missing deprecation type.',
);
} catch (e) {
throw addMarkdownPathToErrorStack(e, paragraphNode);
@ -74,7 +74,7 @@ for (let i = 0; i < tree.children.length; i++) {
assert.strictEqual(
deprecationCodeAsText,
expectedDeprecationCode,
'Deprecation codes are not ordered correctly.'
'Deprecation codes are not ordered correctly.',
);
} catch (e) {
throw addMarkdownPathToErrorStack(e, node);

View File

@ -220,7 +220,7 @@ export function preprocessElements({ filename }) {
} else if (node.type === 'code') {
if (!node.lang) {
console.warn(
`No language set in ${filename}, line ${node.position.start.line}`
`No language set in ${filename}, line ${node.position.start.line}`,
);
}
const className = isJSFlavorSnippet(node) ?
@ -302,7 +302,7 @@ export function preprocessElements({ filename }) {
(noLinking ? '' :
'<a href="documentation.html#stability-index">') +
`${prefix} ${number}${noLinking ? '' : '</a>'}`
.replace(/\n/g, ' ')
.replace(/\n/g, ' '),
});
// Remove prefix and number from text
@ -408,7 +408,7 @@ export function buildToc({ filename, apilinks }) {
if (node.depth - depth > 1) {
throw new Error(
`Inappropriate heading level:\n${JSON.stringify(node)}`
`Inappropriate heading level:\n${JSON.stringify(node)}`,
);
}
@ -543,7 +543,7 @@ function gtocPicker(id) {
// Highlight the current module and add a link to the index
const gtoc = gtocHTML.replace(
`class="nav-${id}"`, `class="nav-${id} active"`
`class="nav-${id}"`, `class="nav-${id} active"`,
).replace('</ul>', `
<li>
<a href="index.html">Index</a>

View File

@ -349,7 +349,7 @@ function parseSignature(text, sig) {
throw new Error(
`Invalid param "${sigParam}"\n` +
` > ${JSON.stringify(listParam)}\n` +
` > ${text}`
` > ${text}`,
);
}
}
@ -376,7 +376,7 @@ function parseListItem(item, file) {
current.textRaw = item.children.filter((node) => node.type !== 'list')
.map((node) => (
file.value.slice(node.position.start.offset, node.position.end.offset))
file.value.slice(node.position.start.offset, node.position.end.offset)),
)
.join('').replace(/\s+/g, ' ').replace(/<!--.*?-->/sg, '');
let text = current.textRaw;

View File

@ -10,7 +10,7 @@ export function replaceLinks({ filename, linksMapper }) {
if (node.url) {
node.url = node.url.replace(
referenceToLocalMdFile,
(_, filename, hash) => `${filename}.html${hash || ''}`
(_, filename, hash) => `${filename}.html${hash || ''}`,
);
}
});

View File

@ -8,7 +8,7 @@ const jsPrimitives = {
number: 'Number',
string: 'String',
symbol: 'Symbol',
undefined: 'Undefined'
undefined: 'Undefined',
};
const jsGlobalObjectsUrl = `${jsDocPrefix}Reference/Global_Objects/`;
@ -301,7 +301,7 @@ export function toLink(typeInput) {
} else {
throw new Error(
`Unrecognized type: '${typeTextFull}'.\n` +
`Please, edit the type or update '${import.meta.url}'.`
`Please, edit the type or update '${import.meta.url}'.`,
);
}
} else {

View File

@ -26,7 +26,7 @@ module.exports = {
const message = [prefix, prev, opStr, curr].join('');
context.report({ node, message });
}
}
},
};
}
},
};

View File

@ -13,7 +13,7 @@ const message =
module.exports = {
meta: {
fixable: 'code'
fixable: 'code',
},
create: function(context) {
let hasCommonModule = false;
@ -31,10 +31,10 @@ module.exports = {
fix: (fixer) => {
if (hasCommonModule)
return fixer.insertTextAfter(node, '.then(common.mustCall())');
}
},
});
}
}
},
};
}
},
};

View File

@ -80,7 +80,7 @@ function createUnsafeStringMethodReport(context, name, lookedUpProperty) {
node,
message: `${name} looks up the ${lookedUpProperty} property on the first argument`,
});
}
},
};
}
@ -98,7 +98,7 @@ function createUnsafeStringMethodOnRegexReport(context, name, lookedUpProperty)
node,
message: `${name} looks up the ${lookedUpProperty} property of the passed regex, use ${safePrimordialName} directly`,
});
}
},
};
}
@ -155,7 +155,7 @@ module.exports = {
fixer.replaceTextRange(testRange, 'Exec'),
fixer.insertTextAfter(node, ' !== null'),
];
}
},
}],
});
},

View File

@ -78,7 +78,7 @@ module.exports = {
if (beforeAllChecks) {
context.report({
node: requireNode,
message: msg
message: msg,
});
}
});
@ -106,10 +106,10 @@ module.exports = {
commonModuleNode,
'\nif (!common.hasCrypto) {' +
' common.skip("missing crypto");' +
'}'
'}',
);
}
}
},
});
});
}
@ -118,7 +118,7 @@ module.exports = {
'CallExpression': (node) => testCryptoUsage(node),
'IfStatement:exit': (node) => testIfStatement(node),
'MemberExpression:exit': (node) => testMemberExpression(node),
'Program:exit': () => reportIfMissingCheck()
'Program:exit': () => reportIfMissingCheck(),
};
}
},
};

View File

@ -34,7 +34,7 @@ module.exports = {
`doc/api/errors.md does not have an anchor for "${code}"`;
context.report({ node, message });
}
}
},
};
}
},
};

View File

@ -47,10 +47,10 @@ module.exports = {
if (commonModuleNode) {
return fixer.insertTextAfter(
commonModuleNode,
'\ncommon.skipIfEslintMissing();'
'\ncommon.skipIfEslintMissing();',
);
}
}
},
});
});
}
@ -59,7 +59,7 @@ module.exports = {
return {
'CallExpression': (node) => testEslintUsage(context, node),
'MemberExpression': (node) => checkMemberExpression(context, node),
'Program:exit': () => reportIfMissing(context)
'Program:exit': () => reportIfMissing(context),
};
}
},
};

View File

@ -48,10 +48,10 @@ module.exports = {
if (commonModuleNode) {
return fixer.insertTextAfter(
commonModuleNode,
'\ncommon.skipIfInspectorDisabled();'
'\ncommon.skipIfInspectorDisabled();',
);
}
}
},
});
});
}
@ -60,7 +60,7 @@ module.exports = {
return {
'CallExpression': (node) => testInspectorUsage(context, node),
'MemberExpression': (node) => checkMemberExpression(context, node),
'Program:exit': () => reportIfMissing(context)
'Program:exit': () => reportIfMissing(context),
};
}
},
};

View File

@ -41,19 +41,19 @@ module.exports = function(context) {
fix: (fixer) => {
return fixer.replaceText(
node,
`'${lowercaseName}'`
`'${lowercaseName}'`,
);
}
},
});
}
}
return {
[astSelector]: (node) => checkNamesArgument(node)
[astSelector]: (node) => checkNamesArgument(node),
};
};
module.exports.meta = {
fixable: 'code'
fixable: 'code',
};

View File

@ -30,7 +30,7 @@ const findComma = (sourceCode, elements, i, start) => {
element = elements[--i];
}
let token = sourceCode.getTokenAfter(
element ?? sourceCode.getTokenByRangeStart(start)
element ?? sourceCode.getTokenByRangeStart(start),
);
for (; i < originalIndex; i++) {
token = sourceCode.getTokenAfter(token);
@ -43,7 +43,7 @@ const createFix = (fixer, sourceCode, { range: [start, end], elements }) => [
...elements.map((node, i) =>
(node === null ?
fixer.remove(findComma(sourceCode, elements, i, start)) :
fixer.insertTextBefore(node, i + ':'))
fixer.insertTextBefore(node, i + ':')),
),
];
const arrayPatternContainsRestOperator = ({ elements }) =>

View File

@ -52,7 +52,7 @@ module.exports = (context) => {
context.report(
node,
'\'{{moduleName}}\' require is duplicated.',
{ moduleName }
{ moduleName },
);
} else {
required.add(moduleName);

View File

@ -20,7 +20,7 @@ module.exports = {
context.report({
node,
loc: sourceCode.getLocFromIndex(indexOfDot),
message: 'Unescaped dot character in regular expression'
message: 'Unescaped dot character in regular expression',
});
}
const allowedModifiers = ['+', '*', '?', '{'];
@ -127,7 +127,7 @@ module.exports = {
'CallExpression': checkRegExpStart,
'NewExpression': checkRegExpStart,
'CallExpression:exit': checkRegExpEnd,
'NewExpression:exit': checkRegExpEnd
'NewExpression:exit': checkRegExpEnd,
};
}
},
};

View File

@ -21,7 +21,7 @@ const suggestions = {
'”': '"',
'«': '"',
'»': '"',
'—': '-'
'—': '-',
};
module.exports = (context) => {
@ -50,6 +50,6 @@ module.exports = (context) => {
};
return {
Program: (node) => reportIfError(node, context.getSourceCode())
Program: (node) => reportIfError(node, context.getSourceCode()),
};
};

View File

@ -9,7 +9,7 @@ const utils = require('./rules-utils.js');
module.exports = {
meta: {
fixable: 'code'
fixable: 'code',
},
create(context) {
const sourceCode = context.getSourceCode();
@ -52,13 +52,13 @@ module.exports = {
if (assertImported) {
return fixer.replaceText(
node,
`assert.ifError(${argument});`
`assert.ifError(${argument});`,
);
}
}
},
});
}
}
},
};
}
},
};

View File

@ -16,7 +16,7 @@ const preferredAssertMethod = {
'===': 'strictEqual',
'!==': 'notStrictEqual',
'==': 'equal',
'!=': 'notEqual'
'!=': 'notEqual',
};
module.exports = function(context) {
@ -34,15 +34,15 @@ module.exports = function(context) {
const right = sourceCode.getText(arg.right);
return fixer.replaceText(
node,
`assert.${assertMethod}(${left}, ${right});`
`assert.${assertMethod}(${left}, ${right});`,
);
}
},
});
}
}
},
};
};
module.exports.meta = {
fixable: 'code'
fixable: 'code',
};

View File

@ -25,6 +25,6 @@ module.exports = function(context) {
[arg0Selector]: report,
// Catch common.mustCall(fn, 0)
[arg1Selector]: report
[arg1Selector]: report,
};
};

View File

@ -61,6 +61,6 @@ module.exports = (context) => {
}
}
}
}
},
};
};

View File

@ -73,8 +73,8 @@ const identifierSelector = parentSelectors.map((selector) => `[type!=${selector}
module.exports = {
meta: {
messages: {
error: 'Use `const { {{name}} } = primordials;` instead of the global.'
}
error: 'Use `const { {{name}} } = primordials;` instead of the global.',
},
},
create(context) {
const globalScope = context.getSourceCode().scopeManager.globalScope;
@ -86,7 +86,7 @@ module.exports = {
const names = option.ignore || [];
nameMap.set(
option.name,
new Map(names.map((name) => [name, { ignored: true }]))
new Map(names.map((name) => [name, { ignored: true }])),
);
if (option.into) {
renameMap.set(option.name, option.into);
@ -111,7 +111,7 @@ module.exports = {
const name = node.name;
const parent = getDestructuringAssignmentParent(
context.getScope(),
node
node,
);
const parentName = parent?.name;
if (!isTarget(nameMap, name) && !isTarget(nameMap, parentName)) {
@ -129,8 +129,8 @@ module.exports = {
node,
messageId: 'error',
data: {
name: getReportName({ into, parentName, name })
}
name: getReportName({ into, parentName, name }),
},
});
}
return;
@ -142,8 +142,8 @@ module.exports = {
node,
messageId: 'error',
data: {
name: getReportName({ into, parentName, name })
}
name: getReportName({ into, parentName, name }),
},
});
}
},
@ -162,7 +162,7 @@ module.exports = {
messageId: 'error',
data: {
name: toPrimordialsName(obj, prop),
}
},
});
}
},
@ -180,5 +180,5 @@ module.exports = {
}
},
};
}
},
};

View File

@ -33,7 +33,7 @@ module.exports = {
});
if (hasSequentialParams)
context.report(msg, errMsg);
}
},
};
}
},
};

View File

@ -52,10 +52,10 @@ module.exports = function(context) {
node,
'Mandatory module "{{moduleName}}" must be loaded ' +
'before any other modules.',
{ moduleName: requiredModule }
{ moduleName: requiredModule },
);
}
}
},
};
if (isESM) {

View File

@ -56,17 +56,17 @@ module.exports = function(context) {
'Program:exit'(node) {
if (foundModules.length < requiredModules.length) {
const missingModules = requiredModules.filter(
([module]) => foundModules.indexOf(module) === -1
([module]) => foundModules.indexOf(module) === -1,
);
missingModules.forEach(([moduleName]) => {
context.report(
node,
'Mandatory module "{{moduleName}}" must be loaded.',
{ moduleName: moduleName }
{ moduleName: moduleName },
);
});
}
}
},
};
if (isESM) {
@ -95,7 +95,7 @@ module.exports.meta = {
schema: [{
'type': 'object',
'additionalProperties': {
'type': 'string'
'type': 'string',
},
}],
};

View File

@ -11,7 +11,7 @@ import { parseArgs } from 'node:util';
const args = parseArgs({
allowPositionals: true,
options: { verbose: { type: 'boolean', short: 'v' } }
options: { verbose: { type: 'boolean', short: 'v' } },
});
const verbose = args.values.verbose;
@ -27,7 +27,7 @@ async function runGitCommand(cmd, mapFn) {
input: childProcess.stdout,
});
const errorHandler = new Promise(
(_, reject) => childProcess.on('error', reject)
(_, reject) => childProcess.on('error', reject),
);
let returnValue = mapFn ? new Set() : '';
await Promise.race([errorHandler, Promise.resolve()]);
@ -50,13 +50,13 @@ async function runGitCommand(cmd, mapFn) {
// Get all commit authors during the time period.
const authors = await runGitCommand(
`git shortlog -n -s --email --since="${SINCE}" HEAD`,
(line) => line.trim().split('\t', 2)[1]
(line) => line.trim().split('\t', 2)[1],
);
// Get all approving reviewers of landed commits during the time period.
const approvingReviewers = await runGitCommand(
`git log --since="${SINCE}" | egrep "^ Reviewed-By: "`,
(line) => /^ {4}Reviewed-By: ([^<]+)/.exec(line)[1].trim()
(line) => /^ {4}Reviewed-By: ([^<]+)/.exec(line)[1].trim(),
);
async function getCollaboratorsFromReadme() {
@ -81,7 +81,7 @@ async function getCollaboratorsFromReadme() {
if (line.startsWith(' **') && isCollaborator) {
const [, name, email] = /^ {2}\*\*([^*]+)\*\* <<(.+)>>/.exec(line);
const mailmap = await runGitCommand(
`git check-mailmap '${name} <${email}>'`
`git check-mailmap '${name} <${email}>'`,
);
if (mailmap !== `${name} <${email}>`) {
console.log(`README entry for Collaborator does not match mailmap:\n ${name} <${email}> => ${mailmap}`);
@ -191,7 +191,7 @@ if (verbose) {
}
const inactive = collaborators.filter((collaborator) =>
!authors.has(collaborator.mailmap) &&
!approvingReviewers.has(collaborator.name)
!approvingReviewers.has(collaborator.name),
);
if (inactive.length) {

View File

@ -16,7 +16,7 @@ import { parseArgs } from 'node:util';
const args = parseArgs({
allowPositionals: true,
options: { verbose: { type: 'boolean', short: 'v' } }
options: { verbose: { type: 'boolean', short: 'v' } },
});
const verbose = args.values.verbose;
@ -32,7 +32,7 @@ async function runGitCommand(cmd, options = {}) {
input: childProcess.stdout,
});
const errorHandler = new Promise(
(_, reject) => childProcess.on('error', reject)
(_, reject) => childProcess.on('error', reject),
);
let returnValue = options.mapFn ? new Set() : '';
await Promise.race([errorHandler, Promise.resolve()]);
@ -122,7 +122,7 @@ async function getVotingRecords(tscMembers, votes) {
for (const vote of votes) {
// Get the vote data.
const voteData = JSON.parse(
await fs.promises.readFile(path.join('.tmp', vote), 'utf8')
await fs.promises.readFile(path.join('.tmp', vote), 'utf8'),
);
for (const member in voteData.votes) {
if (tscMembers.includes(member)) {
@ -227,33 +227,33 @@ await runGitCommand('git reset HEAD README.md');
await runGitCommand('git checkout -- README.md');
const tscMembers = tscMembersAtEnd.filter(
(memberAtEnd) => tscMembersAtStart.includes(memberAtEnd)
(memberAtEnd) => tscMembersAtStart.includes(memberAtEnd),
);
// Get all meetings since SINCE.
// Assumes that the TSC repo is cloned in the .tmp dir.
const meetings = await runGitCommand(
`git whatchanged --since '${SINCE}' --name-only --pretty=format: meetings`,
{ cwd: '.tmp', mapFn: (line) => line }
{ cwd: '.tmp', mapFn: (line) => line },
);
// Get TSC meeting attendance.
const attendance = await getAttendance(tscMembers, meetings);
const lightAttendance = tscMembers.filter(
(member) => attendance[member] < meetings.size * 0.25
(member) => attendance[member] < meetings.size * 0.25,
);
// Get all votes since SINCE.
// Assumes that the TSC repo is cloned in the .tmp dir.
const votes = await runGitCommand(
`git whatchanged --since '${SINCE}' --name-only --pretty=format: votes/*.json`,
{ cwd: '.tmp', mapFn: (line) => line }
{ cwd: '.tmp', mapFn: (line) => line },
);
// Check voting record.
const votingRecords = await getVotingRecords(tscMembers, votes);
const noVotes = tscMembers.filter(
(member) => votingRecords[member] === 0
(member) => votingRecords[member] === 0,
);
const inactive = lightAttendance.filter((member) => noVotes.includes(member));

View File

@ -63,7 +63,7 @@ class ParagraphParser extends Stream {
this.paragraph = {
li: '',
inLicenseBlock: this.blockIsLicenseBlock,
lines: []
lines: [],
};
}

View File

@ -32,7 +32,7 @@ const dir = await fs.promises.opendir(dataFolder);
for await (const dirent of dir) {
if (dirent.isFile()) {
filesToCheck.push(
getVersionsFromFile(new URL(dirent.name, dataFolder))
getVersionsFromFile(new URL(dirent.name, dataFolder)),
);
}
}

View File

@ -28,7 +28,7 @@ for await (const line of diff) {
} else if (!validatePrUrl(line.match(prUrlDefinition)?.[1])) {
console.warn(
`::warning file=${currentFile},line=${currentLine++},col=${line.length}` +
'::pr-url doesn\'t match the URL of the current PR.'
'::pr-url doesn\'t match the URL of the current PR.',
);
} else if (line[0] !== '-') {
// Increment line counter if line is not being deleted.

View File

@ -77,12 +77,12 @@ async function checkFiles(...files) {
(process.env.GITHUB_ACTIONS ?
`::error file=${file},line=1,col=1::` :
'Fixable with --fix: ') +
`Invalid hashbang for ${file} (expected /bin/sh).`
`Invalid hashbang for ${file} (expected /bin/sh).`,
);
}
}
await fd.close();
})
}),
);
const stdout = await new Promise((resolve, reject) => {
@ -102,7 +102,7 @@ async function checkFiles(...files) {
files.map((filePath) => relative(SPAWN_OPTIONS.cwd, filePath)) :
files),
],
SPAWN_OPTIONS
SPAWN_OPTIONS,
);
shellcheck.once('error', reject);
@ -138,7 +138,7 @@ async function checkFiles(...files) {
const data = JSON.parse(stdout);
for (const { file, line, column, message } of data) {
console.error(
`::error file=${file},line=${line},col=${column}::${file}:${line}:${column}: ${message}`
`::error file=${file},line=${line},col=${column}::${file}:${line}:${column}: ${message}`,
);
}
}

View File

@ -17,7 +17,7 @@ const log = spawn(
'git',
// Inspect author name/email and body.
['log', '--reverse', '--format=Author: %aN <%aE>\n%b'], {
stdio: ['inherit', 'pipe', 'inherit']
stdio: ['inherit', 'pipe', 'inherit'],
});
const rl = readline.createInterface({ input: log.stdout });