なっく日報

技術やら生活やらのメモ

eslint_d.jsでESLintを爆速にする

github.com

いうものがあるのを知りました。

eslint_dというプロセスを常駐させて、ESLintを爆速にするものらしい。

公式ドキュメント曰く、

Yes, it's actually super fast. But the node.js startup time and loading all the required modules slows down linting times for a single file to ~700 milliseconds. eslint_d reduces this overhead by running a server in the background. It brings the linting time down to ~160 milliseconds. If you want to lint from within your editor whenever you save a file, eslint_d is for you.

700msかかっていたのが160ms以下になったと。

試してみた

インストール

常駐するので、グローバルに入れます

npm i -g eslint_d

実行!

実行すると勝手にプロセスが常駐します

eslint_d src

停止

プロセスが起動し続けるので、不要な場合、手動で止めないといけません

eslint_d stop

感想

ファイル数が多いと確かに早いです

が、正直そんなに困っていないし、eslintに--cacheオプションもあるし、そこまで必要ないかなと思いました

ちなみにtime eslint_d srcとかで測ってみたんですが、どうも値が変なので公開はしません

タイトルで煽ったほど爆速にはなりませんでした🙇

おまけ

Syntastic.vimの設定で

let g:syntastic_javascript_checkers = ['eslint']
let g:syntastic_javascript_eslint_exec = 'eslint_d'

みたいに別の実行ファイルを指定できるというのを知ったのが一番の収穫でした