Skip to content

Commit 9d0f9a8

Browse files
committed
refactor: fix format
1 parent 4e344c6 commit 9d0f9a8

9 files changed

Lines changed: 431 additions & 422 deletions

File tree

eslint.config.js

Lines changed: 129 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -8,142 +8,142 @@ import typescript from '@code-pushup/eslint-config/typescript.js';
88
import vitest from '@code-pushup/eslint-config/vitest.js';
99

1010
export default tseslint.config(
11-
...typescript,
12-
...node,
13-
...vitest,
14-
{
15-
settings: {
16-
'import/resolver': { typescript: { project: 'tsconfig.base.json' } },
17-
},
18-
},
19-
{ plugins: { '@nx': nxEslintPlugin } },
20-
{
21-
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
22-
rules: {
23-
'@nx/enforce-module-boundaries': [
24-
'error',
25-
{
26-
enforceBuildableLibDependency: true,
27-
allow: [
28-
String.raw`^.*/eslint(\.base)?\.config\.[cm]?js$`,
29-
String.raw`^.*/code-pushup\.(config|preset)(\.m?[jt]s)?$`,
30-
'^[./]+/tools/.*$',
31-
String.raw`^[./]+/(testing/)?test-setup-config/src/index\.js$`,
32-
],
33-
depConstraints: [
34-
{
35-
sourceTag: 'scope:shared',
36-
onlyDependOnLibsWithTags: ['scope:shared'],
37-
},
38-
{
39-
sourceTag: 'scope:core',
40-
onlyDependOnLibsWithTags: ['scope:core', 'scope:shared'],
41-
},
42-
{
43-
sourceTag: 'scope:plugin',
44-
onlyDependOnLibsWithTags: ['scope:shared'],
45-
},
46-
{
47-
sourceTag: 'scope:tooling',
48-
onlyDependOnLibsWithTags: ['scope:tooling', 'scope:shared'],
49-
},
50-
{
51-
sourceTag: 'type:e2e',
52-
onlyDependOnLibsWithTags: [
53-
'type:app',
54-
'type:feature',
55-
'type:util',
56-
'type:testing',
57-
],
58-
},
59-
{
60-
sourceTag: 'type:app',
61-
onlyDependOnLibsWithTags: [
62-
'type:feature',
63-
'type:util',
64-
'type:testing',
65-
],
66-
},
67-
{
68-
sourceTag: 'type:feature',
69-
onlyDependOnLibsWithTags: [
70-
'type:feature',
71-
'type:util',
72-
'type:testing',
73-
],
74-
},
75-
{
76-
sourceTag: 'type:util',
77-
onlyDependOnLibsWithTags: ['type:util', 'type:testing'],
78-
},
79-
{
80-
sourceTag: 'type:testing',
81-
onlyDependOnLibsWithTags: ['type:util', 'type:testing'],
82-
},
83-
],
84-
},
85-
],
86-
},
11+
...typescript,
12+
...node,
13+
...vitest,
14+
{
15+
settings: {
16+
'import/resolver': { typescript: { project: 'tsconfig.base.json' } },
8717
},
88-
{
89-
files: ['**/*.test.ts', '**/*.spec.ts'],
90-
plugins: { 'jest-extended': jestExtendedPlugin },
91-
rules: {
92-
'vitest/consistent-test-filename': [
93-
'warn',
94-
{
95-
pattern: String.raw`.*\.(bench|type|unit|int|e2e)\.test\.[tj]sx?$`,
96-
},
97-
],
98-
'jest-extended/prefer-to-be-array': 'warn',
99-
'jest-extended/prefer-to-be-false': 'warn',
100-
'jest-extended/prefer-to-be-object': 'warn',
101-
'jest-extended/prefer-to-be-true': 'warn',
102-
'jest-extended/prefer-to-have-been-called-once': 'warn',
18+
},
19+
{ plugins: { '@nx': nxEslintPlugin } },
20+
{
21+
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
22+
rules: {
23+
'@nx/enforce-module-boundaries': [
24+
'error',
25+
{
26+
enforceBuildableLibDependency: true,
27+
allow: [
28+
String.raw`^.*/eslint(\.base)?\.config\.[cm]?js$`,
29+
String.raw`^.*/code-pushup\.(config|preset)(\.m?[jt]s)?$`,
30+
'^[./]+/tools/.*$',
31+
String.raw`^[./]+/(testing/)?test-setup-config/src/index\.js$`,
32+
],
33+
depConstraints: [
34+
{
35+
sourceTag: 'scope:shared',
36+
onlyDependOnLibsWithTags: ['scope:shared'],
37+
},
38+
{
39+
sourceTag: 'scope:core',
40+
onlyDependOnLibsWithTags: ['scope:core', 'scope:shared'],
41+
},
42+
{
43+
sourceTag: 'scope:plugin',
44+
onlyDependOnLibsWithTags: ['scope:shared'],
45+
},
46+
{
47+
sourceTag: 'scope:tooling',
48+
onlyDependOnLibsWithTags: ['scope:tooling', 'scope:shared'],
49+
},
50+
{
51+
sourceTag: 'type:e2e',
52+
onlyDependOnLibsWithTags: [
53+
'type:app',
54+
'type:feature',
55+
'type:util',
56+
'type:testing',
57+
],
58+
},
59+
{
60+
sourceTag: 'type:app',
61+
onlyDependOnLibsWithTags: [
62+
'type:feature',
63+
'type:util',
64+
'type:testing',
65+
],
66+
},
67+
{
68+
sourceTag: 'type:feature',
69+
onlyDependOnLibsWithTags: [
70+
'type:feature',
71+
'type:util',
72+
'type:testing',
73+
],
74+
},
75+
{
76+
sourceTag: 'type:util',
77+
onlyDependOnLibsWithTags: ['type:util', 'type:testing'],
78+
},
79+
{
80+
sourceTag: 'type:testing',
81+
onlyDependOnLibsWithTags: ['type:util', 'type:testing'],
82+
},
83+
],
10384
},
85+
],
10486
},
105-
{
106-
files: ['**/*.type.test.ts'],
107-
rules: {
108-
'vitest/expect-expect': 'off',
87+
},
88+
{
89+
files: ['**/*.test.ts', '**/*.spec.ts'],
90+
plugins: { 'jest-extended': jestExtendedPlugin },
91+
rules: {
92+
'vitest/consistent-test-filename': [
93+
'warn',
94+
{
95+
pattern: String.raw`.*\.(bench|type|unit|int|e2e)\.test\.[tj]sx?$`,
10996
},
97+
],
98+
'jest-extended/prefer-to-be-array': 'warn',
99+
'jest-extended/prefer-to-be-false': 'warn',
100+
'jest-extended/prefer-to-be-object': 'warn',
101+
'jest-extended/prefer-to-be-true': 'warn',
102+
'jest-extended/prefer-to-have-been-called-once': 'warn',
110103
},
111-
{
112-
files: ['**/*.json'],
113-
languageOptions: { parser: jsoncParser },
114-
},
115-
{
116-
files: ['**/*.ts', '**/*.js'],
117-
rules: {
118-
'n/file-extension-in-import': ['error', 'always'],
119-
'unicorn/number-literal-case': 'off',
120-
},
104+
},
105+
{
106+
files: ['**/*.type.test.ts'],
107+
rules: {
108+
'vitest/expect-expect': 'off',
121109
},
122-
{
123-
files: ['**/perf/**/*.ts'],
124-
rules: {
125-
'@typescript-eslint/no-magic-numbers': 'off',
126-
'sonarjs/no-duplicate-string': 'off',
127-
},
110+
},
111+
{
112+
files: ['**/*.json'],
113+
languageOptions: { parser: jsoncParser },
114+
},
115+
{
116+
files: ['**/*.ts', '**/*.js'],
117+
rules: {
118+
'n/file-extension-in-import': ['error', 'always'],
119+
'unicorn/number-literal-case': 'off',
128120
},
129-
{
130-
// tests need only be compatible with local Node version
131-
// publishable packages should pick up version range from "engines" in their package.json
132-
files: ['e2e/**/*.ts', 'testing/**/*.ts', '**/*.test.ts'],
133-
settings: {
134-
node: {
135-
version: fs.readFileSync('.node-version', 'utf8'),
136-
},
137-
},
121+
},
122+
{
123+
files: ['**/perf/**/*.ts'],
124+
rules: {
125+
'@typescript-eslint/no-magic-numbers': 'off',
126+
'sonarjs/no-duplicate-string': 'off',
138127
},
139-
{
140-
ignores: [
141-
'**/*.mock.*',
142-
'**/code-pushup.config.ts',
143-
'**/mocks/fixtures/**',
144-
'**/__snapshots__/**',
145-
'**/dist',
146-
'**/*.md',
147-
],
128+
},
129+
{
130+
// tests need only be compatible with local Node version
131+
// publishable packages should pick up version range from "engines" in their package.json
132+
files: ['e2e/**/*.ts', 'testing/**/*.ts', '**/*.test.ts'],
133+
settings: {
134+
node: {
135+
version: fs.readFileSync('.node-version', 'utf8'),
136+
},
148137
},
138+
},
139+
{
140+
ignores: [
141+
'**/*.mock.*',
142+
'**/code-pushup.config.ts',
143+
'**/mocks/fixtures/**',
144+
'**/__snapshots__/**',
145+
'**/dist',
146+
'**/*.md',
147+
],
148+
},
149149
);

packages/plugin-knip/src/lib/reporter/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const ISSUE_TYPE_MESSAGE: Record<
2929
(arg: string) => string
3030
> = {
3131
files: (file: string) => `Unused file ${file}`,
32-
32+
3333
_files: (file: string) => `Unused file ${file}`,
3434
dependencies: (dep: string) => `Unused dependency ${dep}`,
3535
devDependencies: (dep: string) => `Unused devDependency ${dep}`,

packages/plugin-knip/src/lib/reporter/reporter.int.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ describe('knipReporter', () => {
1212
});
1313

1414
it('should execute correctly', async () => {
15-
const sandboxRoot = path.join('packages', 'plugin-knip', 'mocks', 'sandbox');
15+
const sandboxRoot = path.join(
16+
'packages',
17+
'plugin-knip',
18+
'mocks',
19+
'sandbox',
20+
);
1621
const reporterPath = path.join(
1722
'..',
1823
'..',

packages/plugin-knip/src/lib/reporter/reporter.unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ describe('knipReporter', () => {
151151
).resolves.toBeUndefined();
152152

153153
const auditOutputsContent = await memfsFs.promises.readFile(
154-
path.join(MEMFS_VOLUME, KNIP_REPORT_NAME),
154+
path.join(MEMFS_VOLUME, KNIP_REPORT_NAME),
155155
{ encoding: 'utf8' },
156156
);
157157
const auditOutputsJson = JSON.parse(

packages/plugin-knip/src/lib/reporter/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export function knipToCpReport({
118118
}: Pick<ReporterOptions, 'report' | 'issues'>): Promise<AuditOutputs> {
119119
return Promise.all(
120120
Object.entries(report)
121-
121+
122122
.filter(([_, isReportType]) => isReportType)
123123
.map(async ([issueType]): Promise<AuditOutput> => {
124124
const issues = await toIssues(issueType as IssueType, rawIssues);

packages/plugin-knip/src/lib/runner/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ import type { CustomReporterOptions } from '../reporter/index.js';
1515
export type KnipCliOptions = Partial<{
1616
// https://knip.dev/reference/cli#general
1717
debug: boolean;
18-
18+
1919
'config-hints': boolean;
2020
performance: boolean;
21-
21+
2222
'isolate-workspaces': boolean;
2323
exitCode: boolean;
2424
// https://knip.dev/reference/cli#configuration
@@ -27,9 +27,9 @@ export type KnipCliOptions = Partial<{
2727
workspace: string; // dir path
2828
directory: string; // dir path
2929
gitignore: boolean;
30-
30+
3131
'include-entry-exports': string;
32-
32+
3333
'include-libs': string;
3434
// https://knip.dev/reference/cli#modes
3535
production: boolean;
@@ -39,7 +39,7 @@ export type KnipCliOptions = Partial<{
3939
include: KnipAudits[];
4040
dependencies: string[];
4141
exports: string[];
42-
42+
4343
'experimental-tags': string[];
4444
tags: string[];
4545
}>;

packages/plugin-knip/src/lib/runner/index.unit.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { createRunnerConfig } from './index.js';
44

55
describe('runnerConfig', () => {
66
it('should return correct runner config object', () => {
7-
expect(() => runnerConfigSchema.parse(createRunnerConfig())).not.toThrowError();
7+
expect(() =>
8+
runnerConfigSchema.parse(createRunnerConfig()),
9+
).not.toThrowError();
810
});
911
});

0 commit comments

Comments
 (0)