lintCommand does not work with useFlatConfig
Describe the bug
I use different ESLint config files:
- For IDE with a standard name (
eslint.config.mjs). It contains more warnings. - For CI, Vite Checher with disabled some rules.
I set
lintCommandtoeslint -c eslint.config.ide.mjs ...With an old ESLint (below 9 version) Vite Checker use my different ESLint config and I don't see any excess warnings in a terminal or Vite Checker UI. But with the ESLint 9 when I useuseFlatConfigflaglintCommanddoesn't work.dev.overrideConfigdoesn't work withuseFlatConfigtoo.
Reproduction
Set useFlatConfig: true, lintCommand: "eslint -c eslint.config.ide.mjs ."
Expected behavior
When using useFlatConfig Vite Checker should process lintCommand and dev.overrideConfig.
System Info
System:
OS: Linux 6.8 Ubuntu 24.04.1 LTS 24.04.1 LTS (Noble Numbat)
CPU: (12) x64 Intel(R) Core(TM) i7-8700B CPU @ 3.20GHz
Memory: 23.95 GB / 31.19 GB
Container: Yes
Shell: 5.2.21 - /bin/bash
Binaries:
Node: 18.20.2 - ~/.nvm/versions/node/v18.20.2/bin/node
npm: 10.9.1 - ~/.nvm/versions/node/v18.20.2/bin/npm
npmPackages:
vite-plugin-checker: ^0.8.0 => 0.8.0
Additional context
No response
Validations
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
The issue is here:
https://github.com/fi3ework/vite-plugin-checker/blob/e6d564f3e281d66f037bd54333cc852639e87af4/packages/vite-plugin-checker/src/checkers/eslint/main.ts#L76
Additional configured options from the lintCommand & overrideConfig are not passed to the FlatESLint constructor. The FlatESLint constructor is just an alias to ESLint in ESLint 9. However, if I just use the the default option, I still get errors thrown about no longer valid options generated by translatedOptions
Error: Invalid Options:
- Unknown options: extensions, ignorePath, reportUnusedDisableDirectives, resolvePluginsRelativeTo, rulePaths, useEslintrc
- 'extensions' has been removed.
- 'resolvePluginsRelativeTo' has been removed.
- 'ignorePath' has been removed.
- 'rulePaths' has been removed. Please define your rules using plugins.
- 'reportUnusedDisableDirectives' has been removed. Please use the 'overrideConfig.linterOptions.reportUnusedDisableDirectives' option instead.
I cannot pass undefined for those options in overrideConfig because eslint is looking for the presence of the keys using Object.keys
For anyone else coming here with the same issue. Try passing useFlatConfig: true in the config.
checker({
eslint: {
lintCommand: 'eslint "./src/**/*.{js,jsx}"',
useFlatConfig: true
},
overlay: true,
})