From c53e710040b6076b8d52f23183b8703b4d55b846 Mon Sep 17 00:00:00 2001 From: "jyc.dev" Date: Sun, 23 Nov 2025 23:48:04 +0100 Subject: [PATCH] add svelteConfig in eslint (#1153) --- .changeset/chubby-lies-turn.md | 5 +++++ packages/eslint-config/eslint.config.js | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 .changeset/chubby-lies-turn.md diff --git a/.changeset/chubby-lies-turn.md b/.changeset/chubby-lies-turn.md new file mode 100644 index 00000000..149e858e --- /dev/null +++ b/.changeset/chubby-lies-turn.md @@ -0,0 +1,5 @@ +--- +'@kitql/eslint-config': patch +--- + +feat(eslint): add `svelteConfig` in `options` diff --git a/packages/eslint-config/eslint.config.js b/packages/eslint-config/eslint.config.js index 2fa33bf8..65ccef8e 100644 --- a/packages/eslint-config/eslint.config.js +++ b/packages/eslint-config/eslint.config.js @@ -82,7 +82,10 @@ const rulePnpmCatalogs = (options = {}) => { ] } -const othersRules = () => { +/** + * @param {{svelteConfig?: import('@sveltejs/kit').Config}} options + */ +const othersRules = ({ svelteConfig } = {}) => { return [ { name: 'eslint/defaults/recommended', @@ -109,6 +112,7 @@ const othersRules = () => { projectService: true, extraFileExtensions: ['.svelte'], parser: ts.parser, + svelteConfig, }, }, }, @@ -182,6 +186,7 @@ const othersRules = () => { * @typedef {Object} KitqlOptions * @property {PnpmCatalogsConfig} [pnpmCatalogs] - Configuration object for pnpm catalogs * @property {OxlintConfig} [oxlint] - Configuration object for oxlint + * @property {import('@sveltejs/kit').Config} [svelteConfig] - Configuration object for svelte */ /** @@ -189,13 +194,14 @@ const othersRules = () => { * @returns {import('eslint').Linter.Config[]} */ export const kitql = (options = {}) => { + const svelteConfig = options?.svelteConfig ?? {} const pnpmCatalogsConfig = options?.pnpmCatalogs ?? { enable: false } const pnpmCatalogsEnabled = pnpmCatalogsConfig.enable !== false const arr = [ // default rules rulePrettierIgnore({ pnpmCatalogsEnabled }), - ...othersRules(), + ...othersRules({ svelteConfig }), ] if (pnpmCatalogsEnabled) { -- 2.51.2