Skip to content

Commit

Permalink
chore: add Knip + config
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Feb 27, 2024
1 parent 491a1d1 commit 7831590
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
46 changes: 46 additions & 0 deletions knip.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"workspaces": {
".": {
// These entries are complementary to the ones found in package.json
"entry": [
"lib/rules/index.js",
"tools/internal-rules/index.js",
"tools/update-rule-types.js",
"wdio.conf.js" // Remove when Knip has a wdio plugin
],
"project": ["{conf,lib,tools}/**/*.js"],
"mocha": {
"entry": [
"tests/{bin,conf,lib,tools}/**/*.js", // see Makefile.js
"tests/_utils/test-lazy-loading-rules.js"
],
"project": ["tests/**/*.js"]
},
"ignore": [
// If Knip would consider exports as named, their usage is too dynamic: globals[`es${ecmaVersion}`]
// An alternative is to add `__esModule: true` to the export and we can remove it here from the ignores:
"conf/globals.js",
// These contain unresolved imports and other oddities:
"tests/bench/large.js",
"tests/lib/rule-tester/rule-tester.js",
"tests/performance/jshint.js",
// Many are required using dynamic paths such as `fs.readFileSync(path.join())`:
"tests/fixtures/**"
],
"ignoreDependencies": [
"c8",
// Ignore until Knip has a wdio plugin:
"@wdio/*",
"rollup-plugin-node-polyfills"
]
},
"docs": {
"entry": ["src/{_data,_plugins}/*.js"],
"project": ["src/{_data,_plugins}/**/*.js"],
"ignoreDependencies": ["algoliasearch"]
},
// Workspaces with default configs:
"packages/*": {},
"tools/internal-rules": {}
}
}
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"lint:docs:rule-examples": "node Makefile.js checkRuleExamples",
"lint:fix": "node Makefile.js lint -- fix",
"lint:fix:docs:js": "node Makefile.js lintDocsJS -- fix",
"lint:knip": "knip",
"release:generate:alpha": "node Makefile.js generatePrerelease -- alpha",
"release:generate:beta": "node Makefile.js generatePrerelease -- beta",
"release:generate:latest": "node Makefile.js generateRelease",
Expand Down Expand Up @@ -101,6 +102,7 @@
"devDependencies": {
"@babel/core": "^7.4.3",
"@babel/preset-env": "^7.4.3",
"@types/node": "^20.11.5",
"@wdio/browser-runner": "^8.14.6",
"@wdio/cli": "^8.14.6",
"@wdio/concise-reporter": "^8.14.0",
Expand Down Expand Up @@ -131,6 +133,7 @@
"got": "^11.8.3",
"gray-matter": "^4.0.3",
"js-yaml": "^4.1.0",
"knip": "^4.0.3",
"lint-staged": "^11.0.0",
"load-perf": "^0.2.0",
"markdown-it": "^12.2.0",
Expand All @@ -157,6 +160,7 @@
"semver": "^7.5.3",
"shelljs": "^0.8.5",
"sinon": "^11.0.0",
"typescript": "^5.3.3",
"vite-plugin-commonjs": "^0.10.0",
"webdriverio": "^8.14.6",
"webpack": "^5.23.0",
Expand Down

0 comments on commit 7831590

Please sign in to comment.