-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathknip.config.js
More file actions
151 lines (150 loc) · 4.45 KB
/
knip.config.js
File metadata and controls
151 lines (150 loc) · 4.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
// @ts-check
/** @type {import('knip').KnipConfig} */
export default {
workspaces: {
'.': {
entry: ['.workspace-meta/config.ts', 'scripts/*.{js,ts}'],
},
'packages/*': {
entry: ['src/index.{ts,tsx}', 'src/web/index.{ts,tsx}'],
project: 'src/**/*.{ts,tsx}',
ignore: ['src/__mocks__/**'],
paths: {
'#src/*': ['./src/*'],
},
},
'plugins/*': {
entry: [
'src/index.{ts,tsx}',
'src/web-export.{ts,tsx}',
'src/*/*/node.ts',
'src/*/*/web.ts',
'src/*/*/common.ts',
],
project: 'src/**/*.{ts,tsx}',
ignoreDependencies: [
// necessary for build
'react-dom',
'@types/react-dom',
],
paths: {
'#src/*': ['./src/*'],
},
},
'packages/fastify-generators': {
entry: ['src/index.{ts,tsx}'],
project: 'src/**/*.{ts,tsx}',
},
'packages/project-builder-web': {
entry: ['src/index.{ts,tsx}'],
project: ['src/**/*.{ts,tsx}', 'plugins/*.ts'],
ignore: [
// we ignore this file because it may not always be used when there are no feature flags
'src/hooks/use-feature-flag.ts',
// weird bugs with knip :(
'src/services/schema-parser-context.ts',
'src/types/virtual-module-federation.d.ts',
'src/services/module-federation.ts',
],
paths: {
'#src/*': ['./src/*'],
},
},
'packages/project-builder-cli': {
entry: ['src/index.{ts,tsx}', 'tests/**/*.spec.{ts,tsx}'],
project: ['src/**/*.{ts,tsx}', 'tests/**/*.{ts,tsx}'],
ignoreDependencies: [
// pino-pretty is referenced by string (https://github.com/pinojs/pino/blob/ad864b7ae02b314b9a548614f705a437e0db78c3/docs/transports.md)
'pino-pretty',
// we resolve the package by string in src/server.ts
'@baseplate-dev/project-builder-web',
],
paths: {
'#src/*': ['./src/*'],
},
},
'packages/project-builder-test': {
entry: ['src/index.{ts,tsx}'],
project: 'src/**/*.{ts,tsx}',
ignore: ['src/tests/*.ts'],
ignoreDependencies: [
// pino-pretty is referenced by string (https://github.com/pinojs/pino/blob/ad864b7ae02b314b9a548614f705a437e0db78c3/docs/transports.md)
'pino-pretty',
// we resolve the package by string in src/commands/serve.ts
'@baseplate-dev/project-builder-web',
],
paths: {
'#src/*': ['./src/*'],
},
},
'packages/project-builder-common': {
entry: ['src/index.{ts,tsx}'],
project: 'src/**/*.{ts,tsx}',
ignoreDependencies: [
// we load the plugins dynamically from the package.json
'@baseplate-dev/plugin-*',
],
},
'packages/ui-components': {
entry: ['src/index.{ts,tsx}'],
project: 'src/**/*.{ts,tsx}',
ignoreDependencies: [
// mdx files - https://github.com/webpro-nl/knip/issues/494
'@storybook/blocks',
],
paths: {
'#src/*': ['./src/*'],
},
},
'packages/sync': {
entry: ['src/index.{ts,tsx}'],
project: 'src/**/*.{ts,tsx}',
paths: {
'#src/*': ['./src/*'],
},
},
'packages/code-morph': {
entry: ['src/index.{ts,tsx}', 'src/morphers/**/*.morpher.{ts,tsx}'],
project: ['src/**/*.{ts,tsx}', 'tests/**/*.{ts,tsx}'],
paths: {
'#src/*': ['./src/*'],
},
},
'packages/utils': {
entry: ['src/index.{ts,tsx}', 'src/node.{ts,tsx}'],
project: 'src/**/*.{ts,tsx}',
paths: {
'#src/*': ['./src/*'],
},
},
'packages/tools': {
project: 'src/**/*.{ts,tsx}',
ignoreDependencies: [
// automatically imported by eslint-plugin-import-x
'eslint-import-resolver-typescript',
],
},
},
ignore: [
'tests/**',
'**/templates/**',
'**/morphers/tests/**',
'**/string-merge-algorithms/tests/**',
'**/generated/**',
],
ignoreBinaries: ['only-allow'],
ignoreDependencies: [
// we're not using vitest coverage
'@vitest/coverage-v8',
// we can't import the plugin directly into the config because VSCode won't work otherwise
// https://github.com/prettier/prettier/discussions/15167
'prettier-plugin-packagejson',
'prettier-plugin-tailwindcss',
// Tailwind v4 is not recognized as a dependency by Knip
'tailwindcss',
],
// Enable parsing of CSS
compilers: {
css: (text) => [...text.matchAll(/(?<=@)import[^;]+/g)].join('\n'),
},
};