Skip to content

Commit d91e10b

Browse files
committed
tools: update eslint to 0.24.0
PR-URL: #2072 Reviewed-By: Yosuke Furukawa <[email protected]> Reviewed-by: Colin Ihrig <[email protected]> Reviewed-By: Alex Kocharin <[email protected]>
1 parent 1a51f00 commit d91e10b

File tree

1,046 files changed

+101443
-4656
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,046 files changed

+101443
-4656
lines changed

tools/eslint/README.md

+35-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![Test coverage][coveralls-image]][coveralls-url]
44
[![Downloads][downloads-image]][downloads-url]
55
[![Bountysource](https://www.bountysource.com/badge/tracker?tracker_id=282608)](https://www.bountysource.com/trackers/282608-eslint?utm_source=282608&utm_medium=shield&utm_campaign=TRACKER_BADGE)
6+
[![Join the chat at https://gitter.im/eslint/eslint](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/eslint/eslint?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
67

78
# ESLint
89

@@ -22,8 +23,26 @@ You can install ESLint using npm:
2223

2324
## Usage
2425

26+
If it's your first time using ESLint, you should set up a config file using `--init`:
27+
28+
eslint --init
29+
30+
After that, you can run ESLint on any JavaScript file:
31+
2532
eslint test.js test2.js
2633

34+
## Team
35+
36+
These folks keep the project moving and are resources for help:
37+
38+
* Nicholas C. Zakas ([@nzakas](https://github.com/nzakas)) - project lead
39+
* Ilya Volodin ([@ilyavolodin](https://github.com/ilyavolodin)) - reviewer
40+
* Brandon Mills ([@btmills](https://github.com/btmills)) - reviewer
41+
* Mathias Schreck ([@lo1tuma](https://github.com/lo1tuma)) - committer
42+
* Gyandeep Singh ([@gyandeeps](https://github.com/gyandeeps)) - committer
43+
* Jamund Ferguson ([@xjamundx](https://github.com/xjamundx)) - committer
44+
45+
2746
## Frequently Asked Questions
2847

2948
### Why don't you like JSHint???
@@ -34,12 +53,16 @@ I do like JSHint. And I like Anton and Rick. Neither of those were deciding fact
3453

3554
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.
3655

37-
### How does ESLint performance compare to JSHint?
56+
### How does ESLint performance compare to JSHint and JSCS?
3857

3958
ESLint is slower than JSHint, usually 2-3x slower on a single file. This is because ESLint uses Espree to construct an AST before it can evaluate your code whereas JSHint evaluates your code as it's being parsed. The speed is also based on the number of rules you enable; the more rules you enable, the slower the process.
4059

4160
Despite being slower, we believe that ESLint is fast enough to replace JSHint without causing significant pain.
4261

62+
ESLint is faster than JSCS, as ESLint uses a single-pass traversal for analysis whereas JSCS using a querying model.
63+
64+
If you are using both JSHint and JSCS on your files, then using just ESLint will be faster.
65+
4366
### Is ESLint just linting or does it also check style?
4467

4568
ESLint does both traditional linting (looking for problematic patterns) and style checking (enforcement of conventions). You can use it for both.
@@ -50,6 +73,7 @@ The following projects are using ESLint to validate their JavaScript:
5073

5174
* [Drupal](https://www.drupal.org/node/2274223)
5275
* [Esprima](https://github.com/ariya/esprima)
76+
* [io.js](https://github.com/iojs/io.js/commit/f9dd34d301ab385ae316769b85ef916f9b70b6f6)
5377
* [WebKit](https://bugs.webkit.org/show_bug.cgi?id=125048)
5478

5579
In addition, the following companies are using ESLint internally to validate their JavaScript:
@@ -62,11 +86,19 @@ In addition, the following companies are using ESLint internally to validate the
6286

6387
### What about ECMAScript 6 support?
6488

65-
We are implementing ECMAScript 6 support piece-by-piece starting with version 0.12.0. You'll be able to opt-in to any ECMAScript 6 feature you want to use.
89+
ESLint has full support for ECMAScript 6. By default, this support is off. You can enable ECMAScript 6 support through [configuration](http://eslint.org/docs/user-guide/configuring).
90+
91+
### Does ESLint support JSX?
92+
93+
Yes, ESLint natively supports parsing JSX syntax (this must be enabled in [configuration](http://eslint.org/docs/user-guide/configuring).). Please note that supporting JSX syntax *is not* the same as supporting React. React applies specific semantics to JSX syntax that ESLint doesn't recognize. We recommend using [eslint-plugin-react](https://www.npmjs.com/package/eslint-plugin-react) if you are using React and want React semantics.
94+
95+
### What about ECMAScript 7/2016 and experimental features?
96+
97+
ESLint doesn't natively support experimental ECMAScript language features. You can use [babel-eslint](https://github.com/babel/babel-eslint) to use any option available in Babel.
6698

6799
### Where to ask for help?
68100

69-
Join our [Mailing List](https://groups.google.com/group/eslint)
101+
Join our [Mailing List](https://groups.google.com/group/eslint) or [Chatroom](https://gitter.im/eslint/eslint)
70102

71103

72104
[npm-image]: https://img.shields.io/npm/v/eslint.svg?style=flat-square

tools/eslint/bin/eslint.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#!/usr/bin/env node
22
var concat = require("concat-stream"),
3+
configInit = require("../lib/config-initializer"),
34
cli = require("../lib/cli");
45

56
var exitCode = 0,
6-
useStdIn = (process.argv.indexOf("--stdin") > -1);
7+
useStdIn = (process.argv.indexOf("--stdin") > -1),
8+
init = (process.argv.indexOf("--init") > -1);
79

810
if (useStdIn) {
911
process.stdin.pipe(concat({ encoding: "string" }, function(text) {
@@ -15,6 +17,17 @@ if (useStdIn) {
1517
exitCode = 1;
1618
}
1719
}));
20+
} else if (init) {
21+
configInit.initializeConfig(function(err) {
22+
if (err) {
23+
exitCode = 1;
24+
console.error(err.message);
25+
console.error(err.stack);
26+
} else {
27+
console.log("Successfully created .eslintrc file in " + process.cwd());
28+
exitCode = 0;
29+
}
30+
});
1831
} else {
1932
exitCode = cli.execute(process.argv);
2033
}

tools/eslint/conf/environments.js

+9
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ module.exports = {
2828
"handle-callback-err": [2, "err"]
2929
}
3030
},
31+
worker: {
32+
globals: globals.worker
33+
},
3134
amd: {
3235
globals: globals.amd
3336
},
@@ -52,6 +55,12 @@ module.exports = {
5255
meteor: {
5356
globals: globals.meteor
5457
},
58+
mongo: {
59+
globals: globals.mongo
60+
},
61+
applescript: {
62+
globals: globals.applescript
63+
},
5564
es6: {
5665
ecmaFeatures: {
5766
arrowFunctions: true,

tools/eslint/conf/eslint.json

+15-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"no-duplicate-case": 2,
3030
"no-else-return": 0,
3131
"no-empty": 2,
32-
"no-empty-class": 2,
32+
"no-empty-class": 0,
33+
"no-empty-character-class": 2,
3334
"no-empty-label": 2,
3435
"no-eq-null": 0,
3536
"no-eval": 2,
@@ -56,6 +57,7 @@
5657
"no-loop-func": 2,
5758
"no-mixed-requires": [0, false],
5859
"no-mixed-spaces-and-tabs": [2, false],
60+
"linebreak-style": [0, "unix"],
5961
"no-multi-spaces": 2,
6062
"no-multi-str": 2,
6163
"no-multiple-empty-lines": [0, {"max": 2}],
@@ -92,32 +94,41 @@
9294
"no-sync": 0,
9395
"no-ternary": 0,
9496
"no-trailing-spaces": 2,
97+
"no-this-before-super": 0,
9598
"no-throw-literal": 0,
9699
"no-undef": 2,
97100
"no-undef-init": 2,
98101
"no-undefined": 0,
102+
"no-unexpected-multiline": 0,
99103
"no-underscore-dangle": 2,
104+
"no-unneeded-ternary": 0,
100105
"no-unreachable": 2,
101106
"no-unused-expressions": 2,
102107
"no-unused-vars": [2, {"vars": "all", "args": "after-used"}],
103108
"no-use-before-define": 2,
104109
"no-void": 0,
105110
"no-var": 0,
111+
"prefer-const": 0,
106112
"no-warning-comments": [0, { "terms": ["todo", "fixme", "xxx"], "location": "start" }],
107113
"no-with": 2,
108114
"no-wrap-func": 2,
109115

116+
"array-bracket-spacing": [0, "never"],
117+
"accessor-pairs": 0,
110118
"block-scoped-var": 0,
111119
"brace-style": [0, "1tbs"],
112120
"camelcase": 2,
113121
"comma-dangle": [2, "never"],
114122
"comma-spacing": 2,
115123
"comma-style": 0,
116124
"complexity": [0, 11],
125+
"computed-property-spacing": [0, "never"],
117126
"consistent-return": 2,
118127
"consistent-this": [0, "that"],
128+
"constructor-super": 0,
119129
"curly": [2, "all"],
120130
"default-case": 0,
131+
"dot-location": 0,
121132
"dot-notation": [2, { "allowKeywords": true }],
122133
"eol-last": 2,
123134
"eqeqeq": 2,
@@ -130,6 +141,7 @@
130141
"handle-callback-err": 0,
131142
"indent": 0,
132143
"key-spacing": [2, { "beforeColon": false, "afterColon": true }],
144+
"lines-around-comment": 0,
133145
"max-depth": [0, 4],
134146
"max-len": [0, 80, 4],
135147
"max-nested-callbacks": [0, 2],
@@ -138,6 +150,7 @@
138150
"new-cap": 2,
139151
"new-parens": 2,
140152
"newline-after-var": 0,
153+
"object-curly-spacing": [0, "never"],
141154
"object-shorthand": 0,
142155
"one-var": 0,
143156
"operator-assignment": [0, "always"],
@@ -159,6 +172,7 @@
159172
"space-infix-ops": 2,
160173
"space-return-throw-case": 2,
161174
"space-unary-ops": [2, { "words": true, "nonwords": false }],
175+
"spaced-comment": 0,
162176
"spaced-line-comment": [0, "always"],
163177
"strict": 2,
164178
"use-isnan": 2,

tools/eslint/lib/api.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88
module.exports = {
99
linter: require("./eslint"),
1010
cli: require("./cli"),
11-
CLIEngine: require("./cli-engine")
11+
CLIEngine: require("./cli-engine"),
12+
validator: require("./config-validator")
1213
};

0 commit comments

Comments
 (0)