Skip to content

Commit d9f3f0c

Browse files
authored
[INTERNAL] Replace depcheck with knip (#779)
Due to the deprecation of depcheck we migrated to knip, which is in active development and has more features. As a first step we only activate the checking of unused dependencies. The reason why we replaced the docdash jsdoc template path lookup in the jsdoc script is that knip fails to detect that a dependency (jsdoc) is used when a command inside of the package.json contains JavaScript code (via sub-shell). JIRA: CPOUI5FOUNDATION-1126
1 parent 71d00c0 commit d9f3f0c

3 files changed

Lines changed: 618 additions & 703 deletions

File tree

knip.config.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const config = {
2+
/**
3+
* As we currently only need unused dependency checks, we disable all checks except for that
4+
*/
5+
rules: {
6+
files: "off",
7+
duplicates: "off",
8+
classMembers: "off",
9+
unlisted: "off",
10+
binaries: "off",
11+
unresolved: "off",
12+
catalog: "off",
13+
exports: "off",
14+
types: "off",
15+
enumMembers: "off",
16+
},
17+
18+
ignoreDependencies: [
19+
/**
20+
* Used via nyc ava --node-arguments="--experimental-loader=@istanbuljs/esm-loader-hook"
21+
* which is not detected by knip as a usage of this package
22+
*/
23+
"@istanbuljs/esm-loader-hook",
24+
25+
/**
26+
* Used as jsdoc template in package.json script, which is not detected
27+
*/
28+
"docdash",
29+
30+
/**
31+
* We ignore these dependencies here because these are dynamic imports
32+
* and knip is unable to detect that these are being used
33+
* (lib/middleware/MiddlewareManager.js)
34+
*/
35+
"compression",
36+
"cors"
37+
]
38+
};
39+
40+
export default config;

0 commit comments

Comments
 (0)