-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Expand file tree
/
Copy pathknip.config.ts
More file actions
92 lines (86 loc) · 3 KB
/
knip.config.ts
File metadata and controls
92 lines (86 loc) · 3 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
import type {KnipConfig} from 'knip';
const isProductionMode = process.argv.includes('--production');
const productionEntryPoints = [
// the main entry points - app, gsAdmin & gsApp
'static/app/index.tsx',
// defined in rspack.config.ts pipelines
'static/app/utils/statics-setup.tsx',
// very dynamically imported
'static/app/gettingStartedDocs/**/*.{js,ts,tsx}',
// this is imported with require.context
'static/app/data/forms/*.tsx',
// frontend experiemnt framework may be unused when we have no experiemnets
'static/app/utils/useExperiment.tsx',
// --- we should be able to get rid of those: ---
// Only used in stories (so far)
'static/app/components/core/quote/*.tsx',
// todo we currently keep all icons
'static/app/icons/**/*.{js,ts,tsx}',
// todo find out how chartcuterie works
'static/app/chartcuterie/**/*.{js,ts,tsx}',
// TODO: Remove when used
'static/app/components/pipeline/**/*.{js,ts,tsx}',
// TODO: Remove when used
'static/app/views/seerExplorer/contexts/**/*.{js,ts,tsx}',
];
const testingEntryPoints = [
'static/**/*.spec.{js,ts,tsx}',
'static/**/*.snapshots.tsx',
'tests/js/**/*.spec.{js,ts,tsx}',
// jest uses this
'tests/js/test-balancer/index.js',
];
const storyBookEntryPoints = [
// our storybook implementation is here
'static/app/stories/storybook.tsx',
'static/app/stories/playground/*.tsx',
'static/**/*.stories.{js,ts,tsx}',
'static/**/*.mdx',
'build-utils/mdx-plugins.ts',
];
const config: KnipConfig = {
entry: [
...productionEntryPoints.map(entry => `${entry}!`),
...testingEntryPoints,
...storyBookEntryPoints,
'static/eslint/**/index.ts',
// figma code connect files - consumed by Figma CLI
'static/**/*.figma.{tsx,jsx}',
],
project: [
'static/**/*.{js,ts,tsx}!',
'config/**/*.ts',
'tests/js/**/*.{js,ts,tsx}',
// fixtures can be ignored in production - it's fine that they are only used in tests
'!static/**/{fixtures,__fixtures__}/**!',
// helper files for tests - it's fine that they are only used in tests
'!static/**/*{t,T}estUtils*.{js,ts,tsx}!',
// helper files for stories - it's fine that they are only used in tests
'!static/app/**/__stories__/*.{js,ts,tsx}!',
'!static/app/stories/**/*.{js,ts,tsx}!',
// ignore eslint plugins in production
'!static/eslint/**/*.ts!',
],
ignore: [
// api-docs has its own package.json with its own dependencies
'api-docs/**',
],
ignoreExportsUsedInFile: isProductionMode,
ignoreDependencies: [
'core-js',
'tslib', // subdependency of many packages, declare the latest version
'buffer', // rspack.ProvidePlugin, needs better knip plugin
'process', // rspack.ProvidePlugin, needs better knip plugin
'odiff-bin', // raw binary consumed by Python backend, not a JS import
'@swc-contrib/mut-cjs-exports', // used in jest config
],
rules: {
binaries: 'off',
enumMembers: 'off',
},
include: ['nsExports', 'nsTypes'],
mdx: {
config: 'tsconfig.mdx.json',
},
};
export default config;