vite-plugin-eslint icon indicating copy to clipboard operation
vite-plugin-eslint copied to clipboard

ESLint doesn't work with flat config

Open TiroZit opened this issue 2 years ago • 3 comments

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

TiroZit avatar Oct 11 '23 10:10 TiroZit

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

mitchwd avatar Oct 20 '23 00:10 mitchwd

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.

tthornton3-chwy avatar Nov 17 '23 01:11 tthornton3-chwy

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

mnai01 avatar Mar 15 '24 02:03 mnai01