oxynote/web/knip.ts

68 lines
2.3 KiB
TypeScript

import type { KnipConfig } from "knip"
// knip's nuxt plugin handles the nuxt 4 app/ layout natively (it detects the
// app/ srcDir) and resolves auto-imported components and named composables
// through the generated .nuxt/imports.d.ts and .nuxt/components.d.ts maps —
// so only the conventions it cannot know about are configured here.
const config: KnipConfig = {
// project policy: the hoisted node_modules layout (required by
// electron-forge) makes transitive packages importable, and relying on
// that is deliberate — package.json declares top-level intent only, so
// imports of undeclared packages are not an issue here
rules: {
unlisted: "off",
},
workspaces: {
".": {
entry: [
// the auto-import map connects named exports, but not the
// `export default function useX` style these composables
// use — without this their defaults are reported unused.
// The api/ barrel (index.ts) is also convention-load-bearing:
// it is what makes the nested api/ composables auto-importable.
"app/composables/**/*.ts",
// module convention loaded by name (@pinia/colada-nuxt)
"colada.options.ts",
// electron main/preload world, built by forge + vite
"electron/main.ts",
"electron/preload.ts",
"forge.config.ts",
"vite.electron.config.ts",
],
ignore: [
// vendored shadcn-vue components: installed ahead of use and
// regenerated by the CLI; unused spares and barrel exports
// are expected there
"app/components/shadcn/**",
],
ignoreDependencies: [
// icon collections resolved by name at build time by
// @nuxt/icon
"@iconify-json/.*",
// consumed only by the vendored shadcn drawer spares, which
// are ignored above
"vaul-vue",
// never imported directly — declared as the umbrella that
// provides the individually-imported @tiptap/extension-*
// packages (see rules.unlisted above)
"@tiptap/starter-kit",
// loaded by electron-forge at package time via the string
// names in forge.config.ts
"@electron-forge/maker-deb",
"@electron-forge/maker-rpm",
"@electron-forge/maker-squirrel",
"@electron-forge/maker-zip",
"@electron-forge/plugin-auto-unpack-natives",
"@electron-forge/plugin-vite",
// spawned by `nuxt typecheck` (check-types), not imported
"vue-tsc",
],
},
},
}
export default config