2016-06-15 107 views

回答

2

只是使用子彈(已包含在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) 
3

我使用的是Mac安裝程序,這是爲我工作:

假設你installed eslint,你可以在你~/.spacemacsfile


使syntax checking通過鍵入開始SPC f e d and uncommenting syntax-checking

;; spell-checking 
syntax-checking 
  • 通過鍵入SPC f e R
  • 在你的項目中打開一個JavaScript文件重新同步你的設置,它應該有它的根
  • 類型的.eslintrcSPC e v

從這裏可以確認Javascript成爲eslint已啓用,並且已爲您的項目檢測到.eslintrc

+0

這裏的問題在於,如果您在全局範圍內安裝了您的依賴項,這將僅適用。這意味着將使用本地'.eslintrc',但對於像'{「擴展」:「some-preset」}'的東西,您將需要全部安裝'some-preset'的所有依賴關係。 – heyarne