UNPKG

5.79 kBMarkdownView Raw
1# Eslint Watch
2[![](https://nodei.co/npm/eslint-watch.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/eslint-watch) [![](https://nodei.co/npm-dl/eslint-watch.png?months=6&height=3)](https://www.npmjs.com/package/eslint-watch)
3
4[![](https://img.shields.io/badge/release-notes-blue.svg)](https://github.com/rizowski/eslint-watch/releases/latest)
5[![Build Status](https://travis-ci.org/rizowski/eslint-watch.svg?branch=master)](https://travis-ci.org/rizowski/eslint-watch)
6[![Code Climate](https://codeclimate.com/github/rizowski/eslint-watch/badges/gpa.svg)](https://codeclimate.com/github/rizowski/eslint-watch)
7[![Test Coverage](https://codeclimate.com/github/rizowski/eslint-watch/badges/coverage.svg)](https://codeclimate.com/github/rizowski/eslint-watch/coverage)
8[![Reference Status](https://www.versioneye.com/nodejs/eslint-watch/reference_badge.svg?style=flat-square)](https://www.versioneye.com/nodejs/eslint-watch/references)
9
10Donate:
11 - (Ƀitcoin): `13V7iDxBhnFASw7avGGRk64ExDGTirhx37`
12 - (PayPal): [https://www.paypal.me/rizowski](https://www.paypal.me/rizowski)
13
14Don't want to import Webpack, Grunt, or some other task package into your project? Then this is the tool for you.
15Eslint Watch is a simple command line tool that wraps [Eslint](https://www.npmjs.com/package/eslint). Eslint Watch provides file watching and command line improvements to the currently existing Eslint command line interface. All commands that Eslint offers can be used with the addition of a watch command and a couple new templating views. Don't believe me? Checkout the [code](https://github.com/rizowski/eslint-watch) or some of the features below!
16
17## Requirements
18To use this tool we require eslint to be installed on your project. The versions supported are:
19 - `"eslint": ">=0.19.0 <5.0.0"`
20 - `node >= 4.0.0`
21 - Note: Node v8 could be temperamental and is not currently tested for this project.
22
23## Getting started
24To run eslint-watch without the global install, make an npm script.
25
26### NPM 2
27 - `npm i -g eslint-watch` or `npm i -D eslint-watch`
28
29### NPM 3
30 - `npm i -g eslint eslint-watch` or `npm i -D eslint eslint-watch`
31
32## Features added
33 - Watching
34 - Multi-directory watching
35 - Runs a full directory lint before the watch
36 - Press `enter` to rerun directory lint while watching
37 - Eslint Overrides
38 - Default directory linting. A directory is no longer required.
39 - [Simple formatters](#new-formatters)
40 - simple-detail (default)
41 - simple
42 - simple-success
43
44## Options/Usage
45Eslint-Watch replaces only a few commands that it needs to take control over. All other commands are forwarded to Eslint unmodified. Please refer to their help text for full command support as the one provided below might not be up to date with the latest Eslint changes.
46```
47esw [options] [file.js ...] [dir ...]
48
49Options:
50 -h, --help Show help
51 -f, --format String Use a specific output format - default: simple-detail
52 -w, --watch Enable file watch
53 --changed Enables single file linting while watch is enabled
54 --clear Clear terminal when running lint
55 --esw-version Prints Eslint-Watch's Version
56 -c, --config path::String Use configuration from this file or shareable config
57 --no-eslintrc Disable use of configuration from .eslintrc
58 --env [String] Specify environments
59 --ext [String] Specify JavaScript file extensions - default: .js
60 --global [String] Define global variables
61 --parser String Specify the parser to be used
62 --parser-options Object Specify parser options
63 --cache Only check changed files - default: false
64 --cache-file path::String Path to the cache file. Deprecated: use --cache-location - default: .eslintcache
65 --cache-location path::String Path to the cache file or directory
66 --rulesdir [path::String] Use additional rules from this directory
67 --plugin [String] Specify plugins
68 --rule Object Specify rules
69 --ignore-path path::String Specify path of ignore file
70 --no-ignore Disable use of ignore files and patterns
71 --ignore-pattern [String] Pattern of files to ignore (in addition to those in .eslintignore)
72 --stdin Lint code provided on <STDIN> - default: false
73 --stdin-filename String Specify filename to process STDIN as
74 --quiet Report errors only - default: false
75 --max-warnings Int Number of warnings to trigger nonzero exit code - default: -1
76 -o, --output-file path::String Specify file to write report to
77 --color, --no-color Force enabling/disabling of color
78 --init Run config initialization wizard - default: false
79 --fix Automatically fix problems
80 --debug Output debugging information
81 -v, --version Output the version number
82 --no-inline-config Prevent comments from changing config or rules
83 --print-config path::String Print the configuration for the given file
84```
85
86### Other Options
87
88Eslint-Watch uses [`chokidar`](https://github.com/paulmillr/chokidar) under the hood to watch for changes. Chokidar can be configured to poll for changes (this might be necessary if you are running Eslint-Watch inside a VM or Container) by setting the `CHOKIDAR_USEPOLLING` environment variable to `true`.
89
90## Functionality
91[![Simple lint and watch](http://i.imgur.com/Sa6P36F.gif)](https://asciinema.org/a/byo40shx39nbiw54zwf4nv94j)
92
93## New Formatters
94[![simple simple-success simple-detail](http://i.imgur.com/m757NwM.png)](http://i.imgur.com/m757NwM.png)