GithubHelp home page GithubHelp logo

ahutchings / eslint_d.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mantoni/eslint_d.js

0.0 1.0 0.0 54 KB

Makes eslint the fastest linter on the planet

License: MIT License

Makefile 1.95% JavaScript 98.05%

eslint_d.js's Introduction

eslint_d

SemVer License

Makes eslint the fastest linter on the planet.

"But eslint is pretty fast already, right?"

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.

Install

This will install the eslint_d command globally:

$ npm install -g eslint_d

Usage

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.

Commands

Control the server like this:

$ eslint_d <command>

Available commands:

  • start: start the server
  • stop: stop the server
  • status: print out whether the server is currently running
  • restart: restart the server
  • [options] file.js [file.js] [dir]: invoke eslint with the given options. The eslint 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 in ~/.eslint_d_port.

Editor integration

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 of eslint. In the ESLint configuration dialog, under 'ESLint package', select your eslint_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).

If you're using eslint_d in any other editor, please tell me!

Moar speed

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.

$ echo '. file.js' | nc localhost `cat ~/.eslint_d_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

Compatibility

  • 3.0.0: eslint 2.2+
  • 1.0.0, 2.0.0: eslint 1.4+

License

MIT

eslint_d.js's People

Contributors

mantoni avatar doctyper avatar clessg avatar ruanyl avatar bebraw avatar yuezk avatar matz3 avatar netei avatar

Watchers

Andrew Hutchings avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.