求一个标准的typescript+react+eslint可用强大配置~

求一个标准的 typescript+react+eslint 可用强大开发配置,对elisp还不是很懂,自己配置了很久都不成功,没有达到目的,望有经验的大佬指点指点

流行的是flycheck,现在都用eslint,见 https://www.flycheck.org/en/latest/languages.html#javascript

eslint的配置无非就是装 GitHub - typescript-eslint/typescript-eslint: Monorepo for all the tooling which enables ESLint to support TypeScript

我不用flycheck,所以它的具体配置你得看文档。

如果你用flymake-mode并且对eslint的命令行有点基本知识的话,配置极其简单,就是设置一下flymake-allowed-file-name-masks,

(defun my-flymake-eslint-init ()
  "Eslint syntax check init."
  (let* ((dir (locate-dominating-file default-directory "node_modules"))
         (local-eslint (concat dir "node_modules/.bin/eslint"))
         (program (if dir (concat dir "node_modules/.bin/eslint") "eslint")))
    (when (executable-find program)
      (list program
            (list "-f" "unix" buffer-file-name)))))

(push '("\\.ts$" my-flymake-eslint-init) flymake-allowed-file-name-masks)
1 个赞

为啥要在开发的时候用 eslint 呢?想写成啥样就啥样,提交的时候配置 prettier eslint 格式化就完事了。我就是这样干的。