diff --git a/docs/guide/monorepo.md b/docs/guide/monorepo.md index def5b9aa08..f1a898c2ef 100644 --- a/docs/guide/monorepo.md +++ b/docs/guide/monorepo.md @@ -24,7 +24,7 @@ export default defineConfig({ overrides: [ { files: ['apps/web/**', 'packages/ui/**'], - plugins: ['typescript', 'react'], + plugins: ['react'], rules: { 'react/self-closing-comp': 'error', }, @@ -40,9 +40,9 @@ export default defineConfig({ }, { files: ['**/*.test.ts', '**/*.spec.ts'], - plugins: ['typescript', 'vitest'], + plugins: ['vitest'], rules: { - '@typescript-eslint/no-explicit-any': 'off', + 'typescript/no-explicit-any': 'off', 'vitest/no-disabled-tests': 'error', }, }, @@ -54,7 +54,7 @@ export default defineConfig({ Globs are resolved from the root `vite.config.ts`, so use workspace paths such as `apps/web/**`, `apps/api/**`, and `packages/ui/**`. ::: tip -When a `lint.overrides` entry sets `plugins`, that list replaces the base `lint.plugins` list for matched files. Include every plugin needed by that file group, such as `['typescript', 'react']`. Omit `plugins` only when the override should inherit the base list unchanged. +When a `lint.overrides` entry sets `plugins`, that list will be merged with the base `lint.plugins` list for matched files. Omit `plugins` only when the override should inherit the base list unchanged. ::: ## Format Overrides diff --git a/packages/cli/snap-tests/lint-override-semantic/package.json b/packages/cli/snap-tests/lint-override-semantic/package.json new file mode 100644 index 0000000000..769d8eb1d2 --- /dev/null +++ b/packages/cli/snap-tests/lint-override-semantic/package.json @@ -0,0 +1,6 @@ +{ + "name": "lint-override-semantic", + "version": "1.0.0", + "private": true, + "type": "module" +} diff --git a/packages/cli/snap-tests/lint-override-semantic/snap.txt b/packages/cli/snap-tests/lint-override-semantic/snap.txt new file mode 100644 index 0000000000..cd4088ddcc --- /dev/null +++ b/packages/cli/snap-tests/lint-override-semantic/snap.txt @@ -0,0 +1,36 @@ +[1]> vp lint src # extends rules are preserved when a file override adds Vue rules + + × eslint(no-console): Unexpected console statement. + ╭─[src/example.js:1:1] + 1 │ console.log(); + · ─────────── + ╰──── + help: Delete this console statement. + + × vue(no-export-in-script-setup): + ╰──── + + × vue(no-export-in-script-setup): + ╰──── + + × eslint(no-console): Unexpected console statement. + ╭─[src/example.vue:6:1] + 5 │ diff --git a/packages/cli/snap-tests/lint-override-semantic/steps.json b/packages/cli/snap-tests/lint-override-semantic/steps.json new file mode 100644 index 0000000000..9205836c39 --- /dev/null +++ b/packages/cli/snap-tests/lint-override-semantic/steps.json @@ -0,0 +1,3 @@ +{ + "commands": ["vp lint src # extends rules are preserved when a file override adds Vue rules"] +} diff --git a/packages/cli/snap-tests/lint-override-semantic/vite.config.ts b/packages/cli/snap-tests/lint-override-semantic/vite.config.ts new file mode 100644 index 0000000000..cc466cb3c4 --- /dev/null +++ b/packages/cli/snap-tests/lint-override-semantic/vite.config.ts @@ -0,0 +1,17 @@ +import { defineConfig } from 'vite-plus'; + +export default defineConfig({ + lint: { + rules: { 'no-console': 'error' }, + plugins: ['unicorn', 'eslint'], + overrides: [ + { + files: ['**/*.vue'], + plugins: ['vue'], + rules: { + 'vue/no-export-in-script-setup': 'error', + }, + }, + ], + }, +});