Skip to content
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
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@
},
"dependencies": {
"@1msg/sdk": "^2.0.2",
"commander": "^12.1.0",
"yaml": "^2.3.4"
"commander": "^13.1.0",
"yaml": "^2.9.1"
},
"devDependencies": {
"@types/jest": "^29.5.14",
"@types/node": "^22.20.1",
"jest": "^29.5.0",
"ts-jest": "^29.1.0",
"typescript": "^5.1.3"
"@types/jest": "^30.0.0",
"@types/node": "^26.6.6",
"jest": "^30.5.2",
"ts-jest": "^29.4.15",
"typescript": "~6.0.3"
},
"engines": {
"node": ">=18.0.0"
Expand Down
2,024 changes: 1,198 additions & 826 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

593 changes: 276 additions & 317 deletions quality/tooling/pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions quality/tooling/pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minimumReleaseAgeExclude:
- eslint-plugin-perfectionist@5.14.0
4 changes: 2 additions & 2 deletions src/__tests__/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ export function makeCtx(opts?: {
const value = files.get(String(p));
if (value === undefined) throw Object.assign(new Error('ENOENT'), { code: 'ENOENT' });
return value as string;
}) as typeof fs.readFileSync,
}) as unknown as typeof fs.readFileSync,
writeFileSync: ((p: fs.PathLike, data: string | Buffer) => {
files.set(String(p), data);
}) as typeof fs.writeFileSync,
}) as unknown as typeof fs.writeFileSync,
mkdirSync: (() => undefined) as typeof fs.mkdirSync,
chmodSync: (() => undefined) as typeof fs.chmodSync,
};
Expand Down
18 changes: 15 additions & 3 deletions tools/quality/lib/reports.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,11 @@ export function architectureRecords(report) {
return [...cycles.values()].sort((a, b) => a.key.localeCompare(b.key));
}

const svelteFragment =
/^(html|css|scss|sass|less|stylus|javascript|typescript|jsx|tsx)$/;

/** Resolve jscpd's embedded Svelte fragments to an existing source while retaining their language identity. */
function duplicateSource(path) {
function duplicateSource(path, format) {
const participant = repoPath(path);
const embedded =
/^(.*\.svelte):(html|css|scss|sass|less|stylus|javascript|typescript|jsx|tsx)$/.exec(
Expand All @@ -116,6 +119,15 @@ function duplicateSource(path) {
if (!embedded) {
if (/\.svelte:/.test(participant))
throw new Error(`Unknown Svelte clone fragment: ${participant}`);
if (participant.endsWith('.svelte') && svelteFragment.test(format ?? '')) {
if (!existsSync(participant))
throw new Error(`Missing Svelte clone source: ${participant}`);
return {
path: participant,
participant: `${participant}:${format}`,
embedded: true,
};
}
return { path: participant, participant, embedded: false };
}
const source = embedded[1];
Expand All @@ -135,8 +147,8 @@ export function duplicateRecords(report) {
}
const grouped = new Map();
for (const clone of report.duplicates) {
const first = duplicateSource(clone.firstFile?.name);
const second = duplicateSource(clone.secondFile?.name);
const first = duplicateSource(clone.firstFile?.name, clone.format);
const second = duplicateSource(clone.secondFile?.name, clone.format);
let fragment = clone.fragment;
if (typeof fragment !== 'string') {
if (first.embedded || second.embedded)
Expand Down
Loading
Loading