-
Notifications
You must be signed in to change notification settings - Fork 91
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
Incompatible with eslint@9 #320
Comments
if you use FLAT CONFIG, specify to checker plugins: [
checker({
eslint: {
useFlatConfig: true, // for me this fix the problem
lintCommand: "eslint 'src/scripts/**/*.ts'",
},
}),
], |
dependencies
|
Same issue. |
Try now using |
Any updates? |
It doesn't work with the ESLint 9.9.0 Using Edit: Looking into the code the typing says there is a
it should be as example for a hardcoded flag
sooo there is the interpreting of the And for the buildmode it needs fixes here vite-plugin-checker/packages/vite-plugin-checker/src/checkers/eslint/main.ts Lines 171 to 179 in b2c3236
Because the mentioned |
It gets a bit more complicated as the options that are being sanitised aren't compatible between the two. I've started work on trying to fix this, but still running into issues. Here are my forked changes but they are not ready yet to get it to work
|
I didn't fix the issue but hardcoded the flag via a # TODO WORKAROUND UNTIL https://github.com/fi3ework/vite-plugin-checker/issues/320 IS RESOLVED
diff --git a/dist/cjs/checkers/eslint/main.js b/dist/cjs/checkers/eslint/main.js
index 7d08eef00a69b3089d0710d40b84de2cf0fd1f0d..a328789395d5f838c97342bd5ad3ae6b5a5ab70e 100644
--- a/dist/cjs/checkers/eslint/main.js
+++ b/dist/cjs/checkers/eslint/main.js
@@ -94,7 +94,8 @@ const createDiagnostic = (pluginConfig) => {
} = require2("eslint/use-at-your-own-risk");
if (shouldUseFlatConfig == null ? void 0 : shouldUseFlatConfig()) {
eslint = new FlatESLint({
- cwd: root
+ cwd: root,
+ flags: ['unstable_ts_config']
});
} else {
throw Error(
@@ -177,9 +178,9 @@ class EslintChecker extends import_Checker.Checker {
buildBin: (pluginConfig) => {
if (pluginConfig.eslint) {
const { lintCommand } = pluginConfig.eslint;
- return ["eslint", lintCommand.split(" ").slice(1)];
+ return ["eslint --flag unstable_ts_config", lintCommand.split(" ").slice(1)];
}
- return ["eslint", [""]];
+ return ["eslint --flag unstable_ts_config", [""]];
}
},
createDiagnostic
diff --git a/dist/esm/checkers/eslint/main.js b/dist/esm/checkers/eslint/main.js
index 2088f4de71ef1d02f1fad6f4b5a616f649b257bc..af3587ea7cab6410d60e616e81534b0a36446502 100644
--- a/dist/esm/checkers/eslint/main.js
+++ b/dist/esm/checkers/eslint/main.js
@@ -67,7 +67,8 @@ const createDiagnostic = (pluginConfig) => {
} = require2("eslint/use-at-your-own-risk");
if (shouldUseFlatConfig == null ? void 0 : shouldUseFlatConfig()) {
eslint = new FlatESLint({
- cwd: root
+ cwd: root,
+ flags: ['unstable_ts_config']
});
} else {
throw Error(
@@ -150,9 +151,9 @@ class EslintChecker extends Checker {
buildBin: (pluginConfig) => {
if (pluginConfig.eslint) {
const { lintCommand } = pluginConfig.eslint;
- return ["eslint", lintCommand.split(" ").slice(1)];
+ return ["eslint --flag unstable_ts_config", lintCommand.split(" ").slice(1)];
}
- return ["eslint", [""]];
+ return ["eslint --flag unstable_ts_config", [""]];
}
},
createDiagnostic |
I'm not sure if it's related, but I was using this library with ESLint v8.57.1 without issues. However, when I switched to v9.13.0 with the flat config, it stopped updating lint errors on hot reload. |
I've been keeping an eye on this issue for a while. When will it be resolved? |
By follow this config, I passed above error
And maybe you will get another issue, but I think it comes from another invalid config. -> vite.config.tts // Rest of code ...
eslint: {
useFlatConfig: true,
// Add `--config eslint.config.mjs`
lintCommand: 'eslint --config eslint.config.mjs "./src/**/*.{js,jsx,ts,tsx}"',
dev: { logLevel: ['error'] },
},
// Rest of code ... -> eslint.config.mjs export default tseslint.config(
{
// Rest of code...
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
projectService: true,
project: './tsconfig.json',
// Replace `tsconfigRootDir: import.meta.dirname`,
// Its fix one of issue I got after that
// Ref: https://typescript-eslint.io/getting-started/typed-linting#can-i-customize-the-tsconfig-used-for-typed-linting
},
},
...
settings: {
react: {
version: 'detect',
},
},
rules: {
// Config rules
},
}
); Version"eslint": "^9.16.0", |
Added the useFlatConfig option and modified the eslint.config.js to be compatible with version 9, and it works perfectly now |
I had the same problem with this environment:
Added the |
Recommend an optional and better plugin: https://github.com/ModyQyW/vite-plugin-eslint2 |
Describe the bug
Build crashes when running with eslint@9 installed:
Reproduction
Expected behavior
Build should not crash when eslint@9 is installed.
System Info
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: