From 3c00ed78225d13bbbfef44a7f1bd4656a3a0016b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Hamburger=20Gr=C3=B8ngaard?= Date: Fri, 20 Nov 2026 18:11:58 +0000 Subject: [PATCH] chore: check import cycles with fallow Add `fallow` 3.43.2 and a `check:fallow` script that fails on any import cycle. Only the circular dependency rule is on, and imports inside a function (`import()`) are left out. knip stays the check for unused code. --- .fallowrc.json | 79 ++++++++++++++++++++++++++++++++++++++++++++ package.json | 2 ++ pnpm-lock.yaml | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 170 insertions(+) create mode 100644 .fallowrc.json diff --git a/.fallowrc.json b/.fallowrc.json new file mode 100644 index 0000000..a961ebc --- /dev/null +++ b/.fallowrc.json @@ -0,0 +1,79 @@ +{ + "rules": { + "unused-files": "off", + "unused-exports": "off", + "unused-types": "off", + "private-type-leaks": "off", + "deprecated-exports-in-use": "off", + "unused-dependencies": "off", + "unused-dev-dependencies": "off", + "unused-optional-dependencies": "off", + "unused-enum-members": "off", + "unused-class-members": "off", + "unused-namespace-members": "off", + "unused-store-members": "off", + "unprovided-injects": "off", + "unrendered-components": "off", + "unused-component-props": "off", + "absent-component-props": "off", + "constant-parameters": "off", + "unused-component-emits": "off", + "unused-component-inputs": "off", + "unused-component-outputs": "off", + "unused-svelte-events": "off", + "unused-effect-layers": "off", + "unused-tagged-errors": "off", + "unproduced-catch-tags": "off", + "unused-server-actions": "off", + "unused-load-data-keys": "off", + "prop-drilling": "off", + "thin-wrapper": "off", + "duplicate-prop-shape": "off", + "css-token-drift": "off", + "css-duplicate-block": "off", + "css-selector-complexity": "off", + "css-dead-surface": "off", + "css-broken-reference": "off", + "complexity-cyclomatic": "off", + "complexity-cognitive": "off", + "complexity-crap": "off", + "complexity-file-lines": "off", + "unresolved-imports": "off", + "unlisted-dependencies": "off", + "unlisted-binaries": "off", + "duplicate-exports": "off", + "duplicate-export-aliases": "off", + "type-only-dependencies": "off", + "test-only-dependencies": "off", + "dev-dependencies-in-production": "off", + "circular-dependencies": "error", + "re-export-cycle": "off", + "package-cycle": "off", + "boundary-violation": "off", + "coverage-gaps": "off", + "feature-flags": "off", + "stale-suppressions": "off", + "require-suppression-reason": "off", + "unused-catalog-entries": "off", + "empty-catalog-groups": "off", + "unresolved-catalog-references": "off", + "unused-dependency-overrides": "off", + "misconfigured-dependency-overrides": "off", + "security-client-server-leak": "off", + "security-sink": "off", + "policy-violation": "off", + "invalid-client-export": "off", + "mixed-client-server-barrel": "off", + "misplaced-directive": "off", + "route-collision": "off", + "dynamic-segment-name-conflict": "off", + "weakened-tests": "off", + "added-suppression": "off", + "test-only-branch": "off", + "diverged-clone-sibling": "off", + "added-dependency": "off" + }, + "circularDependencies": { + "ignoreLazyImports": true + } +} diff --git a/package.json b/package.json index 8645769..d77e2f3 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ }, "scripts": { "build": "pkg-utils build --strict --check", + "check:fallow": "fallow dead-code", "check:format": "oxfmt --check .", "check:knip": "NODE_OPTIONS=\"$NODE_OPTIONS --conditions=source\" knip", "check:lint": "oxlint", @@ -92,6 +93,7 @@ "@vitest/browser": "^5.0.5", "@vitest/browser-playwright": "^5.0.5", "del-cli": "^6.0.0", + "fallow": "3.43.2", "jsdom": "^27.2.0", "knip": "6.0.0", "oxc-transform-react": "^0.145.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 269836a..f269e59 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -86,6 +86,9 @@ importers: del-cli: specifier: ^6.0.0 version: 6.0.0 + fallow: + specifier: 3.43.2 + version: 3.43.2 jsdom: specifier: ^27.2.0 version: 27.2.0 @@ -549,6 +552,50 @@ packages: cpu: [x64] os: [win32] + '@fallow-cli/darwin-arm64@3.43.2': + resolution: {integrity: sha512-dJkGp1z7aBBMgI0YmN/hxkqSDEXaOw4pu0L8KtYXaQ9mnIUzPQ32xxTENFfoBh6GkbIJKrW2nlN5BEuCPj4CEQ==} + cpu: [arm64] + os: [darwin] + + '@fallow-cli/darwin-x64@3.43.2': + resolution: {integrity: sha512-wKLRa2CsADlwD9eBxIh2gMjrQMl0VancYy0tfqXXdtPWwduOR/nOjyU7w3amB7LqsWB/DR6GBjrGk0DsDyvfPw==} + cpu: [x64] + os: [darwin] + + '@fallow-cli/linux-arm64-gnu@3.43.2': + resolution: {integrity: sha512-9I7v22bDTZgJNaynwDtdCLGrFDQ4oqA4sQ7fj7nDt587JoJ+W82vu1AXL9tnAlp8j1X3FJwTxyu+LFtWLD8uxg==} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@fallow-cli/linux-arm64-musl@3.43.2': + resolution: {integrity: sha512-3GIfib/S6Ql/gtncsa1LGzs7W3UpyGyP4HNko4nR8v99J3YYl8jjad2BYil/9FfOwdgQQUxDebCtplqJUcHV1Q==} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@fallow-cli/linux-x64-gnu@3.43.2': + resolution: {integrity: sha512-ntmKYJ4BL22r57aQGg1xHs79PODnVlxsa7Y/fQvMI/puoLkC5QVlh9qJ0pyQAdgbdpgEnaJYIlOCYBHJHZsfpQ==} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@fallow-cli/linux-x64-musl@3.43.2': + resolution: {integrity: sha512-FL4nvFlnluVRWI7StbT+1KPThCm0scMKhleRiDAuWRb9vf6pF9DUP/lkxno45oDe1qADA/rBSQ0j0rchowt1Zw==} + cpu: [x64] + os: [linux] + libc: [musl] + + '@fallow-cli/win32-arm64-msvc@3.43.2': + resolution: {integrity: sha512-FB4Tq7U2XYUDqGcxkn1J5ZDQ/eLR39vXCfrmJvmu6eWFJ32FD/4tonoO7ECjwjLq+Bct2+PIrKQTUiIkRXMtPg==} + cpu: [arm64] + os: [win32] + + '@fallow-cli/win32-x64-msvc@3.43.2': + resolution: {integrity: sha512-uIgg+wZYF6uLl+Gr6/LhqFtkUvKLIKMygxvBVdrq3b7Jom576OGoeHte/R0kalt0sd4LTJBXLeToP2a6Oh84dw==} + cpu: [x64] + os: [win32] + '@isaacs/ttlcache@2.1.5': resolution: {integrity: sha512-VwGZqqjAWPICTmxUZnbpEfO60LhPWzquik+bmyXGY7pYRn6diEvCI5i6Ca+J6o2y4vS73HrpuMTo2dOvUevH8w==} engines: {node: '>=12'} @@ -2337,6 +2384,11 @@ packages: resolution: {integrity: sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==} engines: {node: '>=12.0.0'} + fallow@3.43.2: + resolution: {integrity: sha512-ibOZSDgDZLIHYFWmxtF+JkdQEdcyTxgpGojtNbB7oJTW1jYyFc87lqUYVN3ZFEXHLBgysU+rcQ37v4x8kl3YIw==} + engines: {node: '>=22'} + hasBin: true + fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} @@ -4070,6 +4122,30 @@ snapshots: '@esbuild/win32-x64@0.28.2': optional: true + '@fallow-cli/darwin-arm64@3.43.2': + optional: true + + '@fallow-cli/darwin-x64@3.43.2': + optional: true + + '@fallow-cli/linux-arm64-gnu@3.43.2': + optional: true + + '@fallow-cli/linux-arm64-musl@3.43.2': + optional: true + + '@fallow-cli/linux-x64-gnu@3.43.2': + optional: true + + '@fallow-cli/linux-x64-musl@3.43.2': + optional: true + + '@fallow-cli/win32-arm64-msvc@3.43.2': + optional: true + + '@fallow-cli/win32-x64-msvc@3.43.2': + optional: true + '@isaacs/ttlcache@2.1.5': {} '@istanbuljs/schema@0.1.3': @@ -5529,6 +5605,19 @@ snapshots: expect-type@1.4.0: {} + fallow@3.43.2: + dependencies: + detect-libc: 2.1.2 + optionalDependencies: + '@fallow-cli/darwin-arm64': 3.43.2 + '@fallow-cli/darwin-x64': 3.43.2 + '@fallow-cli/linux-arm64-gnu': 3.43.2 + '@fallow-cli/linux-arm64-musl': 3.43.2 + '@fallow-cli/linux-x64-gnu': 3.43.2 + '@fallow-cli/linux-x64-musl': 3.43.2 + '@fallow-cli/win32-arm64-msvc': 3.43.2 + '@fallow-cli/win32-x64-msvc': 3.43.2 + fast-deep-equal@3.1.3: {} fast-glob@3.3.3: