Skip to content

Commit

Permalink
🧑‍💻(lld) migrate to knip
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasWerey committed Oct 28, 2024
1 parent ccf8754 commit c090e87
Show file tree
Hide file tree
Showing 11 changed files with 147 additions and 52 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-and-test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
determine-affected:
name: "Turbo Affected"
if: ${{!github.event.pull_request.head.repo.fork }}
uses: LedgerHQ/ledger-live/.github/workflows/turbo-affected-reusable.yml@develop
uses: LedgerHQ/ledger-live/.github/workflows/turbo-affected-reusable.yml@chore/knip # removed after test
with:
head_branch: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
base_branch: ${{ github.event.pull_request.base.ref || github.event.merge_group.base_ref }}
Expand All @@ -25,14 +25,14 @@ jobs:
name: "Build Desktop"
needs: determine-affected
if: ${{contains(needs.determine-affected.outputs.paths, 'ledger-live-desktop') && !github.event.pull_request.head.repo.fork }}
uses: LedgerHQ/ledger-live/.github/workflows/build-desktop-reusable.yml@develop
uses: LedgerHQ/ledger-live/.github/workflows/build-desktop-reusable.yml@chore/knip # removed after test
secrets: inherit

test-desktop:
name: "Test Desktop"
needs: determine-affected
if: ${{contains(needs.determine-affected.outputs.paths, 'ledger-live-desktop') && !github.event.pull_request.head.repo.fork}}
uses: LedgerHQ/ledger-live/.github/workflows/test-desktop-reusable.yml@develop
uses: LedgerHQ/ledger-live/.github/workflows/test-desktop-reusable.yml@chore/knip # removed after test
secrets: inherit

# LLM
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
name: "Test Libraries"
needs: determine-affected
if: ${{contains(needs.determine-affected.outputs.paths, 'libs') && !github.event.pull_request.head.repo.fork}}
uses: LedgerHQ/ledger-live/.github/workflows/test-libs-reusable.yml@develop
uses: LedgerHQ/ledger-live/.github/workflows/test-libs-reusable.yml@chore/knip # removed after test
secrets: inherit

test-design-system:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-desktop-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
name: lint-desktop
path: ${{ github.workspace }}/apps/ledger-live-desktop/lint-desktop.json
- name: check for dead code
run: pnpm desktop unimported
run: pnpm desktop knip-check
shell: bash

unit-tests:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-libs-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
id: typecheck-libs
run: pnpm typecheck --continue --filter="!./apps/**" --filter="!./tools/**" --filter="!ledger-live*...[${{ inputs.since_branch && format('origin/{0}', inputs.since_branch) || 'HEAD^1' }}]" --api="http://127.0.0.1:${{ steps.toolchain.outputs.port }}" --token="${{ secrets.TURBOREPO_SERVER_TOKEN }}" --team="foo"
- name: Test unimported files
id: unimported
id: unimported & knip
run: pnpm unimported --continue --filter="!./apps/**" --filter="!./tools/**" --filter="!ledger-live*...[${{ inputs.since_branch && format('origin/{0}', inputs.since_branch) || 'HEAD^1' }}]" --api="http://127.0.0.1:${{ steps.toolchain.outputs.port }}" --token="${{ secrets.TURBOREPO_SERVER_TOKEN }}" --team="foo"
shell: bash
- uses: actions/github-script@v6
Expand Down
39 changes: 0 additions & 39 deletions apps/ledger-live-desktop/.unimportedrc.json

This file was deleted.

4 changes: 2 additions & 2 deletions apps/ledger-live-desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
"test:playwright:clean": "git clean -fdX tests/artifacts",
"typecheck": "node scripts/typecheck.js",
"check": "pnpm lint; pnpm typecheck",
"unimported": "unimported",
"assets:replace": "zx ./scripts/replace-assets.mjs"
"assets:replace": "zx ./scripts/replace-assets.mjs",
"knip-check": "pnpm knip --directory ../.. -W apps/ledger-live-desktop"
},
"dependencies": {
"@braze/web-sdk": "4.10.2",
Expand Down
41 changes: 41 additions & 0 deletions knip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"$schema": "https://unpkg.com/knip@5/schema.json",
"rules": {
"binaries": "off",
"classMembers": "off",
"dependencies": "error",
"devDependencies": "off",
"optionalPeerDependencies": "off",
"duplicates": "warn",
"enumMembers": "warn",
"exports": "warn",
"files": "error",
"nsExports": "off",
"nsTypes": "off",
"types": "warn",
"unlisted": "off",
"unresolved": "off"
},
"ignoreExportsUsedInFile": true,

"workspaces": {
"./apps/ledger-live-desktop": {
"entry": [
"src/index.ts",
"src/renderer/index.ts",
"src/preloader/index.ts",
"src/renderer/webworkers/workers/*.ts",
"src/webviewPreloader/dappPreloader.ts",
"src/webviewPreloader/index.ts"
],
"project": ["src/**"],
"ignore": ["src/newArch/features/Collectibles/**", "src/**/__integration__/**", "**/types.*"],
"ignoreBinaries": ["eslint", "knip", "prettier", "zx", "lint"],
"ignoreDependencies": ["prop-types", "allure-commandline", "msw"]
},
"./libs/live-nft-react": {
"entry": ["src/index.ts", "src/tools/*", "src/hooks/*"],
"project": ["src/**"]
}
}
}
4 changes: 0 additions & 4 deletions libs/live-nft-react/.unimportedrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion libs/live-nft-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"lint": "eslint ./src --no-error-on-unmatched-pattern --ext .ts,.tsx --cache",
"lint:fix": "pnpm lint --fix",
"typecheck": "tsc --noEmit",
"unimported": "unimported",
"unimported": "pnpm knip --directory ../.. -W libs/live-nft-react",
"test": "jest"
},
"typesVersions": {
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"lint": "pnpm turbo lint --no-daemon",
"lint:fix": "pnpm turbo lint:fix --no-daemon",
"typecheck": "pnpm turbo typecheck --no-daemon",
"knip-check": "pnpm turbo knip-check --no-daemon",
"unimported": "pnpm turbo unimported",
"desktop": "pnpm --filter ledger-live-desktop",
"cli": "pnpm --filter live-cli",
Expand Down Expand Up @@ -171,6 +172,7 @@
"eslint-config-prettier": "9.1.0",
"eslint-plugin-json": "3.1.0",
"eslint-plugin-prettier": "5.1.3",
"knip": "5.34.1",
"nyc": "15.1.0",
"prettier": "3.2.5",
"rimraf": "4.4.1",
Expand Down
Loading

0 comments on commit c090e87

Please sign in to comment.