我是spacemacs的新手,我按照指南https://github.com/syl20bnr/spacemacs/tree/master/layers/%2Bframeworks/react 。如何在Spacemacs中使用本地.eslintrc?
除了eslinter不使用本地.eslintrc以外,一切正常。
它適用於Atom編輯器,Sublime Text 3,VSCode。我不知道爲什麼。
任何人都可以幫助我嗎?
謝謝。
我是spacemacs的新手,我按照指南https://github.com/syl20bnr/spacemacs/tree/master/layers/%2Bframeworks/react 。如何在Spacemacs中使用本地.eslintrc?
除了eslinter不使用本地.eslintrc以外,一切正常。
它適用於Atom編輯器,Sublime Text 3,VSCode。我不知道爲什麼。
任何人都可以幫助我嗎?
謝謝。
只是使用子彈(已包含在spacemacs中)來查找.eslintrc
。
(defun codefalling//reset-eslint-rc()
(let ((rc-path (if (projectile-project-p)
(concat (projectile-project-root) ".eslintrc"))))
(if (file-exists-p rc-path)
(progn
(message rc-path)
(setq flycheck-eslintrc rc-path)))))
(add-hook 'flycheck-mode-hook 'codefalling//reset-eslint-rc)
我使用的是Mac安裝程序,這是爲我工作:
假設你installed eslint,你可以在你~/.spacemacs
file
使syntax checking通過鍵入開始SPC f e d
and uncommenting syntax-checking
;; spell-checking
syntax-checking
SPC f e R
.eslintrc
SPC e v
從這裏可以確認Javascript成爲eslint已啓用,並且已爲您的項目檢測到.eslintrc
。
這裏的問題在於,如果您在全局範圍內安裝了您的依賴項,這將僅適用。這意味着將使用本地'.eslintrc',但對於像'{「擴展」:「some-preset」}'的東西,您將需要全部安裝'some-preset'的所有依賴關係。 – heyarne