Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lintCommand does not work with useFlatConfig #418

Open
2 tasks done
MrEfrem opened this issue Nov 28, 2024 · 1 comment
Open
2 tasks done

lintCommand does not work with useFlatConfig #418

MrEfrem opened this issue Nov 28, 2024 · 1 comment

Comments

@MrEfrem
Copy link

MrEfrem commented Nov 28, 2024

Describe the bug

I use different ESLint config files:

  1. For IDE with a standard name (eslint.config.mjs). It contains more warnings.
  2. For CI, Vite Checher with disabled some rules.
    I set lintCommand to eslint -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 use useFlatConfig flag lintCommand doesn't work.
    dev.overrideConfig doesn't work with useFlatConfig too.

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

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
@MichaelGoff
Copy link

The issue is here:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants