From 8e6fe9e5b22544b4c70713170b4752ecc2a9a2ef Mon Sep 17 00:00:00 2001 From: Lars Kappert Date: Mon, 11 Nov 2024 11:38:48 +0100 Subject: [PATCH] Move `pluginsSchema` to separate file --- packages/knip/src/ConfigurationValidator.ts | 87 +------------------- packages/knip/src/schema/plugins.ts | 88 +++++++++++++++++++++ 2 files changed, 89 insertions(+), 86 deletions(-) create mode 100644 packages/knip/src/schema/plugins.ts diff --git a/packages/knip/src/ConfigurationValidator.ts b/packages/knip/src/ConfigurationValidator.ts index d0fb74c1..7d9796cc 100644 --- a/packages/knip/src/ConfigurationValidator.ts +++ b/packages/knip/src/ConfigurationValidator.ts @@ -1,4 +1,5 @@ import { z } from 'zod'; +import { pluginsSchema } from './schema/plugins.js'; const globSchema = z.union([z.string(), z.array(z.string())]); @@ -77,92 +78,6 @@ export const pluginSchema = z.union([ }), ]); -const pluginsSchema = z.object({ - astro: pluginSchema, - angular: pluginSchema, - ava: pluginSchema, - babel: pluginSchema, - c8: pluginSchema, - capacitor: pluginSchema, - changesets: pluginSchema, - commitizen: pluginSchema, - commitlint: pluginSchema, - cspell: pluginSchema, - cucumber: pluginSchema, - cypress: pluginSchema, - dotenv: pluginSchema, - eleventy: pluginSchema, - eslint: pluginSchema, - gatsby: pluginSchema, - 'github-actions': pluginSchema, - 'graphql-codegen': pluginSchema, - husky: pluginSchema, - jest: pluginSchema, - ladle: pluginSchema, - lefthook: pluginSchema, - 'lint-staged': pluginSchema, - linthtml: pluginSchema, - 'lockfile-lint': pluginSchema, - 'lost-pixel': pluginSchema, - markdownlint: pluginSchema, - mocha: pluginSchema, - moonrepo: pluginSchema, - msw: pluginSchema, - nest: pluginSchema, - netlify: pluginSchema, - next: pluginSchema, - node: pluginSchema, - nodemon: pluginSchema, - 'node-test-runner': pluginSchema, - 'npm-package-json-lint': pluginSchema, - nuxt: pluginSchema, - nx: pluginSchema, - nyc: pluginSchema, - oclif: pluginSchema, - playwright: pluginSchema, - 'playwright-ct': pluginSchema, - 'playwright-test': pluginSchema, - postcss: pluginSchema, - preconstruct: pluginSchema, - prettier: pluginSchema, - 'react-cosmos': pluginSchema, - 'release-it': pluginSchema, - remark: pluginSchema, - remix: pluginSchema, - rollup: pluginSchema, - rsbuild: pluginSchema, - rspack: pluginSchema, - 'semantic-release': pluginSchema, - sentry: pluginSchema, - 'simple-git-hooks': pluginSchema, - 'size-limit': pluginSchema, - storybook: pluginSchema, - stryker: pluginSchema, - stylelint: pluginSchema, - svelte: pluginSchema, - syncpack: pluginSchema, - tailwind: pluginSchema, - travis: pluginSchema, - 'ts-node': pluginSchema, - tsup: pluginSchema, - tsx: pluginSchema, - typedoc: pluginSchema, - typescript: pluginSchema, - unbuild: pluginSchema, - unocss: pluginSchema, - 'vercel-og': pluginSchema, - vue: pluginSchema, - vike: pluginSchema, - vite: pluginSchema, - vitest: pluginSchema, - 'webdriver-io': pluginSchema, - webpack: pluginSchema, - wireit: pluginSchema, - wrangler: pluginSchema, - xo: pluginSchema, - yorkie: pluginSchema, -}); - const baseWorkspaceConfigurationSchema = z.object({ entry: globSchema.optional(), project: globSchema.optional(), diff --git a/packages/knip/src/schema/plugins.ts b/packages/knip/src/schema/plugins.ts new file mode 100644 index 00000000..29becd95 --- /dev/null +++ b/packages/knip/src/schema/plugins.ts @@ -0,0 +1,88 @@ +import { z } from 'zod'; +import { pluginSchema } from '../ConfigurationValidator.js'; + +export const pluginsSchema = z.object({ + astro: pluginSchema, + angular: pluginSchema, + ava: pluginSchema, + babel: pluginSchema, + c8: pluginSchema, + capacitor: pluginSchema, + changesets: pluginSchema, + commitizen: pluginSchema, + commitlint: pluginSchema, + cspell: pluginSchema, + cucumber: pluginSchema, + cypress: pluginSchema, + dotenv: pluginSchema, + eleventy: pluginSchema, + eslint: pluginSchema, + gatsby: pluginSchema, + 'github-actions': pluginSchema, + 'graphql-codegen': pluginSchema, + husky: pluginSchema, + jest: pluginSchema, + ladle: pluginSchema, + lefthook: pluginSchema, + 'lint-staged': pluginSchema, + linthtml: pluginSchema, + 'lockfile-lint': pluginSchema, + 'lost-pixel': pluginSchema, + markdownlint: pluginSchema, + mocha: pluginSchema, + moonrepo: pluginSchema, + msw: pluginSchema, + nest: pluginSchema, + netlify: pluginSchema, + next: pluginSchema, + node: pluginSchema, + nodemon: pluginSchema, + 'node-test-runner': pluginSchema, + 'npm-package-json-lint': pluginSchema, + nuxt: pluginSchema, + nx: pluginSchema, + nyc: pluginSchema, + oclif: pluginSchema, + playwright: pluginSchema, + 'playwright-ct': pluginSchema, + 'playwright-test': pluginSchema, + postcss: pluginSchema, + preconstruct: pluginSchema, + prettier: pluginSchema, + 'react-cosmos': pluginSchema, + 'release-it': pluginSchema, + remark: pluginSchema, + remix: pluginSchema, + rollup: pluginSchema, + rsbuild: pluginSchema, + rspack: pluginSchema, + 'semantic-release': pluginSchema, + sentry: pluginSchema, + 'simple-git-hooks': pluginSchema, + 'size-limit': pluginSchema, + storybook: pluginSchema, + stryker: pluginSchema, + stylelint: pluginSchema, + svelte: pluginSchema, + syncpack: pluginSchema, + tailwind: pluginSchema, + travis: pluginSchema, + 'ts-node': pluginSchema, + tsup: pluginSchema, + tsx: pluginSchema, + typedoc: pluginSchema, + typescript: pluginSchema, + unbuild: pluginSchema, + unocss: pluginSchema, + 'vercel-og': pluginSchema, + vue: pluginSchema, + vike: pluginSchema, + vite: pluginSchema, + vitest: pluginSchema, + 'webdriver-io': pluginSchema, + webpack: pluginSchema, + wireit: pluginSchema, + wrangler: pluginSchema, + xo: pluginSchema, + yorkie: pluginSchema, +});