-
-
Notifications
You must be signed in to change notification settings - Fork 632
/
Copy pathknip.ts
78 lines (76 loc) · 2.68 KB
/
knip.ts
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
import type { KnipConfig } from 'knip';
const config: KnipConfig = {
// ! at the end means files are used in production
workspaces: {
'.': {
entry: ['node_package/src/ReactOnRails.ts!', 'node_package/src/ReactOnRails.node.ts!'],
project: ['node_package/src/**/*.[jt]s!', 'node_package/tests/**/*.[jt]s'],
babel: {
config: ['node_package/babel.config.js'],
},
ignoreBinaries: [
// Knip fails to detect it's declared in devDependencies
'nps',
// local scripts
'node_package/scripts/.*',
],
ignoreDependencies: [
// Required for TypeScript compilation, but we don't depend on Turbolinks itself.
'@types/turbolinks',
// used in package-scripts.yml
'concurrently',
// The Knip ESLint plugin fails to detect these are transitively required by a config,
// though we don't actually use its rules anywhere.
'eslint-plugin-jsx-a11y',
'eslint-plugin-react',
],
},
'spec/dummy': {
entry: [
'app/assets/config/manifest.js!',
'client/app/packs/**/*.js!',
// Not sure why this isn't detected as a dependency of client/app/packs/server-bundle.js
'client/app/generated/server-bundle-generated.js!',
'spec/fixtures/automated_packs_generation/**/*.js{x,}',
'config/webpack/{production,development,test}.js',
// Declaring this as webpack.config instead doesn't work correctly
'config/webpack/webpack.config.js',
],
project: ['**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}!', 'config/webpack/*.js'],
paths: {
'Assets/*': ['client/app/assets/*'],
},
ignoreBinaries: [
// Has to be installed globally
'yalc',
// Local binaries
'bin/.*',
],
ignoreDependencies: [
// Knip thinks it can be a devDependency, but it's supposed to be in dependencies.
'@babel/runtime',
// There's no ReScript plugin for Knip
'@rescript/react',
// The Babel plugin fails to detect it
'babel-plugin-transform-react-remove-prop-types',
// This one is weird. It's long-deprecated and shouldn't be necessary.
// Probably need to update the Webpack config.
'node-libs-browser',
// The below dependencies are not detected by the Webpack plugin
// due to the config issue.
'css-loader',
'expose-loader',
'file-loader',
'imports-loader',
'mini-css-extract-plugin',
'null-loader',
'sass',
'sass-loader',
'sass-resources-loader',
'style-loader',
'url-loader',
],
},
},
};
export default config;