Open jeron-diovis opened 6 months ago
if you use FLAT CONFIG, specify to checker
plugins: [
checker({
eslint: {
useFlatConfig: true, // for me this fix the problem
lintCommand: "eslint 'src/scripts/**/*.ts'",
},
}),
],
useFlatConfig
is not working for me. Still getting same error
checker({
typescript: true,
eslint: {
useFlatConfig: true,
lintCommand: 'eslint "./src/**/*.{ts,tsx}"',
},
overlay: {
initialIsOpen: false,
},
}),
dependencies
"vite-plugin-checker": "^0.6.4",
"eslint": "^9.3.0",
Same issue.
Try now using "vite-plugin-checker": "0.7.0"
@vishal-kadmos
Any updates?
It doesn't work with the ESLint 9.9.0 eslint.config.ts
.
Using dev: { overrideConfig: { flags: ['unstable_ts_config'] } },
it simply ignores the flag.
Using lintCommand: 'eslint --flag unstable_ts_config'
it says "unknown --flag
, do I mean --fix
?"
Edit: Looking into the code the typing says there is a flags
, but in the code it is not used for eslint
.
Only for the others like biome
.
eslint = new FlatESLint({
cwd: root,
})
it should be as example for a hardcoded flag
eslint = new FlatESLint({
cwd: root,
flags: ['unstable_ts_config']
});
sooo there is the interpreting of the flags
option completely missing.
And for the buildmode it needs fixes here https://github.com/fi3ework/vite-plugin-checker/blob/b2c32367cf2e410154194d7730d8830aace898d9/packages/vite-plugin-checker/src/checkers/eslint/main.ts#L171-L179
Because the mentioned eslint.dev.eslint
in the docs doesn't seem to exist for eslint
.
Only for biome
.
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
Error [ConfigError]: Config (unnamed): Key "env": This appears to be in eslintrc format rather than flat config format.
[0] at rethrowConfigError (xxx/node_modules/@eslint/config-array/dist/cjs/index.cjs:303:8)
[0] at xxx/node_modules/@eslint/config-array/dist/cjs/index.cjs:1098:5
[0] at Array.reduce (<anonymous>)
[0] at FlatConfigArray.getConfigWithStatus (xxx/node_modules/@eslint/config-array/dist/cjs/index.cjs:1091:43)
[0] ... 2 lines matching cause stack trace ...
[0] at async NodeHfs.<anonymous> (file:///xxx/node_modules/@humanfs/core/src/hfs.js:574:24)
[0] at async NodeHfs.walk (file:///xxx/node_modules/@humanfs/core/src/hfs.js:614:3)
[0] at async globSearch (xxx/node_modules/eslint/lib/eslint/eslint-helpers.js:327:26)
[0] at async Promise.allSettled (index 0)
https://github.com/fi3ework/vite-plugin-checker/compare/main...buggedcom:vite-plugin-checker:main
I didn't fix the issue but hardcoded the flag via a pnpm
patch:
# 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.
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