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

Enable unicorn/prefer-spread ESLint rule #1052

Merged
merged 2 commits into from
Sep 23, 2024
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
1 change: 0 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ export default [
'unicorn/better-regex': 'off',
'unicorn/no-array-reduce': 'off',
'unicorn/prefer-module': 'off',
'unicorn/prefer-spread': 'off',
},
},
// prefer TS to complain when we miss an arg vs. sending an intentional undefined
Expand Down
2 changes: 1 addition & 1 deletion node-src/git/getParentCommits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,6 @@ export async function getParentCommits(
// For any pair A,B of builds, there is no point in using B if it is an ancestor of A.
const descendentCommits = await maximallyDescendentCommits({ log }, commitsWithBuilds);

const ancestorCommits = extraParentCommits.concat(descendentCommits);
const ancestorCommits = [...extraParentCommits, ...descendentCommits];
return ancestorCommits;
}
7 changes: 4 additions & 3 deletions node-src/lib/getDependentStoryFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,10 @@ export async function getDependentStoryFiles(
// If we didn't find any node_modules in the stats file, it's probably incomplete and we can't
// trace changed dependencies, so we bail just in case.
ctx.turboSnap.bailReason = {
changedPackageFiles: ctx.git.changedFiles
.filter((file) => isPackageManifestFile(file))
.concat(changedPackageLockFiles),
changedPackageFiles: [
...ctx.git.changedFiles.filter((file) => isPackageManifestFile(file)),
...changedPackageLockFiles,
],
};
}

Expand Down
2 changes: 1 addition & 1 deletion node-src/tasks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ export const runPatchBuild = [prepareWorkspace, ...runUploadBuild, restoreWorksp
export default function index(options: Context['options']): Listr.ListrTask<Context>[] {
const tasks = options.patchHeadRef && options.patchBaseRef ? runUploadBuild : runUploadBuild;

return options.junitReport ? tasks.concat(report) : tasks;
return options.junitReport ? [...tasks, report] : tasks;
}
28 changes: 14 additions & 14 deletions node-src/ui/messages/info/tracedAffectedFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,20 +97,20 @@ export default (
const seen = new Set();
const traces = [...ctx.turboSnap.tracedPaths].map((p) => {
const parts = p.split('\n');
return parts
.reduce((acc, part, index) => {
if (index === 0) return chalk`— ${printPath(part)} {cyan [changed]}${printModules(part)}`;
const indent = ' '.repeat(index);
let note = '';
if (index === parts.length - 1) {
if (seen.has(part)) note = chalk` {yellow [duplicate]}`;
else seen.add(part);
}
return chalk`${
expanded ? `File Path: ${part}\n\nBase Directory: ${basedir}\n\n` : ''
}${acc}\n${indent}∟ ${printPath(part)}${note}${printModules(part, indent)}`;
}, '')
.concat(chalk`\n${' '.repeat(parts.length)}∟ {cyan [story index]}`);
const traceParts = parts.reduce((acc, part, index) => {
if (index === 0) return chalk`— ${printPath(part)} {cyan [changed]}${printModules(part)}`;
const indent = ' '.repeat(index);
let note = '';
if (index === parts.length - 1) {
if (seen.has(part)) note = chalk` {yellow [duplicate]}`;
else seen.add(part);
}
return chalk`${
expanded ? `File Path: ${part}\n\nBase Directory: ${basedir}\n\n` : ''
}${acc}\n${indent}∟ ${printPath(part)}${note}${printModules(part, indent)}`;
}, '');

return traceParts + chalk`\n${' '.repeat(parts.length)}∟ {cyan [story index]}`;
});

const note = chalk`\n\nSet {bold ${flag}} to {bold 'expanded'} to reveal underlying modules.`;
Expand Down
Loading