Skip to content

Commit 2d0d227

Browse files
justin808claude
andcommitted
Fix Knip dead code detection configuration
- Remove 'nps' from ignoreBinaries (detected by Knip now) - Add spec/dummy client directories to ignore (dynamically loaded by React on Rails) - Add runtime dependencies to ignoreDependencies (needed in production mode) This fixes the failing "Detect dead code" CI check that was also failing on master. Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 879911c commit 2d0d227

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

knip.ts

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ const config: KnipConfig = {
1010
ignoreBinaries: [
1111
// Has to be installed globally
1212
'yalc',
13-
// Used in package.json scripts (devDependency, so unlisted in production mode)
14-
'nps',
1513
// Pro package binaries used in Pro workflows
1614
'playwright',
1715
'e2e-test',
@@ -112,6 +110,12 @@ const config: KnipConfig = {
112110
'**/app-react16/**/*',
113111
// Playwright support files and helpers - generated by cypress-on-rails gem
114112
'e2e/playwright/support/**',
113+
// Components and files used dynamically by React on Rails (registered at runtime)
114+
'client/app/actions/**',
115+
'client/app/components/**',
116+
'client/app/routes/**',
117+
'client/app/startup/**',
118+
'client/app/store/**',
115119
],
116120
project: ['**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}!', 'config/webpack/*.js'],
117121
paths: {
@@ -124,9 +128,6 @@ const config: KnipConfig = {
124128
'bin/.*',
125129
],
126130
ignoreDependencies: [
127-
// Build-time dependencies not detected by Knip in any mode
128-
'@babel/runtime',
129-
'mini-css-extract-plugin',
130131
// There's no ReScript plugin for Knip
131132
'@rescript/react',
132133
// The Babel plugin fails to detect it
@@ -136,18 +137,27 @@ const config: KnipConfig = {
136137
'node-libs-browser',
137138
// The below dependencies are not detected by the Webpack plugin
138139
// due to the config issue.
139-
'css-loader',
140140
'expose-loader',
141141
'file-loader',
142142
'imports-loader',
143143
'null-loader',
144-
'sass',
145-
'sass-loader',
146144
'sass-resources-loader',
147145
'style-loader',
148146
'url-loader',
149147
// Transitive dependency of shakapacker but listed as direct dependency
150148
'webpack-merge',
149+
// Dependencies not detected in production mode
150+
'@babel/runtime',
151+
'mini-css-extract-plugin',
152+
'css-loader',
153+
'sass',
154+
'sass-loader',
155+
// Dependencies used dynamically by React on Rails
156+
'create-react-class',
157+
'react-helmet',
158+
'@types/react-helmet',
159+
'react-redux',
160+
'react-router-dom',
151161
],
152162
},
153163
},

0 commit comments

Comments
 (0)