typescript-eslint-language-service icon indicating copy to clipboard operation
typescript-eslint-language-service copied to clipboard

Error: No ESLint configuration found in /home/user/myapp/src/ts despite having an eslint.config.mjs in an ancestor directory

Open HaraldKi opened this issue 9 months ago • 2 comments

current situation

Using the plugin for tsserver, I get the following error:

Info 23   [12:27:58.566] [typescript-eslint-language-service] Error: No ESLint configuration found in /home/harald/work/dailynotes/src/main/ts.
    at CascadingConfigArrayFactory._finalizeConfigArray (/home/harald/work/dailynotes/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:4086:19)
    at CascadingConfigArrayFactory.getConfigArrayForFile (/home/harald/work/dailynotes/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3877:21)
    at ESLintConfigProvider.getConfigArrayForFile (/home/harald/work/dailynotes/node_modules/typescript-eslint-language-service/lib/eslint-config-provider.js:45:29)
... [clipped for brevity]

This despite the fact that eslint runs just fine when used with vscode. Though I try to use the setup with a differing language-server aware client.

More configuration details:

  • eslint.config.mjs is in /home/harald/work/dailynotes, i.e. in a parent directory of where the log complains
  • I verified that the working directory of the tsserver is this directory.
  • Further tsserver logs: Creating ConfiguredProject: /home/harald/work/dailynotes/tsconfig.json, currentDirectory: /home/harald/work/dailynotes, another hint that the project root is well understood.

versions

├── @typescript-eslint/[email protected]
├── @typescript-eslint/[email protected]
├── [email protected]
├── [email protected]
└── [email protected]

expected behavior

My expectation would be that the configuration file would be lookup up, among other places, at least in the project's root directory. Hints welcome, if I am doing this wrong.

HaraldKi avatar Feb 24 '25 14:02 HaraldKi

Weirdly, when I use strace to see which files are looked at, I see

13990 statx(AT_FDCWD, "/home/harald/work/dailynotes/eslint.config.mjs", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_ALL|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0664, stx_size=1679, ...}) = 0

which would be just right. 😕

HaraldKi avatar Feb 24 '25 14:02 HaraldKi

Hmm, digging more into this, I see the stackt trace above coming from code eslintrc.cjs using the the configFilenames which are "old-style", i.e. pre version 9.

It seems either this plugin is not yet compatible with eslint@9, which uses only eslint.config.* files for configuration, or I am missing a trick to tell it how to use the newer eslint version?

HaraldKi avatar Feb 24 '25 14:02 HaraldKi