You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update ESLint to 3.0.0. This includes an enhancement to `no-unused-vars`
such that it finds a few instances in our code base that it did not find
previously (fixed in previous commits readying this for landing).
PR-URL: #7601
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
Copy file name to clipboardexpand all lines: tools/eslint/README.md
+97-36
Original file line number
Diff line number
Diff line change
@@ -24,21 +24,53 @@ ESLint is a tool for identifying and reporting on patterns found in ECMAScript/J
24
24
* ESLint uses an AST to evaluate patterns in code.
25
25
* ESLint is completely pluggable, every single rule is a plugin and you can add more at runtime.
26
26
27
-
## Installation
27
+
## Installation and Usage
28
28
29
-
You can install ESLint using npm:
29
+
There are two ways to install ESLint: globally and locally.
30
30
31
-
npm install -g eslint
31
+
### Local Installation and Usage
32
32
33
-
## Usage
33
+
If you want to include ESLint as part of your project's build system, we recommend installing it locally. You can do so using npm:
34
34
35
-
If it's your first time using ESLint, you should set up a config file using `--init`:
35
+
```
36
+
$ npm install eslint --save-dev
37
+
```
38
+
39
+
You should then setup a configuration file:
40
+
41
+
```
42
+
$ ./node_modules/.bin/eslint --init
43
+
```
44
+
45
+
After that, you can run ESLint on any file or directory like this:
46
+
47
+
```
48
+
$ ./node_modules/.bin/eslint yourfile.js
49
+
```
50
+
51
+
Any plugins or shareable configs that you use must also be installed locally to work with a locally-installed ESLint.
52
+
53
+
### Global Installation and Usage
36
54
37
-
eslint --init
55
+
If you want to make ESLint available to tools that run across all of your projects, we recommend installing ESLint globally. You can do so using npm:
38
56
39
-
After that, you can run ESLint on any JavaScript file:
57
+
```
58
+
$ npm install -g eslint
59
+
```
40
60
41
-
eslint test.js test2.js
61
+
You should then setup a configuration file:
62
+
63
+
```
64
+
$ eslint --init
65
+
```
66
+
67
+
After that, you can run ESLint on any file or directory like this:
68
+
69
+
```
70
+
$ eslint yourfile.js
71
+
```
72
+
73
+
Any plugins or shareable configs that you use must also be installed globally to work with a globally-installed ESLint.
42
74
43
75
**Note:**`eslint --init` is intended for setting up and configuring ESLint on a per-project basis and will perform a local installation of ESLint and its plugins in the directory in which it is run. If you prefer using a global installation of ESLint, any plugins used in your configuration must also be installed globally.
44
76
@@ -55,7 +87,7 @@ After running `eslint --init`, you'll have a `.eslintrc` file in your directory.
55
87
}
56
88
```
57
89
58
-
The names `"semi"` and `"quotes"` are the names of [rules](http://eslint.org/docs/rules) in ESLint. The number is the error level of the rule and can be one of the three values:
90
+
The names `"semi"` and `"quotes"` are the names of [rules](http://eslint.org/docs/rules) in ESLint. The first value is the error level of the rule and can be one of these values:
59
91
60
92
*`"off"` or `0` - turn the rule off
61
93
*`"warn"` or `1` - turn the rule on as a warning (doesn't affect exit code)
@@ -65,31 +97,40 @@ The three error levels allow you fine-grained control over how ESLint applies ru
65
97
66
98
## Sponsors
67
99
68
-
* Development is sponsored by [Box](https://box.com)
69
100
* Site search ([eslint.org](http://eslint.org)) is sponsored by [Algolia](https://www.algolia.com)
70
101
71
102
## Team
72
103
73
-
These folks keep the project moving and are resources for help:
74
-
75
-
* Nicholas C. Zakas ([@nzakas](https://github.com/nzakas)) - project lead
@@ -104,15 +145,35 @@ Before filing an issue, please be sure to read the guidelines for what you're re
104
145
*[Proposing a Rule Change](http://eslint.org/docs/developer-guide/contributing/rule-changes)
105
146
*[Request a Change](http://eslint.org/docs/developer-guide/contributing/changes)
106
147
107
-
## Frequently Asked Questions
108
-
109
-
### Why don't you like JSHint???
148
+
## Semantic Versioning Policy
149
+
150
+
ESLint follows [semantic versioning](http://semver.org). However, due to the nature of ESLint as a code quality tool, it's not always clear when a minor or major version bump occurs. To help clarify this for everyone, we've defined the following semantic versioning policy for ESLint:
151
+
152
+
* Patch release (intended to not break your lint build)
153
+
* A bug fix in a rule that results in ESLint reporting fewer errors.
154
+
* A bug fix to the CLI or core (including formatters).
155
+
* Improvements to documentation.
156
+
* Non-user-facing changes such as refactoring code, adding, deleting, or modifying tests, and increasing test coverage.
157
+
* Re-releasing after a failed release (i.e., publishing a release that doesn't work for anyone).
158
+
* Minor release (might break your lint build)
159
+
* A bug fix in a rule that results in ESLint reporting more errors.
160
+
* A new rule is created.
161
+
* A new option to an existing rule is created.
162
+
* An existing rule is deprecated.
163
+
* A new CLI capability is created.
164
+
* New capabilities to the public API are added (new classes, new methods, new arguments to existing methods, etc.).
165
+
* A new formatter is created.
166
+
* Major release (likely to break your lint build)
167
+
*`eslint:recommended` is updated.
168
+
* An existing rule is removed.
169
+
* An existing formatter is removed.
170
+
* Part of the public API is removed or changed in an incompatible way.
110
171
111
-
I do like JSHint. And I like Anton and Rick. Neither of those were deciding factors in creating this tool. The fact is that I've had a dire need for a JavaScript tool with pluggable linting rules. I had hoped JSHint would be able to do this, however after chatting with Anton, I found that the planned plugin infrastructure wasn't going to suit my purpose.
172
+
## Frequently Asked Questions
112
173
113
-
### I'm not giving up JSHint for this!
174
+
### How is ESLint different from JSHint?
114
175
115
-
That's not really a question, but I got it. I'm not trying to convince you that ESLint is better than JSHint. The only thing I know is that ESLint is better than JSHint for what I'm doing. In the off chance you're doing something similar, it might be better for you. Otherwise, keep using JSHint, I'm certainly not going to tell you to stop using it.
176
+
The most significant difference is that ESlint has pluggable linting rules. That means you can use the rules it comes with, or you can extend it with rules created by others or by yourself!
116
177
117
178
### How does ESLint performance compare to JSHint?
0 commit comments