[英]How can I use local .eslintrc in Spacemacs?
I am new to spacemacs and I follow the guides in https://github.com/syl20bnr/spacemacs/tree/master/layers/%2Bframeworks/react . 我是spacemacs的新手,我按照https://github.com/syl20bnr/spacemacs/tree/master/layers/%2Bframeworks/react中的指南进行操作。
Everything works well except the eslinter do not use the local .eslintrc . 一切都很好,除了eslinter不使用本地.eslintrc。
It works on Atom Editor, Sublime Text 3, VSCode. 它适用于Atom Editor,Sublime Text 3,VSCode。 I don't know why.
我不知道为什么。
Can anyone help me ? 谁能帮我 ?
Thanks. 谢谢。
I'm running a mac setup, this is what worked for me: 我正在运行mac设置,这对我有用:
assuming you've installed eslint , you can enable syntax checking in your ~/.spacemacs
file 假设您已经安装了eslint ,您可以在
~/.spacemacs
文件中启用语法检查
Begin by typing SPC fed
and uncommenting syntax-checking
首先输入
SPC fed
和取消注释syntax-checking
;; spell-checking
syntax-checking
SPC fe R
SPC fe R
同步您的配置 .eslintrc
in its root .eslintrc
SPC ev
SPC ev
From here you can confirm that javascript-eslint is enabled and that an .eslintrc
has been detected for your project. 从这里您可以确认已启用javascript-eslint并且已检测到项目的
.eslintrc
。
Just use projectile(which is already included in spacemacs) to find .eslintrc
. 只需使用射弹(已经包含在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)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.