You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
4. Run the CLI with `npx code-pushup collect` and view or upload the report (refer to [CLI docs](../cli/README.md)).
59
59
60
-
## About documentation coverage
60
+
## About TypeScript checks
61
61
62
-
The TypeScript plugin analyzes your codebase using the TypeScript compiler to identify potential issues and enforce best practices. It helps ensure type safety and maintainability of your TypeScript code.
62
+
The TypeScript plugin analyzes your codebase using the TypeScript compiler to identify potential issues and enforce best practices.
63
+
It helps ensure type safety and maintainability of your TypeScript code.
63
64
64
-
The plugin provides multiple audits grouped into different categories like:
65
+
The plugin provides multiple audits grouped into different sets:
65
66
66
-
- Language and Environment - Checks configuration for TypeScript features like decorators, JSX, target version
67
-
- Type Checking - Validates strict null checks, implicit any/this, function types
68
-
- Module Resolution - Verifies module imports/exports and resolution settings
69
-
- Build/Emit Options - Checks output generation and optimization settings
- Language and Environment - Configuration options for TypeScript language features and runtime environment, including decorators, JSX support, target ECMAScript version, and class field behaviors
68
+
- Interop Constraints - Settings that control how TypeScript interoperates with other JavaScript code, including module imports/exports and case sensitivity rules
69
+
- Watch Options - Configuration for TypeScript watch mode behavior, including file watching strategies and dependency tracking
70
+
- Project References - Options for managing TypeScript project references, composite projects, and build optimization settings
71
+
- Module Resolution - Settings that control how TypeScript finds and resolves module imports, including Node.js resolution, package.json exports/imports, and module syntax handling
72
+
- Type Checking Behavior - Configuration for TypeScript type checking strictness and error reporting, including property access rules and method override checking
73
+
- Control Flow Options - Settings that affect code flow analysis, including handling of unreachable code, unused labels, switch statements, and async/generator functions
74
+
- Strict Checks - Strict type checking options that enable additional compile-time verifications, including null checks, implicit any/this, and function type checking
75
+
- Build/Emit Options - Configuration options that control TypeScript output generation, including whether to emit files, how to handle comments and declarations, and settings for output optimization and compatibility helpers
71
76
72
77
Each audit:
73
78
74
79
- Checks for specific TypeScript compiler errors and warnings
75
80
- Provides a score based on the number of issues found
76
81
- Includes detailed error messages and locations
77
82
78
-
The audits are organized into logical groups to give you a comprehensive view of your TypeScript configuration and code quality. You can:
79
-
80
-
- Use all groups for complete TypeScript analysis
81
-
- Focus on specific groups or individual audits based on your needs
83
+
Each set is also available as group in the plugin. See more under [Audits and Groups]()
| tsConfigPath | string |`tsconfig.json`| A string that defines the path to your `tsconfig.json` file |
94
+
| onlyAudits | string[]| undefined | An array of audit slugs to specify which documentation types you want to measure. Only the specified audits will be included in the results |
95
+
89
96
#### TsConfigPath
90
97
91
98
Required parameter. The `tsConfigPath` option accepts a string that defines the path to your `tsconfig.json` file.
@@ -103,10 +110,8 @@ Optional parameter. The `onlyAudits` option allows you to specify which document
103
110
```js
104
111
typescriptPlugin({
105
112
tsConfigPath:'./tsconfig.json',
106
-
onlyAudits: [
107
-
'no-implicit-any'
108
-
] // Only measure documentation for classes and functions
109
-
}),
113
+
onlyAudits: ['no-implicit-any'], // Only measure documentation for classes and functions
114
+
});
110
115
```
111
116
112
117
### Audits and group
@@ -115,55 +120,55 @@ This plugin provides a list of groups to cover different TypeScript configuratio
115
120
116
121
```ts
117
122
// ...
118
-
categories: [
119
-
{
120
-
slug: 'typescript',
121
-
title: 'TypeScript',
122
-
refs: [
123
-
{
124
-
slug: 'language-and-environment',
125
-
weight: 1,
126
-
type: 'group',
127
-
plugin: 'typescript'
128
-
},
129
-
// ...
130
-
],
131
-
},
132
-
// ...
133
-
],
123
+
categories: [
124
+
{
125
+
slug: 'typescript',
126
+
title: 'TypeScript',
127
+
refs: [
128
+
{
129
+
slug: 'language-and-environment',
130
+
weight: 1,
131
+
type: 'group',
132
+
plugin: 'typescript'
133
+
},
134
+
// ...
135
+
],
136
+
},
137
+
// ...
138
+
],
134
139
```
135
140
136
141
Each TypeScript configuration option still has its own audit. So when you want to include a subset of configuration options or assign different weights to them, you can do so in the following way:
137
142
138
143
```ts
139
144
// ...
140
-
categories: [
141
-
{
142
-
slug: 'typescript',
143
-
title: 'TypeScript',
144
-
refs: [
145
-
{
146
-
type: 'audit',
147
-
plugin: 'typescript',
148
-
slug: 'no-implicit-any',
149
-
weight: 2,
150
-
},
151
-
{
152
-
type: 'audit',
153
-
plugin: 'typescript',
154
-
slug: 'no-explicit-any',
155
-
weight: 1,
156
-
},
157
-
// ...
158
-
],
159
-
},
160
-
// ...
161
-
],
145
+
categories: [
146
+
{
147
+
slug: 'typescript',
148
+
title: 'TypeScript',
149
+
refs: [
150
+
{
151
+
type: 'audit',
152
+
plugin: 'typescript',
153
+
slug: 'no-implicit-any',
154
+
weight: 2,
155
+
},
156
+
{
157
+
type: 'audit',
158
+
plugin: 'typescript',
159
+
slug: 'no-explicit-any',
160
+
weight: 1,
161
+
},
162
+
// ...
163
+
],
164
+
},
165
+
// ...
166
+
],
162
167
```
163
168
164
169
### Audit output
165
170
166
-
The plugin outputs a single audit that measures the overall documentation coverage percentage of your codebase.
171
+
The plugin outputs multiple audits that track all issues of your codebase.
167
172
168
173
For instance, this is an example of the plugin output:
0 commit comments