gxmari007 / vite-plugin-eslint

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

Exclude a folder from beeing used by the plugin #42

Open PsclDev opened 1 year ago

PsclDev commented 1 year ago

I am using version 1.6.1of your plugin. And my project is using a git submodule, which also have a eslint config file.

How can I exclude that git submodule to being used by your plugin? Because it is throwing me errors while runtime [plugin:vite-plugin-eslint] Failed to load plugin 'prettier' declared in 'shared/.eslintrc.js': Cannot find module 'eslint-plugin-prettier' Require stack:

Already put that folder into .eslintignore and inside the vite.config.ts but its still beeing thrown me errors

plugins: [
    eslint({
      exclude: './shared',
      emitWarning: false,
      emitError: false,
    }),
  ],
gxmari007 commented 1 year ago

Try this?

plugins: [
  eslint({
     exclude: './shared/**',
     emitWarning: false,
     emitError: false,
  }),
],
mturoci commented 1 year ago

Note for anyone who may find this helpful: I tried to migrate from 1.3.0 to 1.8.0 and got a weird error during build saying some random plugin could not be loaded.

Seems like the prev configuration: eslintPlugin({ cache: false, exclude: ['node_modules'] }) needs to be changed to eslintPlugin({ cache: false, exclude: ['**/node_modules/**'] }) as suggested by @gxmari007 above.