Makes eslint the fastest linter on the planet.
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.
This will install the eslint_d
command globally:
$ npm install -g eslint_d
To start the server and lint a file, just run:
$ eslint_d file.js
On the initial call, the eslint_d
server is launched and then the given file
is linted. Subsequent invocations are super fast.
Control the server like this:
$ eslint_d <command>
Available commands:
start
: start the serverstop
: stop the serverstatus
: print out whether the server is currently runningrestart
: restart the server[options] file.js [file.js] [dir]
: invokeeslint
with the given options. Theeslint
engine will be created in the current directory. If the server is not yet running, it is started.
Type eslint_d --help
to see the supported eslint
options.
eslint_d
will select a free port automatically and store the port number
along with an access token in ~/.eslint_d
.
-
Sublime: Check out SublimeLinter-contrib-eslint_d.
-
Vim: Install the syntastic plugin, then make sure this is in your
.vimrc
:let g:syntastic_javascript_checkers = ['eslint'] let g:syntastic_javascript_eslint_exec = 'eslint_d'
-
WebStorm: Configure your IDE to point to the
eslint_d
package instead ofeslint
. In the ESLint configuration dialog, under 'ESLint package', select youreslint_d
package. -
Atom: You will not gain any performance from this module as it already avoids starting a new node instance and uses the API directly (see this AtomLinter issue).
-
Emacs: Use flycheck with the
javascript-eslint
checker:(setq flycheck-javascript-eslint-executable "eslint_d")
If you're using eslint_d
in any other editor, please tell me!
If you're really into performance and want the lowest possible latency, talk to
the eslint_d
server with netcat. This will also eliminate the node.js startup
time.
$ PORT=`cat ~/.eslint_d | cut -d" " -f1`
$ TOKEN=`cat ~/.eslint_d | cut -d" " -f2`
$ echo "$TOKEN $PWD file.js" | nc localhost $PORT
This runs eslint
in under 50ms
!
Tip For additional speed, did you know that you can lint only files that
have changed? This is a feature of normal eslint
, but it also works from
eslint_d
. Run:
$ eslint_d . --cache
eslint_d
runs serperate instances of eslint each working directory, (see here) for more details.
However should the .eslintrc
change after the server has already been started, you can manually reload the configuration by running eslint_d restart
in the working directory.
4.0.0
: eslint 3.0+3.0.0
: eslint 2.2+1.0.0
,2.0.0
: eslint 1.4+
MIT