【发布时间】:2022-10-05 03:06:11
【问题描述】:
我经常使用 rgrep 来查找我需要更改的文件,然后使用宏来浏览这些文件,进行更改并保存。这是一个非常简洁的流程,但有一个缺点:我在保存时对每个文件进行了更漂亮的检查,而 flycheck(使用 eslint)也变得非常疯狂,并且最大限度地利用了我的 CPU。
所以我想知道,是否有任何好的方法可以全局(因为我的宏访问很多文件)暂时禁用(因为我希望在宏完成后使用这些模式)某些模式,最重要的是 flycheck?
我没有找到任何相关的东西,关于如何做到这一点的任何想法?
编辑:
这就是我加载flycheck的方式,例如在 rjsx 模式下:
;; disable jshint since we prefer eslint checking
(setq-default flycheck-disabled-checkers
(append flycheck-disabled-checkers
\'(javascript-jshint)))
;; disable json-jsonlist checking for json files
(setq-default flycheck-disabled-checkers
(append flycheck-disabled-checkers
\'(json-jsonlist)))
;; use eslint with web-mode for jsx files
(defun my/use-eslint-from-node-modules ()
(let* ((root (locate-dominating-file
(or (buffer-file-name) default-directory)
\"node_modules\"))
(eslint (and root
(expand-file-name \"node_modules/eslint/bin/eslint.js\"
root))))
(when (and eslint (file-executable-p eslint))
(setq-local flycheck-javascript-eslint-executable eslint))))
(add-hook \'flycheck-mode-hook #\'my/use-eslint-from-node-modules)
(flycheck-add-mode \'javascript-eslint \'rjsx-mode)
(这里有完整的 emacs 配置:https://github.com/phuhl/sheeshmacs)
谢谢
-
只是一个建议,请在这里发布您的问题:) https://emacs.stackexchange.com/
-
由于默认情况下未启用(甚至未安装)flycheck,因此请展示您的情况启用首先是这些文件,然后有人可能会提供帮助。
-
@phils,好点,我将它添加到问题中
标签: emacs macros eslint flycheck