Skip to content

Commit b947f5e

Browse files
committed
cleanup
1 parent 5c80d53 commit b947f5e

File tree

7 files changed

+3
-71
lines changed

7 files changed

+3
-71
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
"scripts": {
1616
"prepare": "husky install",
1717
"commit": "git-cz",
18-
"knip": "knip",
19-
"postinstall": "npx nx run plugin-typescript:postinstall"
18+
"knip": "knip"
2019
},
2120
"private": true,
2221
"engines": {

packages/plugin-typescript/project.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@
3535
"options": {
3636
"configFile": "packages/plugin-typescript/vite.config.integration.ts"
3737
}
38-
},
39-
"postinstall": {
40-
"dependsOn": ["build"],
41-
"command": "npx tsx --tsconfig packages/plugin-typescript/tsconfig.lib.json packages/plugin-typescript/src/postinstall/create.bin.ts",
42-
"cwd": ""
4338
}
4439
},
4540
"tags": ["scope:plugin", "type:feature", "publishable"]

packages/plugin-typescript/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ export {
1111
type TypescriptPluginOptions,
1212
} from './lib/typescript-plugin.js';
1313
export default typescriptPlugin;
14-
export { getTsDefaultsFilename } from './lib/runner/constants.js';

packages/plugin-typescript/src/lib/runner/constants.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

packages/plugin-typescript/src/lib/runner/ts-runner.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
createProgram,
44
getPreEmitDiagnostics,
55
} from 'typescript';
6-
import { loadTargetConfig, validateDiagnostics } from './utils.js';
6+
import { loadTargetConfig } from './utils.js';
77

88
export type DiagnosticsOptions = {
99
tsConfigPath: string;
@@ -17,10 +17,7 @@ export async function getTypeScriptDiagnostics({
1717

1818
const program = createProgram(fileNames, options);
1919
// @TODO use more fine-grained helpers like getSemanticDiagnostics instead of getPreEmitDiagnostics
20-
const diagnostics = getPreEmitDiagnostics(program);
21-
validateDiagnostics(diagnostics);
22-
23-
return diagnostics;
20+
return getPreEmitDiagnostics(program);
2421
} catch (error) {
2522
throw new Error(
2623
`Can't create TS program in getDiagnostics. \n ${(error as Error).message}`,

packages/plugin-typescript/src/lib/runner/utils.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
} from 'typescript';
1111
import type { Issue } from '@code-pushup/models';
1212
import { readTextFile, truncateIssueMessage } from '@code-pushup/utils';
13-
import { AUDIT_LOOKUP } from './constants.js';
1413
import { TS_CODE_RANGE_NAMES } from './ts-error-codes.js';
1514
import type { CodeRangeName } from './types.js';
1615

@@ -106,13 +105,3 @@ export async function loadTargetConfig(tsConfigPath: string) {
106105

107106
return parsedConfig;
108107
}
109-
110-
export function validateDiagnostics(diagnostics: readonly Diagnostic[]) {
111-
diagnostics
112-
.filter(({ code }) => !AUDIT_LOOKUP.has(code))
113-
.forEach(({ code, messageText }) => {
114-
console.warn(
115-
`Diagnostic Warning: The code ${code} is not supported. ${messageText}`,
116-
);
117-
});
118-
}

packages/plugin-typescript/src/lib/runner/utils.unit.test.ts

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,8 @@ import {
44
getIssueFromDiagnostic,
55
getSeverity,
66
tSCodeToAuditSlug,
7-
validateDiagnostics,
87
} from './utils.js';
98

10-
describe('validateDiagnostics', () => {
11-
const consoleWarnSpy = vi.spyOn(console, 'warn');
12-
13-
it('should not log for known error codes', () => {
14-
expect(() =>
15-
validateDiagnostics([
16-
{
17-
code: 7005,
18-
messageText: 'strich checks error',
19-
} as Diagnostic,
20-
]),
21-
).not.toThrow();
22-
expect(consoleWarnSpy).toHaveBeenCalledTimes(0);
23-
});
24-
25-
it.todo('should log for known error codes', () => {
26-
expect(() =>
27-
validateDiagnostics([
28-
{
29-
code: 1337,
30-
messageText: 'unknown error code',
31-
} as Diagnostic,
32-
]),
33-
).not.toThrow();
34-
expect(consoleWarnSpy).toHaveBeenCalledTimes(1);
35-
});
36-
});
37-
389
describe('tSCodeToAuditSlug', () => {
3910
it('should transform supported code to readable audit', () => {
4011
expect(tSCodeToAuditSlug(Number.parseInt('2345', 10))).toBe(

0 commit comments

Comments
 (0)