gxmari007 / vite-plugin-eslint

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

Cache is broken. #11

Open dannysmc95 opened 2 years ago

dannysmc95 commented 2 years ago

By default, when using this plugin, it caches the files, but then does not update them, I have noticed this many times.

If you create a file, and get an error, sometimes it does not update the cache (even after saving), and therefore even after restarting the vite dev server, and even making complete code changes (like deleting all the content in a file), it will still throw errors for things that don't exist.

Disabling cache fixes the issue, but that should be the default option until the cache option works correctly.

cmcnicholas commented 2 years ago

exactly the same, I've had to disable it but now we're painfully slow

dannysmc95 commented 2 years ago

@cmcnicholas I haven't got a large project yet, but how slow are we talking?

cmcnicholas commented 2 years ago

@cmcnicholas I haven't got a large project yet, but how slow are we talking?

20-30 seconds ~40-50 files when opening a new part of the application with some deps already loaded. This obviously will differ for others

qwerty2k commented 2 years ago

Is there any on going work to resolve this issue? Had to disable caching as causing any lint error and then fixing it meant that using vite build --watch didn't successfully build the project once the linting issue was fixed, it froze instead.

javialcantaras commented 2 years ago

This problem only happens when you first time execute vite with eslint errors.

The workaround

  1. Disable cache
  2. Fix your eslint errors
  3. Enable cache
  4. Reset vite command

When the first execute vite command without eslint errors, the cache will work fine.

dannysmc95 commented 2 years ago

Is there any on going work to resolve this issue? Had to disable caching as causing any lint error and then fixing it meant that using vite build --watch didn't successfully build the project once the linting issue was fixed, it froze instead.

Genuinely not sure if this project is active anymore.

AndreKR commented 1 year ago

This problem only happens when you first time execute vite with eslint errors.

Good observation! But this is per module, right? So if the first time a particular modules is requested an ESLint error happens, then that particular module is never reloaded, so the error sticks. So the eslint plugin somehow prevents the file/module from being registered for watching/HMR?

dannysmc95 commented 1 year ago

This problem only happens when you first time execute vite with eslint errors.

Good observation! But this is per module, right? So if the first time a particular modules is requested an ESLint error happens, then that particular module is never reloaded, so the error sticks. So the eslint plugin somehow prevents the file/module from being registered for watching/HMR?

To confirm the module is reloaded, as you can develop and HMR will update the module, I just think that rather the eslint plugin itself caches the module, and fails to update it's own cache.

@gxmari007 can you give me (or someone) contributor access so we can at least fix the issue...?

AndreKR commented 1 year ago

@dannysmc95 If you have a fix, even without access you could create a pull request and even publish your version.

Note the there is already a somewhat popular fork.

I haven't tried that fork because I found it after I found vite-plugin-checker, which already solved the issue for me.

gxmari007 commented 1 year ago

This problem only happens when you first time execute vite with eslint errors.

Good observation! But this is per module, right? So if the first time a particular modules is requested an ESLint error happens, then that particular module is never reloaded, so the error sticks. So the eslint plugin somehow prevents the file/module from being registered for watching/HMR?

To confirm the module is reloaded, as you can develop and HMR will update the module, I just think that rather the eslint plugin itself caches the module, and fails to update it's own cache.

@gxmari007 can you give me (or someone) contributor access so we can at least fix the issue...?

PR welcome