|  | 
|  | 1 | +import type { KnipConfig } from 'knip'; | 
|  | 2 | + | 
|  | 3 | +const config: KnipConfig = { | 
|  | 4 | +  // ! at the end means files are used in production | 
|  | 5 | +  workspaces: { | 
|  | 6 | +    '.': { | 
|  | 7 | +      entry: ['node_package/src/ReactOnRails.ts!', 'node_package/src/ReactOnRails.node.ts!'], | 
|  | 8 | +      project: ['node_package/src/**/*.[jt]s!', 'node_package/tests/**/*.[jt]s'], | 
|  | 9 | +      babel: { | 
|  | 10 | +        config: ['node_package/babel.config.js'], | 
|  | 11 | +      }, | 
|  | 12 | +      ignoreBinaries: [ | 
|  | 13 | +        // Knip fails to detect it's declared in devDependencies | 
|  | 14 | +        'nps', | 
|  | 15 | +        // local scripts | 
|  | 16 | +        'node_package/scripts/.*', | 
|  | 17 | +      ], | 
|  | 18 | +      ignoreDependencies: [ | 
|  | 19 | +        // Required for TypeScript compilation, but we don't depend on Turbolinks itself. | 
|  | 20 | +        '@types/turbolinks', | 
|  | 21 | +        // used in package-scripts.yml | 
|  | 22 | +        'concurrently', | 
|  | 23 | +        // The Knip ESLint plugin fails to detect these are transitively required by a config, | 
|  | 24 | +        // though we don't actually use its rules anywhere. | 
|  | 25 | +        'eslint-plugin-jsx-a11y', | 
|  | 26 | +        'eslint-plugin-react', | 
|  | 27 | +      ], | 
|  | 28 | +    }, | 
|  | 29 | +    'spec/dummy': { | 
|  | 30 | +      entry: [ | 
|  | 31 | +        'app/assets/config/manifest.js!', | 
|  | 32 | +        'client/app/packs/**/*.js!', | 
|  | 33 | +        // Not sure why this isn't detected as a dependency of client/app/packs/server-bundle.js | 
|  | 34 | +        'client/app/generated/server-bundle-generated.js!', | 
|  | 35 | +        'spec/fixtures/automated_packs_generation/**/*.js{x,}', | 
|  | 36 | +        'config/webpack/{production,development,test}.js', | 
|  | 37 | +        // Declaring this as webpack.config instead doesn't work correctly | 
|  | 38 | +        'config/webpack/webpack.config.js', | 
|  | 39 | +      ], | 
|  | 40 | +      project: ['**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}!', 'config/webpack/*.js'], | 
|  | 41 | +      paths: { | 
|  | 42 | +        'Assets/*': ['client/app/assets/*'], | 
|  | 43 | +      }, | 
|  | 44 | +      ignoreBinaries: [ | 
|  | 45 | +        // Has to be installed globally | 
|  | 46 | +        'yalc', | 
|  | 47 | +        // Local binaries | 
|  | 48 | +        'bin/.*', | 
|  | 49 | +      ], | 
|  | 50 | +      ignoreDependencies: [ | 
|  | 51 | +        // Knip thinks it can be a devDependency, but it's supposed to be in dependencies. | 
|  | 52 | +        '@babel/runtime', | 
|  | 53 | +        // There's no ReScript plugin for Knip | 
|  | 54 | +        '@rescript/react', | 
|  | 55 | +        // The Babel plugin fails to detect it | 
|  | 56 | +        'babel-plugin-transform-react-remove-prop-types', | 
|  | 57 | +        // This one is weird. It's long-deprecated and shouldn't be necessary. | 
|  | 58 | +        // Probably need to update the Webpack config. | 
|  | 59 | +        'node-libs-browser', | 
|  | 60 | +        // The below dependencies are not detected by the Webpack plugin | 
|  | 61 | +        // due to the config issue. | 
|  | 62 | +        'css-loader', | 
|  | 63 | +        'expose-loader', | 
|  | 64 | +        'file-loader', | 
|  | 65 | +        'imports-loader', | 
|  | 66 | +        'mini-css-extract-plugin', | 
|  | 67 | +        'null-loader', | 
|  | 68 | +        'sass', | 
|  | 69 | +        'sass-loader', | 
|  | 70 | +        'sass-resources-loader', | 
|  | 71 | +        'style-loader', | 
|  | 72 | +        'url-loader', | 
|  | 73 | +      ], | 
|  | 74 | +    }, | 
|  | 75 | +  }, | 
|  | 76 | +}; | 
|  | 77 | + | 
|  | 78 | +export default config; | 
0 commit comments