gxmari007 / vite-plugin-eslint

🚨 ESLint plugin for vite
MIT License
266 stars 44 forks source link

ESLint doesn't work with flat config #78

Open TiroZit opened 8 months ago

TiroZit commented 8 months ago

Describe the bug

ESLint introduced a new configuration format eslint.config.js (flat config). With the new format, an error is thrown when starting the application:

node:internal/event_target:1012
  process.nextTick(() => { throw err; });
                           ^
Error: No ESLint configuration found in \src\stories\_utils\docs.
    at CascadingConfigArrayFactory._finalizeConfigArray (\node_modules\@eslint\eslintrc\dist\eslintrc.cjs:3977:19)
    at CascadingConfigArrayFactory.getConfigArrayForFile (\node_modules\@eslint\eslintrc\dist\eslintrc.cjs:3768:21)
    at FileEnumerator._iterateFilesRecursive (\node_modules\eslint\lib\cli-engine\file-enumerator.js:473:52)
    at _iterateFilesRecursive.next (<anonymous>)
    at FileEnumerator._iterateFilesRecursive (\node_modules\eslint\lib\cli-engine\file-enumerator.js:495:33)
    at _iterateFilesRecursive.next (<anonymous>)
    at FileEnumerator._iterateFilesRecursive (\node_modules\eslint\lib\cli-engine\file-enumerator.js:495:33)
    at _iterateFilesRecursive.next (<anonymous>)
    at FileEnumerator._iterateFilesRecursive (\node_modules\eslint\lib\cli-engine\file-enumerator.js:495:33)
    at _iterateFilesRecursive.next (<anonymous>)
Emitted 'error' event on Worker instance at:
    at [kOnErrorMessage] (node:internal/worker:300:10)
    at [kOnMessage] (node:internal/worker:311:37)
    at MessagePort.<anonymous> (node:internal/worker:212:57)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:737:20)
    at exports.emitMessage (node:internal/per_context/messageport:23:28)
    at [kOnExit] (node:internal/worker:278:5)
    at Worker.<computed>.onexit (node:internal/worker:209:20) {
  messageTemplate: 'no-config-found',
  messageData: {
    directoryPath: 'src\\stories\\_utils\\docs'
  }

Running ESLint directly via CLI works with the new config. The checker plugin worked properly before migrating to the new ESLint config.

Expected behavior

ESLint should run without an error and the eslint.config.js file should be used.

The ESLint class used by this plugin doesn't support the new flat config. For the flat config the FlatESLint class must be used which is only exported via eslint/use-at-your-own-risk entrypoint: https://eslint.org/blog/2022/08/new-config-system-part-3/#using-flat-config-with-the-eslint-class

mitchwd commented 8 months ago

This is a duplicate of #55, but looks like neither has had a response from the repo owner. 😕

tthornton3-chwy commented 7 months ago

Added here as well -- #82 should close this issue :) We just gotta get the repo owner to either merge some of these PRs in, or give some other people write access to the project @gxmari007 I understand things get busy, i've been there too! Let the community help support the wonderful tool that you helped create <3 I volunteer to merge PRs in, and if I become too busy as well I would hand over the reigns to someone else.

mnai01 commented 3 months ago

This newer plugin works with flat files. Doesn't seem like #82 is going to be merged anytime soon. @nabla/vite-plugin-eslint