Skip to content

Commit 6d3887d

Browse files
committed
fix: throw when using —fix with ESLint
1 parent 5dd90c9 commit 6d3887d

File tree

1 file changed

+6
-0
lines changed
  • packages/vite-plugin-checker/src/checkers/eslint

1 file changed

+6
-0
lines changed

packages/vite-plugin-checker/src/checkers/eslint/main.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import chokidar from 'chokidar'
22
import { ESLint } from 'eslint'
33
import path from 'path'
4+
import invariant from 'tiny-invariant'
45
import { fileURLToPath } from 'url'
56
import { parentPort } from 'worker_threads'
67

@@ -38,6 +39,11 @@ const createDiagnostic: CreateDiagnostic<'eslint'> = (pluginConfig) => {
3839
if (!pluginConfig.eslint) return
3940

4041
const options = optionator.parse(pluginConfig.eslint.lintCommand)
42+
invariant(
43+
!options.fix,
44+
'Using `--fix` in `config.eslint.lintCommand` is not allowed in vite-plugin-checker, you could using `--fix` with editor.'
45+
)
46+
4147
const translatedOptions = translateOptions(options) as ESLint.Options
4248

4349
const logLevel = (() => {

0 commit comments

Comments
 (0)