2016-06-15 55 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