Skip to content

Commit 28d9038

Browse files
committed
refactor(plugin-typescript): use patterns in tsconfig file matcher
1 parent 14cf48c commit 28d9038

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

packages/plugin-typescript/src/lib/nx/tsconfig-paths.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,14 @@ import {
99
} from '@code-pushup/utils';
1010
import { formatMetaLog } from '../format.js';
1111

12+
const TSCONFIG_PATTERN = /^tsconfig(\..+)?\.json$/;
13+
const EXCLUDED_TSCONFIGS = new Set(['tsconfig.base.json', 'tsconfig.json']);
14+
1215
/**
13-
* Matches tsconfig.json and tsconfig.*.json, excludes tsconfig.base.json.
16+
* Matches tsconfig.*.json files, excludes tsconfig.json and tsconfig.base.json.
1417
*/
1518
function isTsconfigFile(filename: string): boolean {
16-
if (filename === 'tsconfig.base.json') {
17-
return false;
18-
}
19-
return (
20-
filename === 'tsconfig.json' ||
21-
(filename.startsWith('tsconfig.') && filename.endsWith('.json'))
22-
);
19+
return TSCONFIG_PATTERN.test(filename) && !EXCLUDED_TSCONFIGS.has(filename);
2320
}
2421

2522
/**

0 commit comments

Comments
 (0)