Files
ThreadNet-Web/knip.ts
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

139 lines
5.0 KiB
TypeScript
Raw Permalink Normal View History

2026-07-10 10:47:41 +01:00
/*
Copyright 2026 Element Creations Ltd.
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE in the repository root for full details.
*/
import { type KnipConfig } from "knip";
2024-11-05 18:36:34 +00:00
// Specify this as knip loads config files which may conditionally load plugins
2026-03-05 21:42:08 +00:00
process.env.GITHUB_ACTIONS = "1";
2024-11-05 18:36:34 +00:00
export default {
workspaces: {
"packages/shared-components": {
entry: ["src/index.ts!", "scripts/**"],
project: [
2026-08-05 22:29:30 +01:00
"**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,mdx,pcss}!",
"!scripts/**!",
"!src/test/**!",
"!src/**/test-*!",
"!src/**/*-{mock,mocks,snapshot,actions}.*!",
],
},
2026-02-24 16:10:34 +00:00
"packages/playwright-common": {
entry: ["src/fixtures/index.ts!", "src/testcontainers/index.ts!"],
project: [
2026-08-05 22:29:30 +01:00
"**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,pcss}!",
"!src/flaky-reporter.ts!",
"!src/stale-screenshot-reporter.ts!",
],
2026-03-05 21:42:08 +00:00
ignoreDependencies: [
// Used in playwright-screenshots.sh
"wait-on",
],
ignoreBinaries: ["awk", "printf"],
2026-02-24 16:10:34 +00:00
},
"packages/module-api": {},
2026-02-24 16:10:34 +00:00
"apps/web": {
entry: [
"src/serviceworker/index.ts!",
"src/workers/*.worker.ts!",
"src/utils/exportUtils/exportJS.js!",
"src/vector/localstorage-fix.ts!",
"scripts/**",
"playwright/**",
"test/**",
"res/decoder-ring/**",
"res/jitsi_external_api.min.js",
2026-08-05 22:29:30 +01:00
"res/themes/*/css/*.pcss!",
"I18nWebpackPlugin.ts!",
"module_system/**!",
// Keep for now
"src/hooks/useLocalStorageState.ts!",
"src/hooks/useIsReleaseAnnouncementOpen.ts!",
"src/components/structures/ReleaseAnnouncement.tsx!",
"src/utils/arrays.ts!",
"src/utils/EventPresentationContextProvider.tsx!",
// This is just an awful side-effect import
"src/stores/LifecycleStore.ts!",
],
project: [
2026-08-05 22:29:30 +01:00
"**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,pcss}!",
"!scripts/**!",
"!src/test/**!",
"!recorder-worklet-loader.cjs!",
"!src/**/*-{mock,mocks,snapshot,actions}.*!",
2026-02-24 16:10:34 +00:00
],
ignoreDependencies: [
// False positive
"sw.js",
// Used by webpack
"process",
"util",
// Embedded into webapp
"@element-hq/element-call-embedded",
// Used by matrix-js-sdk, which means we have to include them as a
// dependency so that // we can run `tsc` (since we import the typescript
// source of js-sdk, rather than the transpiled and annotated JS like you
// would with a normal library).
"@types/sdp-transform",
],
},
2026-03-24 12:57:31 +00:00
"apps/desktop": {
entry: ["src/preload.cts!", "electron-builder.ts!", "scripts/**", "hak/**"],
2026-08-05 22:29:30 +01:00
project: ["**/*.{js,ts,pcss}"],
2026-03-24 12:57:31 +00:00
ignoreDependencies: [
// Brought in via hak scripts
"matrix-seshat",
],
2026-06-09 10:20:56 +01:00
ignoreBinaries: [
// Used to build seshat (optional)
"rustc",
// Used by the fetch-package script (optional)
"gpg",
// Used for the macOS universal builds
"lipo",
],
2026-03-24 12:57:31 +00:00
},
"modules": {
2026-08-05 22:29:30 +01:00
project: ["**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,pcss}!", "!playwright/**!"],
},
"modules/*": {
entry: ["src/index.ts{x,}!"],
2026-08-05 22:29:30 +01:00
project: ["**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,pcss}!", "!src/tests/**!", "!e2e/**!"],
},
2026-02-24 16:10:34 +00:00
".": {
entry: ["scripts/**", "docs/**"],
},
},
2026-05-29 08:26:59 +00:00
ignoreDependencies: [
// Used by multiple packages, raises a false positive for some reason
"events",
2026-07-14 09:09:03 +01:00
// Used as a workaround for api-extractor not supporting typescript 7.0
"@typescript/old",
2026-05-29 08:26:59 +00:00
],
2024-11-05 18:36:34 +00:00
ignoreExportsUsedInFile: true,
ignoreBinaries: [
// Optional for coverage:diff development script
"diff-cover",
],
2026-03-05 21:42:08 +00:00
compilers: {
pcss: (text: string) =>
[...text.matchAll(/@import\s+(?:url\()?["']([^"']+)["']\)?[^;]*;/g)]
.map(([, specifier]) => `import "${specifier}";`)
2026-03-05 21:42:08 +00:00
.join("\n"),
2026-02-12 15:19:59 +00:00
},
2026-03-05 21:42:08 +00:00
nx: {
config: ["{nx,package,project}.json", "{apps,packages,modules}/**/{package,project}.json"],
},
2026-03-31 14:52:50 +02:00
playwright: {
config: ["playwright.config.ts", "playwright-merge.config.ts"],
},
2026-03-05 21:42:08 +00:00
tags: ["-knipignore"],
treatConfigHintsAsErrors: true,
treatTagHintsAsErrors: true,
2024-11-05 18:36:34 +00:00
} satisfies KnipConfig;