Skip to content

Commit 1fd0d46

Browse files
committed
Remove unused dependencies and symbols using knip
1 parent 1d0b0ab commit 1fd0d46

File tree

13 files changed

+305
-429
lines changed

13 files changed

+305
-429
lines changed

.github/workflows/ci.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,31 @@ jobs:
9898
run: npm test
9999

100100

101+
frontend-knip:
102+
name: Check the frontend for unused dependencies
103+
runs-on: ubuntu-latest
104+
105+
permissions:
106+
contents: read
107+
108+
steps:
109+
- name: Checkout the code
110+
uses: actions/[email protected]
111+
112+
- name: Install Node
113+
uses: actions/[email protected]
114+
with:
115+
node-version: 20
116+
117+
- name: Install Node dependencies
118+
working-directory: ./frontend
119+
run: npm ci
120+
121+
- name: Check for unused dependencies
122+
working-directory: ./frontend
123+
run: npm run knip
124+
125+
101126
rustfmt:
102127
name: Check Rust style
103128
runs-on: ubuntu-latest
@@ -362,6 +387,7 @@ jobs:
362387
- opa-lint
363388
- frontend-lint
364389
- frontend-test
390+
- frontend-knip
365391
- rustfmt
366392
- cargo-deny
367393
- clippy

frontend/i18next-parser.config.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import type { UserConfig } from "i18next-parser";
88

9-
const config: UserConfig = {
9+
export default {
1010
keySeparator: ".",
1111
pluralSeparator: ":",
1212
defaultNamespace: "frontend",
@@ -30,6 +30,4 @@ const config: UserConfig = {
3030
output: "locales/$LOCALE.json",
3131
input: ["src/**/*.{ts,tsx}"],
3232
sort: true,
33-
};
34-
35-
export default config;
33+
} satisfies UserConfig;

frontend/knip.config.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2024 New Vector Ltd.
2+
//
3+
// SPDX-License-Identifier: AGPL-3.0-only
4+
// Please see LICENSE in the repository root for full details.
5+
6+
import type { KnipConfig } from "knip";
7+
8+
export default {
9+
entry: [
10+
"src/main.tsx",
11+
"src/swagger.tsx",
12+
"src/routes/*",
13+
"i18next-parser.config.ts",
14+
],
15+
ignore: ["src/gql/*", "src/routeTree.gen.ts", ".storybook/locales.ts"],
16+
ignoreDependencies: [
17+
// This is used by the tailwind PostCSS plugin, but not detected by knip
18+
"postcss-nesting",
19+
// We're using @storybook/addon-essentials to simplify upgrades, but knip doesn't detect them
20+
"@storybook/addon-*",
21+
],
22+
} satisfies KnipConfig;

0 commit comments

Comments
 (0)