gxmari007 / vite-plugin-eslint

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

Cache not being refreshed #17

Open Thomasan1999 opened 2 years ago

Thomasan1999 commented 2 years ago

When I have a linting error in my file, sometimes the error doesn't disappear from console even after it has been fixed in the actual file. Even if I change the file afterwards, the error is still there (even removing all of file's content doesn't help). vite or vite --force don't work and only deleting node_modules\.vite refreshes the cache. After adding cache: false to the plugin options, the problem has disappeared.

vite.config.ts:

import vue from '@vitejs/plugin-vue';
import * as path from 'path';
import {defineConfig} from 'vite';
import eslintPlugin from 'vite-plugin-eslint';
import {minifyHtml} from 'vite-plugin-html';

export default defineConfig({
    plugins: [
        eslintPlugin(),
        vue(),
        minifyHtml()
    ],
    resolve: {
        alias: {
            '@': path.resolve(__dirname, './src')
        }
    },
    server: {
        port: 8088
    }
});

Used packages:

@typescript-eslint/eslint-plugin: 5.3.0
@typescript-eslint/parser: 5.3.0
@vitejs/plugin-vue: 1.9.4
eslint-plugin-vue: 8.0.3
typescript: 4.4.4
vite: 2.6.13
vite-plugin-eslint: 1.3.0
vite-plugin-html: 2.1.1
vue: 3.2.21
dannysmc95 commented 2 years ago

@Thomasan1999 this is a known issue, the project seems unmaintained.

Just disable cache eslintPlugin({ cache: false });

markteekman commented 2 years ago

Me and my team where having the same issues, eslintPlugin({ cache: false }); fixed the problem, thanks @dannysmc95 for adding that as a solution! 🙂

Igorgro commented 1 year ago

Having same issue even with { cache: false }. If I set failOnError: false, it starts working with hot reload, but vite will not show eslint errors as overlay in browser

GerroDen commented 7 months ago

cache: false doesn't help in my case either. On top of it, it requires a restart of the dev mode. I also use storybook which takes some time to restart even when working on a single component. The cache invalidation occures mainly, when I switch branches in my repository.