ESLint VSCode Stops Working if autoInit: false
is Applied #524
Open
Description
Environment
- Operating System: Darwin
- Node Version: v22.11.0
- Nuxt Version: 3.14.1592
- CLI Version: 3.15.0
- Nitro Version: 2.10.4
- Package Manager: npm@10.9.0
- Builder: -
- User Config: default
- Runtime Modules: @nuxt/eslint@0.7.1, @nuxt/ui@2.19.2, @nuxtjs/i18n@9.1.0, @nuxt/test-utils@3.14.4, @nuxt/image@1.8.1, @nuxt/content@2.13.4, @nuxthub/core@0.8.7, @nuxthq/studio@2.2.1, @nuxt/fonts@0.10.2, @vueuse/nuxt@11.3.0
- Build Modules: -
Package
@nuxt/eslint
Reproduction
- Install VSCode ESLint Extension
- Disable
autoInit
- See it not working
Describe the bug
I have tried manually setting the VSCode extension options to look for the config file in the .nuxt
directory and that doesn't work either:
"eslint.workingDirectories": [
{
"directory": "./.nuxt",
"changeProcessCWD": true,
},
],
"eslint.options": {
"overrideConfigFile": ".nuxt/eslint.config.mjs"
},
"eslint.useFlatConfig": true
I think it must be an issue with the generated eslint.config.mjs
as this is the output of the ESLint extension, see logs below.
Logs
TypeError: Unexpected function.
at flatTraverse (/Users/maclong/Developer/quantum/nuxt-template/node_modules/eslint/node_modules/@eslint/config-array/dist/cjs/index.cjs:431:12)
at flatTraverse.next (<anonymous>)
at normalize (/Users/maclong/Developer/quantum/nuxt-template/node_modules/eslint/node_modules/@eslint/config-array/dist/cjs/index.cjs:462:19)
at async FlatConfigArray.normalize (/Users/maclong/Developer/quantum/nuxt-template/node_modules/eslint/node_modules/@eslint/config-array/dist/cjs/index.cjs:928:30)
at async ConfigLoader.calculateConfigArray (/Users/maclong/Developer/quantum/nuxt-template/node_modules/eslint/lib/config/config-loader.js:569:9)
at async #calculateConfigArray (/Users/maclong/Developer/quantum/nuxt-template/node_modules/eslint/lib/config/config-loader.js:646:29)
at async ESLint.calculateConfigForFile (/Users/maclong/Developer/quantum/nuxt-template/node_modules/eslint/lib/eslint/eslint.js:1060:25)
at async ESLint.isPathIgnored (/Users/maclong/Developer/quantum/nuxt-template/node_modules/eslint/lib/eslint/eslint.js:1099:24)
at async /Users/maclong/.windsurf/extensions/dbaeumer.vscode-eslint-3.0.10-universal/server/out/eslintServer.js:1:24295
at async Object.M [as withClass] (/Users/maclong/.windsurf/extensions/dbaeumer.vscode-eslint-3.0.10-universal/server/out/eslintServer.js:1:19807)
[Error - 3:04:29 PM] Calculating config file for file:///Users/maclong/Developer/quantum/nuxt-template/.vscode/settings.json) failed.
TypeError: Unexpected function.
at flatTraverse (/Users/maclong/Developer/quantum/nuxt-template/node_modules/eslint/node_modules/@eslint/config-array/dist/cjs/index.cjs:431:12)
at flatTraverse.next (<anonymous>)
at normalize (/Users/maclong/Developer/quantum/nuxt-template/node_modules/eslint/node_modules/@eslint/config-array/dist/cjs/index.cjs:462:19)
at async FlatConfigArray.normalize (/Users/maclong/Developer/quantum/nuxt-template/node_modules/eslint/node_modules/@eslint/config-array/dist/cjs/index.cjs:928:30)
at async ConfigLoader.calculateConfigArray (/Users/maclong/Developer/quantum/nuxt-template/node_modules/eslint/lib/config/config-loader.js:569:9)
at async #calculateConfigArray (/Users/maclong/Developer/quantum/nuxt-template/node_modules/eslint/lib/config/config-loader.js:646:29)
at async ESLint.calculateConfigForFile (/Users/maclong/Developer/quantum/nuxt-template/node_modules/eslint/lib/eslint/eslint.js:1060:25)
at async ESLint.isPathIgnored (/Users/maclong/Developer/quantum/nuxt-template/node_modules/eslint/lib/eslint/eslint.js:1099:24)
at async /Users/maclong/.windsurf/extensions/dbaeumer.vscode-eslint-3.0.10-universal/server/out/eslintServer.js:1:24295
at async Object.M [as withClass] (/Users/maclong/.windsurf/extensions/dbaeumer.vscode-eslint-3.0.10-universal/server/out/eslintServer.js:1:19807)