Skip to content

Commit 0ccc048

Browse files
chore: add Knip to check for unused code and deps (#424)
* chore: added Knip * Added back babel/runtime * Added back babel/runtime as full dependency * chore: fix merge conflict Removed 'async' and 'didyoumean' dependencies, updated 'chalk' version. * Update chalk dependency version to 5.6.2 --------- Co-authored-by: Leah Wasser <leah@pyopensci.org>
1 parent 5de78d9 commit 0ccc048

4 files changed

Lines changed: 42 additions & 24 deletions

File tree

.github/workflows/knip.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Knip
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
knip:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
18+
with:
19+
node-version: '22'
20+
21+
- name: Install dependencies
22+
run: npm install
23+
24+
- name: Run Knip
25+
run: npx knip

knip.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"$schema": "https://unpkg.com/knip@5.71.0/schema.json",
3+
"ignoreDependencies": ["@babel/runtime"],
4+
"entry": [
5+
"jest.config.js",
6+
"src/**/__tests__/*",
7+
"src/api.js",
8+
"src/repo/*.js",
9+
"src/util/*.js"
10+
],
11+
"treatConfigHintsAsErrors": true
12+
}

other/MAINTAINING.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,6 @@ feature. This keeps our git history clean, but more importantly, this allows us
5959
to make any necessary changes to the commit message so we release what we want
6060
to release. See the next section on Releases for more about that.
6161

62-
## Release
63-
64-
Our releases are automatic. They happen whenever code lands into `main`. A
65-
Circle CI build build gets kicked off and if it's successful, a tool called
66-
[`semantic-release`](https://github.com/semantic-release/semantic-release) is
67-
used to automatically publish a new release to npm as well as a changelog to
68-
GitHub. It is only able to determine the version and whether a release is
69-
necessary by the git commit messages. With this in mind, **please brush up on
70-
[the commit message convention][commit] which drives our releases.**
71-
72-
> One important note about this: Please make sure that commit messages do NOT
73-
> contain the words "BREAKING CHANGE" in them unless we want to push a major
74-
> version. I've been burned by this more than once where someone will include
75-
> "BREAKING CHANGE: None" and it will end up releasing a new major version. Not
76-
> a huge deal honestly, but kind of annoying...
77-
7862
## Thanks!
7963

8064
Thank you so much for helping to maintain this project!

package.json

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"scripts": {
1616
"add-contributor": "kcd-scripts contributors add",
1717
"build": "kcd-scripts build",
18+
"knip": "knip",
1819
"lint": "eslint . && prettier --check --ignore-unknown .",
1920
"lint-fix": "eslint --fix . && prettier --write --ignore-unknown .",
2021
"test": "NODE_OPTIONS='--experimental-vm-modules' kcd-scripts test --watchAll=false",
@@ -46,9 +47,7 @@
4647
"homepage": "https://github.com/all-contributors/all-contributors-cli#readme",
4748
"dependencies": {
4849
"@babel/runtime": "^7.7.6",
49-
"async": "^3.1.0",
50-
"chalk": "^4.0.0",
51-
"didyoumean": "^1.2.1",
50+
"chalk": "^5.6.2",
5251
"inquirer": "^7.3.3",
5352
"json-fixer": "^1.6.8",
5453
"lodash": "^4.11.2",
@@ -58,19 +57,17 @@
5857
},
5958
"devDependencies": {
6059
"@eslint/js": "^9.39.2",
61-
"cz-conventional-changelog": "^3.3.0",
6260
"eslint": "^9.39.2",
63-
"eslint-config-prettier": "^10.1.8",
6461
"eslint-plugin-import": "^2.32.0",
6562
"eslint-plugin-jest": "^29.12.1",
6663
"git-cz": "^4.7.6",
67-
"kcd-scripts": "^16.0.0",
6864
"globals": "^17.1.0",
6965
"husky": "^9.1.0",
66+
"kcd-scripts": "^16.0.0",
67+
"knip": "^5.83.1",
7068
"lint-staged": "^16.2.7",
7169
"nock": "^14.0.10",
72-
"prettier": "^3.8.1",
73-
"semantic-release": "^25.0.2"
70+
"prettier": "^3.8.1"
7471
},
7572
"optionalDependencies": {
7673
"prettier": "^3"

0 commit comments

Comments
 (0)