reddit / emacs

Lsp eslint ignores .eslintrc

PawarShubham3007 · 2022-05-02 11:34
I've followed this [guide](https://emacs-lsp.github.io/lsp-mode/tutorials/reactjs-tutorial/) on how to setup lsp-mode with javascript and eslint.(I know its for react but same principles can be applied). This issue I'm facing it that lsp eslint ignores my <rootDir>/.eslintrc settings &#x200B; [You can see semi colon error is off but emacs lsp suggest otherwise](https://preview.redd.it/3diqiakas1x81.png?width=1889&format=png&auto=webp&s=652ac25be764cc1b3bf1fface7453eaab90ff81d) &#x200B; [Upon adding semi colon errors go away.](https://preview.redd.it/25a1d4als1x81.png?width=695&format=png&auto=webp&s=985106aa9bad84c7a603612cf69e123761297a6b) My setup (use-package flycheck :hook (prog-mode . flycheck-mode) :preface (defun my/typescript-mode-setup () "Custom setup for Typescript mode" (setq flycheck-checker #'javascript-eslint)) :config (add-hook 'typescript-mode-hook #'my/typescript-mode-setup) (general-define-key :states 'normal :keymaps 'flycheck-mode-map "] g" '(flycheck-next-error :which-key "Next error") "[ g" '(flycheck-previous-error :which-key "Prev error"))) (use-package lsp-mode :commands (lsp lsp-deferred) :hook (prog-mode . lsp-mode) :init (setq lsp-keymap-prefix "C-l" lsp-completion-provider :none) :custom (lsp-disabled-clients '((python-mode . pyls))) (lsp-eslint-run "onSave") (lsp-eslint-auto-fix-on-save t) :config (lsp-enable-which-key-integration t)) I've installed eslint using `npm i -g eslint` as well as `lsp-install-server`. The `flycheck-checker` is set 'lsp. System Info: Emacs : 29.0.50 npm: 8.6.0 eslint: v8.14.0
genehack · 2022-05-03 16:16
If you run `eslint` in a terminal from the root of your project, do you see these errors? What does `M-x flycheck-verify-checker` tell you?
PawarShubham3007 · 2022-05-03 16:40
> npx eslint library.int__demo.js /home/shubham/Projects/INT/integration-framework/configuration/env/scripts/js/library.int__demo.js 1:8 warning 'logger' is defined but never used no-unused-vars ✖ 1 problem (0 errors, 1 warning) `flycheck-verify-checker` gives green signal for lsp as well as javascript-eslint
genehack · 2022-05-05 07:29
You said in your post: > I've installed eslint using `npm i -g eslint` but you checked with `npx eslint` -- which will run the eslint installed in the `node_modules` in your project. Try running the `eslint` that's in your $PATH from the global NPM install and see if you get the same result? (And I apologize if this doesn't make a difference -- but it seems pretty clear to me the issue here is the eslint that's getting invoked by flycheck isn't seeing your config for some reason; trying to figure out ways that might happen.)
PawarShubham3007 · 2022-05-05 07:48
Yes that too didn't fix things. I'm actually using a package add_node_modules_to_path