Skip to content

Commit ebd6e8b

Browse files
committed
cleanup
1 parent b947f5e commit ebd6e8b

32 files changed

+287
-152
lines changed

code-pushup.preset.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,13 @@ export const eslintCoreConfigNx = async (
137137
export const typescriptPluginConfigNx = async (
138138
options?: TypescriptPluginOptions,
139139
): Promise<CoreConfig> => {
140-
const opt: TypescriptPluginOptions = {
141-
...options,
142-
};
143140
return {
144-
plugins: [await typescriptPlugin(opt)],
141+
plugins: [await typescriptPlugin(options)],
145142
categories: [
146143
{
147144
slug: 'typescript',
148-
title: 'Typescript',
149-
refs: await getCategoryRefsFromGroups(opt),
145+
title: 'Typescript - All Groups',
146+
refs: await getCategoryRefsFromGroups(options),
150147
},
151148
{
152149
slug: 'bug-prevention',
@@ -167,6 +164,15 @@ export const typescriptPluginConfigNx = async (
167164
'TypeScript & Lint rules that promote **good practices** and consistency in your code.',
168165
refs: await getCategoryRefsFromGroups({ onlyAudits: ['suggestions'] }),
169166
},
167+
{
168+
slug: 'miscellaneous',
169+
title: 'Miscellaneous',
170+
description:
171+
'Errors that do not bring any specific value to the developer, but are still useful to know.',
172+
refs: await getCategoryRefsFromGroups({
173+
onlyAudits: ['unknown-codes', 'language-service-errors'],
174+
}),
175+
},
170176
],
171177
};
172178
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function test() {
2+
return 'test';
3+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
const a = { ; // Error: TS1136: Property assignment expected

e2e/plugin-typescript-e2e/mocks/fixtures/default-setup/src/semantic-errors.ts renamed to e2e/plugin-typescript-e2e/mocks/fixtures/default-setup/src/2-semantic-errors.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,3 @@ function noImplicitThisTS2683() {
55

66
// 2531 - StrictNullChecks: Object is possibly 'null'.
77
const strictNullChecksTS2531: string = null;
8-
9-
// 2307 - Cannot find module.
10-
import { nonExistentModule } from './non-existent';
11-
12-
// 2349 - Cannot call a value that is not callable.
13-
const notCallable = 42;
14-
notCallable();
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class Standalone {
2+
override method() { // Error: TS4114 - 'override' modifier can only be used in a class derived from a base class.
3+
console.log("Standalone method");
4+
}
5+
}
6+
const s = Standalone;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import { test } from '../exclude/utils'; // TS6059:: File 'exclude/utils.ts' is not under 'rootDir' '.../configuration-errors'. 'rootDir' is expected to contain all source files.

e2e/plugin-typescript-e2e/mocks/fixtures/default-setup/src/syntax-errors.ts

Whitespace-only changes.

e2e/plugin-typescript-e2e/tests/__snapshots__/typescript-plugin-json-report.json

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
},
1111
{
1212
"plugin": "typescript",
13-
"slug": "suggestions-group",
13+
"slug": "ts-configuration-group",
1414
"type": "group",
1515
"weight": 1,
1616
},
1717
{
1818
"plugin": "typescript",
19-
"slug": "ts-configuration-group",
19+
"slug": "miscellaneous-group",
2020
"type": "group",
2121
"weight": 1,
2222
},
@@ -39,11 +39,6 @@
3939
"slug": "semantic-errors",
4040
"title": "Semantic-Errors",
4141
},
42-
{
43-
"description": "Suggestions for improving code quality and maintainability",
44-
"slug": "suggestions",
45-
"title": "Suggestions",
46-
},
4742
{
4843
"description": "Errors that occur during TypeScript language service operations",
4944
"slug": "language-service-errors",
@@ -88,26 +83,30 @@
8883
"title": "Problems",
8984
},
9085
{
91-
"description": "Suggestions often include improvements to code readability and adherence to style guidelines.",
86+
"description": "TypeScript configuration and options errors ensure correct project setup, reducing risks from misconfiguration.",
9287
"refs": [
9388
{
94-
"slug": "suggestions",
89+
"slug": "configuration-errors",
9590
"weight": 1,
9691
},
9792
],
98-
"slug": "suggestions-group",
99-
"title": "Suggestions",
93+
"slug": "ts-configuration-group",
94+
"title": "Configuration",
10095
},
10196
{
102-
"description": "TypeScript configuration and options errors ensure correct project setup, reducing risks from misconfiguration.",
97+
"description": "Errors that do not bring any specific value to the developer, but are still useful to know.",
10398
"refs": [
10499
{
105-
"slug": "configuration-errors",
100+
"slug": "unknown-codes",
101+
"weight": 1,
102+
},
103+
{
104+
"slug": "language-service-errors",
106105
"weight": 1,
107106
},
108107
],
109-
"slug": "ts-configuration-group",
110-
"title": "Configuration",
108+
"slug": "miscellaneous-group",
109+
"title": "Miscellaneous",
111110
},
112111
],
113112
"icon": "typescript",

e2e/plugin-typescript-e2e/tests/__snapshots__/typescript-plugin-md-report.md

Lines changed: 56 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,73 +2,97 @@
22

33
| 🏷 Category | ⭐ Score | 🛡 Audits |
44
| :------------------------ | :-------: | :-------: |
5-
| [Typescript](#typescript) | 🟡 **89** | 5 |
5+
| [Typescript](#typescript) | 🔴 **28** | 6 |
66

77
## 🏷 Categories
88

99
### Typescript
1010

11-
🟡 Score: **89**
11+
🔴 Score: **28**
1212

13-
- 🟡 Problems (_Typescript_)
14-
- 🟥 [Semantic-Errors](#semantic-errors-typescript) - **4**
13+
- 🔴 Configuration (_Typescript_)
14+
- 🟥 [Configuration-Errors](#configuration-errors-typescript) - **1**
15+
- 🔴 Problems (_Typescript_)
16+
- 🟥 [Semantic-Errors](#semantic-errors-typescript) - **6**
17+
- 🟥 [Syntax-Errors](#syntax-errors-typescript) - **1**
1518
- 🟩 [Internal-Errors](#internal-errors-typescript) - **0**
16-
- 🟩 [Syntax-Errors](#syntax-errors-typescript) - **0**
17-
- 🟢 Configuration (_Typescript_)
18-
- 🟩 [Configuration-Errors](#configuration-errors-typescript) - **0**
19-
- 🟢 Suggestions (_Typescript_)
20-
- 🟩 [Suggestions](#suggestions-typescript) - **0**
19+
- 🟡 Miscellaneous (_Typescript_)
20+
- 🟥 [Language-Service-Errors](#language-service-errors-typescript) - **1**
21+
- 🟩 [Unknown-Codes](#unknown-codes-typescript) - **0**
2122

2223
## 🛡️ Audits
2324

2425
### Semantic-Errors (Typescript)
2526

2627
<details>
27-
<summary>🟥 <b>4</b> (score: 0)</summary>
28+
<summary>🟥 <b>6</b> (score: 0)</summary>
2829

2930
#### Issues
3031

31-
| Severity | Message | Source file | Line(s) |
32-
| :--------: | :------------------------------------------------------------------------------------ | :---------------------------------------------------------------------------------------------------------------------- | :-----: |
33-
| 🚨 _error_ | TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. | [`tmp/e2e/plugin-typescript-e2e/src/semantic-errors.ts`](../../../tmp/e2e/plugin-typescript-e2e/src/semantic-errors.ts) | 3 |
34-
| 🚨 _error_ | TS2322: Type 'null' is not assignable to type 'string'. | [`tmp/e2e/plugin-typescript-e2e/src/semantic-errors.ts`](../../../tmp/e2e/plugin-typescript-e2e/src/semantic-errors.ts) | 7 |
35-
| 🚨 _error_ | TS2307: Cannot find module './non-existent' or its corresponding type declarations. | [`tmp/e2e/plugin-typescript-e2e/src/semantic-errors.ts`](../../../tmp/e2e/plugin-typescript-e2e/src/semantic-errors.ts) | 10 |
36-
| 🚨 _error_ | TS2349: This expression is not callable.<br /> Type 'Number' has no call signatures. | [`tmp/e2e/plugin-typescript-e2e/src/semantic-errors.ts`](../../../tmp/e2e/plugin-typescript-e2e/src/semantic-errors.ts) | 14 |
32+
| Severity | Message | Source file | Line(s) |
33+
| :--------: | :------------------------------------------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------------- | :-----: |
34+
| 🚨 _error_ | TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. | [`tmp/e2e/plugin-typescript-e2e/src/2-semantic-errors.ts`](../../../tmp/e2e/plugin-typescript-e2e/src/2-semantic-errors.ts) | 3 |
35+
| 🚨 _error_ | TS2322: Type 'null' is not assignable to type 'string'. | [`tmp/e2e/plugin-typescript-e2e/src/2-semantic-errors.ts`](../../../tmp/e2e/plugin-typescript-e2e/src/2-semantic-errors.ts) | 7 |
36+
| 🚨 _error_ | TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. | [`tmp/e2e/plugin-typescript-e2e/src/semantic-errors.ts`](../../../tmp/e2e/plugin-typescript-e2e/src/semantic-errors.ts) | 3 |
37+
| 🚨 _error_ | TS2322: Type 'null' is not assignable to type 'string'. | [`tmp/e2e/plugin-typescript-e2e/src/semantic-errors.ts`](../../../tmp/e2e/plugin-typescript-e2e/src/semantic-errors.ts) | 7 |
38+
| 🚨 _error_ | TS2307: Cannot find module './non-existent' or its corresponding type declarations. | [`tmp/e2e/plugin-typescript-e2e/src/semantic-errors.ts`](../../../tmp/e2e/plugin-typescript-e2e/src/semantic-errors.ts) | 10 |
39+
| 🚨 _error_ | TS2349: This expression is not callable.<br /> Type 'Number' has no call signatures. | [`tmp/e2e/plugin-typescript-e2e/src/semantic-errors.ts`](../../../tmp/e2e/plugin-typescript-e2e/src/semantic-errors.ts) | 14 |
3740

3841
</details>
3942

4043
Errors that occur during type checking and type inference
4144

4245
### Configuration-Errors (Typescript)
4346

44-
🟩 **0** (score: 100)
47+
<details>
48+
<summary>🟥 <b>1</b> (score: 0)</summary>
4549

46-
Errors that occur when parsing TypeScript configuration files
50+
#### Issues
4751

48-
### Internal-Errors (Typescript)
52+
| Severity | Message | Source file | Line(s) |
53+
| :--------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------ | :-----: |
54+
| 🚨 _error_ | TS6059: File '/Users/michael_hladky/WebstormProjects/quality-metrics-cli/tmp/e2e/plugin-typescript-e2e/exclude/utils.ts' is not under 'rootDir' 'src'. 'rootDir' is expected to contain all source files. | [`tmp/e2e/plugin-typescript-e2e/src/6-configuration-errors.ts`](../../../tmp/e2e/plugin-typescript-e2e/src/6-configuration-errors.ts) | 1 |
4955

50-
🟩 **0** (score: 100)
56+
</details>
5157

52-
Errors that occur during TypeScript internal operations
58+
Errors that occur when parsing TypeScript configuration files
5359

5460
### Language-Service-Errors (Typescript)
5561

56-
🟩 **0** (score: 100)
62+
<details>
63+
<summary>🟥 <b>1</b> (score: 0)</summary>
5764

58-
Errors that occur during TypeScript language service operations
65+
#### Issues
5966

60-
### Suggestions (Typescript)
67+
| Severity | Message | Source file | Line(s) |
68+
| :--------: | :------------------------------------------------------------------------------------------------------------------------------ | :---------------------------------------------------------------------------------------------------------------------------- | :-----: |
69+
| 🚨 _error_ | TS4112: This member cannot have an 'override' modifier because its containing class 'Standalone' does not extend another class. | [`tmp/e2e/plugin-typescript-e2e/src/4-languale-service.ts`](../../../tmp/e2e/plugin-typescript-e2e/src/4-languale-service.ts) | 2 |
6170

62-
🟩 **0** (score: 100)
71+
</details>
6372

64-
Suggestions for improving code quality and maintainability
73+
Errors that occur during TypeScript language service operations
6574

6675
### Syntax-Errors (Typescript)
6776

68-
🟩 **0** (score: 100)
77+
<details>
78+
<summary>🟥 <b>1</b> (score: 0)</summary>
79+
80+
#### Issues
81+
82+
| Severity | Message | Source file | Line(s) |
83+
| :--------: | :------------------------------------ | :---------------------------------------------------------------------------------------------------------------------- | :-----: |
84+
| 🚨 _error_ | TS1136: Property assignment expected. | [`tmp/e2e/plugin-typescript-e2e/src/1-syntax-errors.ts`](../../../tmp/e2e/plugin-typescript-e2e/src/1-syntax-errors.ts) | 1 |
85+
86+
</details>
6987

7088
Errors that occur during parsing and lexing of TypeScript source code
7189

90+
### Internal-Errors (Typescript)
91+
92+
🟩 **0** (score: 100)
93+
94+
Errors that occur during TypeScript internal operations
95+
7296
### Unknown-Codes (Typescript)
7397

7498
🟩 **0** (score: 100)
@@ -77,15 +101,15 @@ Errors that do not match any known TypeScript error code
77101

78102
## About
79103

80-
Report was created by [Code PushUp](https://github.com/code-pushup/cli#readme) on Thu, Jan 2, 2025, 1:28 AM GMT+1.
104+
Report was created by [Code PushUp](https://github.com/code-pushup/cli#readme) on Thu, Jan 2, 2025, 6:09 AM GMT+1.
81105

82106
| Plugin | Audits | Version | Duration |
83107
| :--------- | :----: | :------: | -------: |
84-
| Typescript | 7 | `0.57.0` | 2.27 s |
108+
| Typescript | 6 | `0.57.0` | 2.00 s |
85109

86-
| Commit | Version | Duration | Plugins | Categories | Audits |
87-
| :----------------------------------------------------------------- | :------: | -------: | :-----: | :--------: | :----: |
88-
| refactor to code ranges (eca441689b80304ad4ae5c53f2b2f34f54bd579a) | `0.57.0` | 2.32 s | 1 | 1 | 7 |
110+
| Commit | Version | Duration | Plugins | Categories | Audits |
111+
| :------------------------------------------------- | :------: | -------: | :-----: | :--------: | :----: |
112+
| cleanup (b947f5e7992f047fdbfc73a4973fae30e88db30c) | `0.57.0` | 2.05 s | 1 | 1 | 6 |
89113

90114
---
91115

e2e/plugin-typescript-e2e/tests/__snapshots__/typescript-plugin-terminal-report.txt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,19 @@ Code PushUp Report - @code-pushup/[email protected]
55

66
Typescript audits
77

8-
● Semantic-Errors 4
9-
● Configuration-Errors 0
8+
● Semantic-Errors 6
9+
● Configuration-Errors 1
10+
● Language-Service-Errors 1
11+
● Syntax-Errors 1
1012
● Internal-Errors 0
11-
● Language-Service-Errors 0
12-
● Suggestions 0
13-
● Syntax-Errors 0
1413
● Unknown-Codes 0
1514

1615
Categories
1716

1817
┌─────────────────────────────────────────────────────────┬─────────┬──────────┐
1918
│ Category │ Score │ Audits │
2019
├─────────────────────────────────────────────────────────┼─────────┼──────────┤
21-
│ Typescript │ 895
20+
│ Typescript │ 286
2221
└─────────────────────────────────────────────────────────┴─────────┴──────────┘
2322

2423
Made with ❤ by code-pushup.dev

0 commit comments

Comments
 (0)