Skip to content

Commit

Permalink
chore: replace depcheck with knip
Browse files Browse the repository at this point in the history
  • Loading branch information
dbudzins committed Mar 15, 2024
1 parent 82b5967 commit 3f39e16
Show file tree
Hide file tree
Showing 18 changed files with 970 additions and 355 deletions.
16 changes: 0 additions & 16 deletions .depcheckrc.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions configs/eslint-config-jwp/.depcheckrc.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions configs/postcss-config-jwp/.depcheckrc.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions configs/stylelint-config-jwp/.depcheckrc.yaml

This file was deleted.

78 changes: 78 additions & 0 deletions knip.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import type { KnipConfig } from 'knip';

const config: KnipConfig = {
ignoreBinaries: [
// These are installed, but don't have valid package.json bin fields for knip to detect them
'stylelint'
],
workspaces: {
'.': {
entry: [
'scripts/**/*'
],
ignoreDependencies: [
// Workspace packages
'eslint-config-jwp',
],
ignoreBinaries: [
// false positives from yarn scripts in github actions
'build',
'global',
'start:test',
'codecept:*'
],
},
'packages/ui-react': {
ignoreDependencies: [
'sass' // Used in css
]
},
'platforms/web': {
ignoreDependencies: [
'@codeceptjs/allure-legacy',
'@codeceptjs/configure', // Used in e2e tests
'@babel/plugin-proposal-decorators', // Used to build with decorators for ioc resolution
'@babel/core', // Required peer dependency for babel plugins
'@types/luxon', // Used in tests
'babel-plugin-transform-typescript-metadata', // Used to build with decorators for ioc resolution
'eslint-plugin-codeceptjs', // Used by apps/web/test-e2e/.eslintrc.cjs
'luxon', // Used in tests
'playwright', // Used in test configs
'sharp', // Requirement for @vite-pwa/assets-generator
'tsconfig-paths', // Used for e2e test setup
'virtual:pwa-register', // Service Worker code is injected at build time,
]
},
'configs/eslint-config-jwp': {
entry: [
'*.*'
],
ignoreDependencies: [
// Dynamically loaded in the eslint config
'@typescript-eslint/eslint-plugin',
'@typescript-eslint/parser',
'eslint-plugin-import',
'eslint-plugin-react',
'eslint-plugin-react-hooks'
]
},
'configs/postcss-config-jwp': {
ignoreDependencies: [
// Dynamically loaded in the postcss config
'postcss-scss'
]
},
'configs/stylelint-config-jwp': {
ignoreDependencies: [
// Dynamically loaded in the stylelint config
'stylelint',
'stylelint-order',
'stylelint-config-recommended-scss',
'stylelint-declaration-strict-value',
'stylelint-scss'
]
}
}
};

export default config;
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
],
"scripts": {
"commit-msg": "commitlint --edit $1",
"depcheck": "depcheck && yarn workspaces run depcheck",
"depcheck": "knip --dependencies",
"format": "run-s -c format:*",
"format:eslint": "eslint \"{**/*,*}.{js,ts,jsx,tsx}\" --fix",
"format:prettier": "prettier --write \"{**/*,*}.{js,ts,jsx,tsx}\"",
Expand All @@ -39,10 +39,10 @@
"@commitlint/config-conventional": "^12.1.1",
"@types/node": "^18.15.3",
"csv-parse": "^5.4.0",
"depcheck": "^1.4.3",
"eslint": "^8.57.0",
"husky": "^6.0.0",
"i18next-parser": "^8.0.0",
"knip": "^5.0.3",
"lint-staged": "^15.1.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.8.8",
Expand Down
9 changes: 0 additions & 9 deletions packages/common/.depcheckrc.yaml

This file was deleted.

4 changes: 3 additions & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"name": "@jwp/ott-common",
"version": "4.30.0",
"private": true,
"main": "./src",
"exports": {
"./*": "./src/**/*"
},
"scripts": {
"lint:ts": "tsc --pretty --noEmit -p ./",
"test": "TZ=UTC LC_ALL=en_US.UTF-8 vitest run",
Expand Down
4 changes: 0 additions & 4 deletions packages/hooks-react/.depcheckrc.yaml

This file was deleted.

1 change: 1 addition & 0 deletions packages/hooks-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"devDependencies": {
"@testing-library/react": "^14.0.0",
"@types/jwplayer": "^8.2.13",
"jsdom": "^22.1.0",
"vi-fetch": "^0.8.0",
"vitest": "^1.3.1"
},
Expand Down
1 change: 0 additions & 1 deletion packages/i18n/.depcheckrc.yaml

This file was deleted.

1 change: 0 additions & 1 deletion packages/theme/.depcheckrc.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions packages/ui-react/.depcheckrc.yaml

This file was deleted.

5 changes: 4 additions & 1 deletion packages/ui-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
"name": "@jwp/ott-ui-react",
"version": "4.30.0",
"private": true,
"main": "./src",
"scripts": {
"lint:ts": "tsc --pretty --noEmit -p ./",
"test": "TZ=UTC LC_ALL=en_US.UTF-8 vitest run",
"test-update": "TZ=UTC LC_ALL=en_US.UTF-8 vitest run --update",
"test-watch": "TZ=UTC LC_ALL=en_US.UTF-8 vitest"
},
"exports": {
"./*": "./src/**/*"
},
"dependencies": {
"@adyen/adyen-web": "^5.42.1",
"@inplayer-org/inplayer.js": "^3.13.24",
Expand Down Expand Up @@ -41,6 +43,7 @@
"@types/payment": "^2.1.4",
"@types/react-infinite-scroller": "^1.2.3",
"@vitejs/plugin-react": "^4.0.4",
"jsdom": "^22.1.0",
"sass": "^1.49.10",
"typescript-plugin-css-modules": "^5.0.2",
"vi-fetch": "^0.8.0",
Expand Down
28 changes: 0 additions & 28 deletions platforms/web/.depcheckrc.yaml

This file was deleted.

1 change: 1 addition & 0 deletions platforms/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"sass": "^1.49.10",
"sharp": "^0.33.2",
"stylelint": "^15.11.0",
"stylelint-config-jwp": "*",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.1.0",
"vi-fetch": "^0.8.0",
Expand Down
1 change: 0 additions & 1 deletion platforms/web/test/.depcheckrc.yaml

This file was deleted.

Loading

0 comments on commit 3f39e16

Please sign in to comment.