fi3ework / vite-plugin-checker

💬 Vite plugin that provide checks of TypeScript, ESLint, vue-tsc, Stylelint and more.
https://vite-plugin-checker.netlify.app
MIT License
1.01k stars 88 forks source link

Commandline option args ignored when using useFlatConfig=true #402

Open kamranasad7 opened 2 months ago

kamranasad7 commented 2 months ago

Describe the bug

When using flat eslint config for eslint checker, command line arguments doesn't work. Im using --ignore-pattern "src/foo/bar" as option in lint command and it completely ignores it and probably other options too.

Reproduction

  1. Integrate eslint in project using flat config.
  2. Setup eslint checker and pass --ignore-pattern or any other option in lint command of eslint checker.

Expected behavior

The eslint checker should read eslint cli arguments and pass it to eslint object. But it is observed that cli option arguments are ignored when using flat config.

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
    Memory: 2.50 GB / 15.75 GB
  Binaries:
    Node: 20.13.1 - C:\Program Files\nodejs\node.EXE
    npm: 10.8.2 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.10.0 - ~\AppData\Local\pnpm\pnpm.CMD
  Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.22621.3527
  npmPackages:
    vite-plugin-checker: ^0.8.0 => 0.8.0

Additional context

No response

Validations

lpillonel commented 2 months ago

I probably have a similar issue; it seems the "--cache" option is ignored as well (also using the flat config & eslint 9)

AlexKrupko commented 1 month ago

I'm facing the same issue. After a little investigation, I found that no command line options are passed to ESLint when we have useFlatConfig: true /src/checkers/eslint/main.ts#L70-L78

I've fixed it temporarily in my project by adding the required options and creating a patch with patch-package. But it'd nice to have it fixed in the next releases.

eslint = new FlatESLint({
    cwd: root,
    cache: eslintOptions.cache,
    cacheLocation: eslintOptions.cacheLocation,
    cacheStrategy: eslintOptions.cacheStrategy,
});
stvoidit commented 1 month ago

In fact, this is a very terrible omission. It becomes extremely difficult to work on very large projects without this option. Please take this as a high priority. We recently found this plugin and are now using it as a default dependency in development - it is extremely useful.