Skip to content
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

Typescript layer: No ESLint configuration found in project after explicitly setting exec-path with project path to ESLint #16307

Open
noelweichbrodt opened this issue Mar 8, 2024 · 2 comments
Assignees

Comments

@noelweichbrodt
Copy link

LSP :: Connected to [eslint:71271/starting /Users/noel/w/project].
LSP :: eslint:71271 initialized successfully in folders: (/Users/noel/w/project)
LSP :: Error from the Language Server: Request textDocument/codeAction failed with message: No ESLint configuration found in /Users/noel/w/project/pages/api/auth. (Internal Error)

I found #10131, which seemed like it directly addressed my issue, so I followed the solution there to utilize add-node-modules-path to load the project's local ESLint, however the error persisted. I tried explicitly setting (setq exec-path (append '("/Users/noel/w/project/node_modules/.bin") exec-path)), but the error persisted. Now I'm out of ideas 😓

Here's the flycheck-verify-setup:

Syntax checkers for buffer login.ts in typescript-mode:

First checker to run:

  lsp (explicitly selected)
    - may enable: yes
    - may run:    t

Checkers that could run if selected:

  typescript-tslint  select
    - may enable:         yes
    - executable:         Found at /usr/local/bin/tslint
    - configuration file: Not found

Checkers that are compatible with this mode, but will not run until properly configured:

  javascript-eslint (automatically disabled) reset
    - may enable:  no
    - executable:  Not found
    - config file: missing or incorrect

Flycheck Mode is enabled. Use M-m u M-m e d to enable disabled checkers.

--------------------

Flycheck version: 20240307.2106
Emacs version:    29.2
System:           aarch64-apple-darwin23.3.0
Window system:    ns

And for context, my config:

dotspacemacs-configuration-layers:

     (typescript :variables
                 typescript-fmt-on-save t
                 typescript-fmt-tool 'prettier
                 typescript-linter 'eslint)

user-config:

  (eval-after-load 'typescript-mode
    '(add-hook 'typescript-mode-hook #'add-node-modules-path))

Finally, for the paranoid, there is in fact ESLint installed in the project:

% /Users/noel/w/project/node_modules/.bin/eslint --version
v8.57.0

…and in javascript mode flycheck can find it:

Syntax checkers for buffer eslint.config.js in js2-mode:

First checker to run:

  lsp (explicitly selected)
    - may enable: yes
    - may run:    t

Checkers that could run if selected:

  javascript-eslint  select
    - may enable:  yes
    - executable:  Found at /Users/noel/w/project/node_modules/.bin/eslint
    - config file: found

  javascript-standard  select
    - may enable: yes
    - executable: Found at /usr/local/bin/standard

Checkers that are compatible with this mode, but will not run until properly configured:

  javascript-jshint (automatically disabled) reset
    - may enable:         no
    - executable:         Not found
    - configuration file: Not found

Flycheck Mode is enabled. Use M-m u M-m e d to enable disabled checkers.

--------------------

Flycheck version: 20240307.2106
Emacs version:    29.2
System:           aarch64-apple-darwin23.3.0
Window system:    ns
@noelweichbrodt
Copy link
Author

noelweichbrodt commented Mar 11, 2024

Inexplicable update: after restarting (SPC q r) a couple of times to disable typescript layer entirely and then put it back in, I'm now seeing this in tsx files:

Syntax checkers for buffer Login.tsx in typescript-tsx-mode:

First checker to run:

  lsp (explicitly selected)
    - may enable: yes
    - may run:    t

Checkers that could run if selected:

  javascript-eslint  select
    - may enable:  yes
    - executable:  Found at /Users/noel/w/project/node_modules/.bin/eslint
    - config file: found

Flycheck Mode is enabled. Use M-m u M-m e d to enable disabled checkers.

--------------------

Flycheck version: 20240307.2106
Emacs version:    29.2
System:           aarch64-apple-darwin23.3.0
Window system:    ns

So of course, I select javascript-eslint:

Syntax checkers for buffer LoginForm.tsx in typescript-tsx-mode:

First checker to run:

  javascript-eslint (explicitly selected)
    - may enable:  yes
    - executable:  Found at /Users/noel/w/project/node_modules/.bin/eslint
    - config file: found

Checkers that could run if selected:

  lsp  select
    - may enable: yes
    - may run:    t

Flycheck Mode is enabled. Use M-m u M-m e d to enable disabled checkers.

--------------------

Flycheck version: 20240307.2106
Emacs version:    29.2
System:           aarch64-apple-darwin23.3.0
Window system:    ns

However, any flycheck action still shows the same error as above:
LSP :: Error from the Language Server: Request textDocument/codeAction failed with message: No ESLint configuration found in /Users/noel/w/project/app/login/components. (Internal Error)

And of course, if I remove my explicit setq exec-path for the project, flycheck is not longer able to find the eslint executable or project config:

Syntax checkers for buffer LoginForm.tsx in typescript-tsx-mode:

First checker to run:

  lsp (explicitly selected)
    - may enable: yes
    - may run:    t

Checkers that are compatible with this mode, but will not run until properly configured:

  javascript-eslint (automatically disabled) reset
    - may enable:  no
    - executable:  Not found
    - config file: missing or incorrect

Flycheck Mode is enabled. Use M-m u M-m e d to enable disabled checkers.

--------------------

Flycheck version: 20240307.2106
Emacs version:    29.2
System:           aarch64-apple-darwin23.3.0
Window system:    ns

@smile13241324 smile13241324 self-assigned this Mar 30, 2024
@diegotsutsumi
Copy link

Might be related to this

emacs-lsp/lsp-mode#4341

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants