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

Cache not being refreshed

Open Thomasan1999 opened this issue 3 years ago • 4 comments

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

Thomasan1999 avatar Nov 06 '21 10:11 Thomasan1999

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

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

dannysmc95 avatar Nov 26 '21 12:11 dannysmc95

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

markteekman avatar Feb 15 '22 08:02 markteekman

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

Igorgro avatar Apr 02 '23 09:04 Igorgro

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.

GerroDen avatar Nov 20 '23 18:11 GerroDen