zed icon indicating copy to clipboard operation
zed copied to clipboard

eslint config file not found (monorepo flat eslint config)

Open hedefalk opened this issue 9 months ago • 4 comments

Summary

Eslint runs but on files that are ignored and not using the same settings as eslint on cli.

Actual Behavior: My eslint settings are not honored and it seems its just that they're not found?

ESLint server running in node v21.1.0
ESLint library loaded from: /[my-monorepo]/node_modules/.pnpm/[email protected][email protected]/node_modules/eslint/lib/api.js
An unexpected error occurred:
Error: Could not find config file.

Expected Behavior: I'd expect eslint language server within zed to honor my settings, but it seems settings are not found.

Full stacktrace in language eslint lsp log:

ESLint server running in node v21.1.0
ESLint library loaded from: [mymonorepo]node_modules/.pnpm/[email protected][email protected]/node_modules/eslint/lib/api.js
An unexpected error occurred:
Error: Could not find config file.
    at assertConfigurationExists ([mymonorepo]node_modules/.pnpm/[email protected][email protected]/node_modules/eslint/lib/config/config-loader.js:80:23)
    at LegacyConfigLoader.loadConfigArrayForFile ([mymonorepo]node_modules/.pnpm/[email protected][email protected]/node_modules/eslint/lib/config/config-loader.js:335:9)
    at async ESLint.lintText ([mymonorepo]node_modules/.pnpm/[email protected][email protected]/node_modules/eslint/lib/eslint/eslint.js:911:25)
    at async /Users/viktor/Library/Application Support/Zed/languages/eslint/vscode-eslint-2.4.4/vscode-eslint/server/out/eslint.js:919:35
    at async withClass (/Users/viktor/Library/Application Support/Zed/languages/eslint/vscode-eslint-2.4.4/vscode-eslint/server/out/eslint.js:861:20)
    at async validateSingle (/Users/viktor/Library/Application Support/Zed/languages/eslint/vscode-eslint-2.4.4/vscode-eslint/server/out/eslintServer.js:379:29)
An unexpected error occurred:
Error: Could not find config file.
    at assertConfigurationExists ([mymonorepo]node_modules/.pnpm/[email protected][email protected]/node_modules/eslint/lib/config/config-loader.js:80:23)
    at LegacyConfigLoader.loadConfigArrayForFile ([mymonorepo]node_modules/.pnpm/[email protected][email protected]/node_modules/eslint/lib/config/config-loader.js:335:9)
    at async ESLint.lintText ([mymonorepo]node_modules/.pnpm/[email protected][email protected]/node_modules/eslint/lib/eslint/eslint.js:911:25)
    at async /Users/viktor/Library/Application Support/Zed/languages/eslint/vscode-eslint-2.4.4/vscode-eslint/server/out/eslint.js:919:35
    at async withClass (/Users/viktor/Library/Application Support/Zed/languages/eslint/vscode-eslint-2.4.4/vscode-eslint/server/out/eslint.js:861:20)
    at async validateSingle (/Users/viktor/Library/Application Support/Zed/languages/eslint/vscode-eslint-2.4.4/vscode-eslint/server/out/eslintServer.js:379:29)

Zed Version and System Specs

Zed: v0.179.1 (Zed Preview) OS: macOS 15.3.1 Memory: 64 GiB Architecture: aarch64

Additional info.

Turborepo monorepo, pnpm, nextjs.

For instance I see an error like in a tailwind config file using commonjs:

Image

that is ignored in eslint settings for all projects in this monorepo.

Just guessing here, but I would think that this thing is:

  1. zed doesn't work with a monorepo but somehow tries to find a eslint config in root (I don't have one, but each separate package has its own)
  2. Since it can't it still runs with some defaults which are not fit?

Is there a way I can point out to zed how to run eslint? I mean I have a script in my root:

"lint:check": "pnpm run check-types && next lint",

That goes via next.js's cli honoring the eslint settings in each module…?

Maybe this is not a bug but as intended and I'm just not findings the docs…?

hedefalk avatar Mar 21 '25 14:03 hedefalk

Or is it that the eslint lang service for each file traverses down until it hits a config file? And for this particular one doesn't find one? But it should since its in actually just next to one… Hm…

hedefalk avatar Mar 21 '25 14:03 hedefalk

Have you seen this issue?

  • https://github.com/zed-industries/zed/issues/9755

besendorf avatar Apr 01 '25 01:04 besendorf

Can you provide an example which reproduces what your seeing? Either an open source monorepo or a minimal set of sets to reproduce?

notpeter avatar Apr 15 '25 15:04 notpeter

I have created a reproducer with ESLint 9 and flat config: https://github.com/praseodym/zed-eslint-monorepo-reproducer/tree/eslint-9-flat-config

See the README.md in the repository for more details. I've posted a variant for ESLint 8 without flat config in https://github.com/zed-industries/zed/issues/9755#issuecomment-2886443175.

praseodym avatar May 16 '25 13:05 praseodym

Up! I can't currently use eslintv9 with Zed, it throws an error

purpshell avatar Jul 17 '25 13:07 purpshell

Hi there! 👋 We're working to clean up our issue tracker by closing older bugs that might not be relevant anymore. If you are able to reproduce this issue in the latest version of Zed, please let us know by commenting on this issue, and it will be kept open. If you can't reproduce it, feel free to close the issue yourself. Otherwise, it will close automatically in 14 days. Thanks for your help!

github-actions[bot] avatar Nov 19 '25 09:11 github-actions[bot]

This still happening.

andirsun avatar Nov 19 '25 11:11 andirsun