Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ci): Add knip, remove depcheck #140

Merged
merged 4 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .depcheckrc

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ jobs:
- run: yarn typecheck
- run: yarn format:check
- run: yarn lint
depcheck:
name: Depcheck
knip:
name: Knip
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -44,7 +44,7 @@ jobs:
node-version: '18'
check-latest: true
- run: yarn
- run: yarn depcheck
- run: yarn knip
test:
name: Test
runs-on: ubuntu-latest
Expand Down
5 changes: 5 additions & 0 deletions .knip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"entry": ["src/index.ts"],
"project": ["src/**/*/.ts"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this include scripts/?

"ignoreDependencies": ["@types/jest", "@valora/prettier-config"]
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ This project uses [ESLint](https://eslint.org/) for linting. That is configured

We use [Prettier](https://prettier.io) for auto-formatting. It's recommended to install an editor plugin (like the [VSCode Prettier plugin](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)) to get auto-formatting on save. There's also a `yarn format` script you can run to format all files in the project.

## Dependency Checking
## Dependency / Unused Code Checking

This project uses [depcheck](https://github.com/depcheck/depcheck) for checking dependency use. It's configured in [`.depcheckrc`](.depcheckrc).
This project uses [knip](https://github.com/webpro/knip) for checking both unused dependencies and code within the repo. This tool can catch a *lot* of stuff, including unused dependencies, functions, types, unnecessary/duplicate exports, unused class/enum members, etc. It's configured in [`.knip.json`](.knip.json).

## Scripts

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,28 @@
"lint:fix": "yarn lint --fix",
"format": "prettier --log-level error --write .",
"format:check": "prettier --check .",
"depcheck": "depcheck",
"test": "jest",
"test:watch": "yarn test --watch",
"test:ci": "yarn test --ci --coverage",
"supercheck": "yarn format && yarn lint:fix && yarn typecheck && yarn depcheck && yarn test",
"supercheck": "yarn format && yarn lint:fix && yarn typecheck && yarn knip && yarn test",
"example": "ts-node ./scripts/example.ts",
"deploy": "echo 'Deployed!'"
"deploy": "echo 'Deployed!'",
"knip": "knip"
},
"devDependencies": {
"@types/jest": "^29.5.6",
"@types/shelljs": "^0.8.14",
"@typescript-eslint/eslint-plugin": "^6.5.0",
"@valora/eslint-config-typescript": "^1.0.2",
"@valora/prettier-config": "^0.0.1",
"depcheck": "^1.4.7",
"eslint": "^8.48.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-native": "^4.0.0",
"jest": "^29.7.0",
"knip": "^2.38.6",
"prettier": "^3.0.3",
"shelljs": "^0.8.5",
"ts-jest": "^29.1.1",
Expand Down
Loading