Skip to content

Commit 32daa06

Browse files
committed
fix(plugin-typescript): add display value
1 parent 2382dcb commit 32daa06

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

packages/plugin-typescript/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,16 @@ Each set is also available as group in the plugin. See more under [Audits and Gr
8484

8585
The plugin accepts the following parameters:
8686

87-
| Option | Type | Default | Description |
88-
| ------------ | -------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
89-
| tsconfig | string | `tsconfig.json` | A string that defines the path to your `tsconfig.json` file |
90-
| 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 |
87+
| Option | Type | Default | Description |
88+
| ---------- | -------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
89+
| tsconfig | string | `tsconfig.json` | A string that defines the path to your `tsconfig.json` file |
90+
| 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 |
9191

9292
#### `tsconfig`
9393

9494
Optional parameter. The `tsconfig` option accepts a string that defines the path to your config file and defaults to `tsconfig.json`.
9595

96-
```js
96+
````js
9797
await typescriptPlugin({
9898
tsconfig: './tsconfig.json',
9999
});
@@ -123,21 +123,21 @@ categories: [
123123
{
124124
type: 'audit',
125125
plugin: 'typescript',
126-
slug: 'no-implicit-any',
126+
slug: 'semantic-errors',
127127
weight: 2,
128128
},
129129
{
130130
type: 'audit',
131131
plugin: 'typescript',
132-
slug: 'no-explicit-any',
132+
slug: 'syntax-errors',
133133
weight: 1,
134134
},
135135
// ...
136136
],
137137
},
138138
// ...
139139
];
140-
```
140+
````
141141

142142
Also groups can be used:
143143

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type {
44
Issue,
55
RunnerFunction,
66
} from '@code-pushup/models';
7+
import { pluralize } from '@code-pushup/utils';
78
import type { AuditSlug } from '../types.js';
89
import {
910
type DiagnosticsOptions,
@@ -44,6 +45,7 @@ export function createRunnerFunction(options: RunnerOptions): RunnerFunction {
4445
slug,
4546
score: issues.length === 0 ? 1 : 0,
4647
value: issues.length,
48+
displayValue: `${issues.length} ${pluralize('issue', issues.length)}`,
4749
...(issues.length > 0 ? { details } : {}),
4850
} satisfies AuditOutput;
4951
});

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ describe('createRunnerFunction', () => {
110110
slug: 'semantic-errors',
111111
score: 0,
112112
value: 2,
113+
displayValue: '2 issues',
113114
details: {
114115
issues: [
115116
expect.objectContaining({

0 commit comments

Comments
 (0)