-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for new flat config eslint.config.js #55
Comments
#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. |
This newer plugin works with flat files. Doesn't seem like #82 is going to be merged anytime soon. |
Hope the author can support eslint.config.js |
you can address this issue with eslintPath opt // vite.config.ts
import { defineConfig, loadEnv, Plugin } from 'vite';
import eslint from 'vite-plugin-eslint';
import react from '@vitejs/plugin-react';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const eslint4vitePath = join(__dirname, 'eslint4vite.js');
const plugins = [
react(),
{ // default settings on build (i.e. fail on error)
...eslint({ eslintPath: eslint4vitePath }),
apply: 'build',
} as Plugin,
{ // do not fail on serve (i.e. local development)
...eslint({
eslintPath: eslint4vitePath,
failOnWarning: false,
failOnError: false,
emitError: true,
emitWarning: true,
}),
apply: 'serve',
enforce: 'post',
} as Plugin,
];
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };
return {
plugins,
};
}); //eslint4vite.js
import { resolve } from 'path';
import eslint from 'eslint/use-at-your-own-risk';
const overrideConfigFile = resolve('eslint.config.js');
export class ESLint extends eslint.FlatESLint {
constructor(params) {
Object.assign(params, { overrideConfigFile });
super(params);
}
} |
Hi, would be awesome if this plugin could support the new flat config format described here: https://eslint.org/docs/latest/use/configure/configuration-files-new
Please let me know if you want me to contribute.
The text was updated successfully, but these errors were encountered: