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 1669ac0
Show file tree
Hide file tree
Showing 30 changed files with 229 additions and 172 deletions.
14 changes: 7 additions & 7 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,44 +25,44 @@ 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
build-mobile:
name: "Build Mobile"
needs: determine-affected
if: ${{contains(needs.determine-affected.outputs.paths, 'ledger-live-mobile') && !github.event.pull_request.head.repo.fork}}
uses: LedgerHQ/ledger-live/.github/workflows/build-mobile-reusable.yml@develop
uses: LedgerHQ/ledger-live/.github/workflows/build-mobile-reusable.yml@chore/knip # removed after test
secrets: inherit

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

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

# Tests
test-libraries:
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-mobile-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Run linter
run: pnpm lint --filter="live-mobile" --api="http://127.0.0.1:${{ steps.toolchain.outputs.port }}" --token="${{ secrets.TURBOREPO_SERVER_TOKEN }}" --team="foo" -- --format="json" -o="lint-mobile.json"
- name: check for dead code
run: pnpm mobile unimported
run: pnpm mobile knip-check
shell: bash
- name: Run code checkers
run: pnpm typecheck --filter="live-mobile" --api="http://127.0.0.1:${{ steps.toolchain.outputs.port }}" --token="${{ secrets.TURBOREPO_SERVER_TOKEN }}" --team="foo"
Expand Down
4 changes: 2 additions & 2 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ libs/live-countervalues-react/ @ledgerhq/live-hub
libs/live-nft/ @ledgerhq/live-hub
libs/live-nft-react/ @ledgerhq/live-hub
libs/live-wallet/ @ledgerhq/live-hub
libs/trustchain/ @ledgerhq/live-hub
libs/hw-trustchain/ @ledgerhq/live-hub
libs/ledger-key-ring-protocol/ @ledgerhq/live-hub
libs/hw-ledger-key-ring-protocol/ @ledgerhq/live-hub

# Blockchain team
.github/**/bot-*.yml @ledgerhq/live-blockchain-support
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
45 changes: 0 additions & 45 deletions apps/ledger-live-mobile/.unimportedrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion apps/ledger-live-mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"download-hermes-profile": "zx ./scripts/download-hermes-profile.mjs",
"e2e:loadConfig": "ts-node ./e2e/bridge/start-server.ts",
"check": "pnpm lint; pnpm typecheck",
"unimported": "unimported",
"knip-check": "pnpm knip --directory ../.. -W apps/ledger-live-mobile",
"assets:replace": "zx ./scripts/replace-assets.mjs"
},
"dependencies": {
Expand Down
109 changes: 109 additions & 0 deletions knip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
{
"$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,
"project": ["src/**"],

"ignore": [
"**/__integrations__/*",
"**/*.test.*",
"**/*.spec.*",
"**/tests/**",
"**/__test__/**",
"**/__tests__/**",
"**/__mocks__/**",
"**/e2e/**",
"**/*.config.*"
],

"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"
],
"ignore": ["src/newArch/features/Collectibles/**", "**/types.*"],
"ignoreBinaries": ["eslint", "knip", "prettier", "zx", "lint"],
"ignoreDependencies": ["prop-types", "allure-commandline", "msw"]
},
"./apps/ledger-live-mobile": {
"entry": ["index.js", "src/families/**"],
"ignore": ["src/**/*.android.*", "src/**/*.ios.*", "src/logic/keyboardVisible.ts"],
"ignoreDependencies": [
"@react-native-masked-view/masked-view",
"@react-native/gradle-plugin",
"@react-native/metro-config",
"asyncstorage-down",
"buffer",
"expo-crypto",
"expo-file-system",
"expo-image-loader",
"expo-modules-autolinking",
"expo-modules-core",
"prop-types",
"react-native-fast-pbkdf2",
"react-native-level-fs",
"react-native-navigation-bar-color",
"react-native-randombytes",
"react-native-tcp-socket",
"react-native-udp"
]
},
"./libs/live-nft-react": {
"entry": ["src/index.ts", "src/tools/*", "src/hooks/*"]
},
"./libs/live-nft": {
"entry": ["src/api/index.ts", "src/index.ts", "src/index.test.ts", "src/types.ts"]
},
"./libs/env": {
"entry": ["src/index.ts"]
},
"./libs/live-hooks": {
"entry": ["src/useDebounce.ts", "src/useThrottledFunction.ts"]
},
"./libs/live-countervalues": {
"entry": ["src/logic.ts", "src/api/index.ts", "src/types.ts", "src/portfolio.ts"]
},
"./libs/live-countervalues-react": {
"entry": ["src/index.tsx", "src/portfolio.tsx"]
},
"./libs/live-wallet": {
"entry": [
"src/walletsync/index.ts",
"src/cloudsync/index.ts",
"src/liveqr/cross.ts",
"src/liveqr/importAccounts.ts",
"src/ordering.ts",
"src/addAccounts.ts",
"src/store.ts",
"src/accountName.ts"
]
},
"./libs/ledger-key-ring-protocol": {
"entry": ["src/index.ts", "src/store.ts", "src/qrcode/index.ts"]
},
"./libs/hw-ledger-key-ring-protocol": {
"entry": ["src/index.ts"],
"ignoreDependencies": ["@ledgerhq/logs", "@ledgerhq/live-env"]
}
}
}
5 changes: 0 additions & 5 deletions libs/env/.unimportedrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion libs/env/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@
"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/env"
}
}
4 changes: 0 additions & 4 deletions libs/hw-ledger-key-ring-protocol/.unimportedrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion libs/hw-ledger-key-ring-protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,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/hw-ledger-key-ring-protocol",
"test": "jest"
},
"typesVersions": {
Expand Down
16 changes: 0 additions & 16 deletions libs/ledger-key-ring-protocol/.unimportedrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion libs/ledger-key-ring-protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,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/ledger-key-ring-protocol",
"test": "jest",
"e2e": "ts-node scripts/e2e.ts"
}
Expand Down
4 changes: 0 additions & 4 deletions libs/live-countervalues-react/.unimportedrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion libs/live-countervalues-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-countervalues-react",
"test": "jest"
},
"typesVersions": {
Expand Down
4 changes: 0 additions & 4 deletions libs/live-countervalues/.unimportedrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion libs/live-countervalues/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,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-countervalues",
"test": "jest"
},
"typesVersions": {
Expand Down
5 changes: 0 additions & 5 deletions libs/live-hooks/.unimportedrc.json

This file was deleted.

Loading

0 comments on commit 1669ac0

Please sign in to comment.