Skip to content

Commit

Permalink
tools: update eslint to 0.24.0
Browse files Browse the repository at this point in the history
PR-URL: #2072
Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com>
Reviewed-by: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Alex Kocharin <alex@kocharin.ru>
  • Loading branch information
silverwind committed Jun 29, 2015
1 parent 1a51f00 commit d91e10b
Show file tree
Hide file tree
Showing 1,046 changed files with 101,443 additions and 4,656 deletions.
38 changes: 35 additions & 3 deletions tools/eslint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![Test coverage][coveralls-image]][coveralls-url]
[![Downloads][downloads-image]][downloads-url]
[![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)
[![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)

# ESLint

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

## Usage

If it's your first time using ESLint, you should set up a config file using `--init`:

eslint --init

After that, you can run ESLint on any JavaScript file:

eslint test.js test2.js

## Team

These folks keep the project moving and are resources for help:

* Nicholas C. Zakas ([@nzakas](https://github.com/nzakas)) - project lead
* Ilya Volodin ([@ilyavolodin](https://github.com/ilyavolodin)) - reviewer
* Brandon Mills ([@btmills](https://github.com/btmills)) - reviewer
* Mathias Schreck ([@lo1tuma](https://github.com/lo1tuma)) - committer
* Gyandeep Singh ([@gyandeeps](https://github.com/gyandeeps)) - committer
* Jamund Ferguson ([@xjamundx](https://github.com/xjamundx)) - committer


## Frequently Asked Questions

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

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.

### How does ESLint performance compare to JSHint?
### How does ESLint performance compare to JSHint and JSCS?

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.

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

ESLint is faster than JSCS, as ESLint uses a single-pass traversal for analysis whereas JSCS using a querying model.

If you are using both JSHint and JSCS on your files, then using just ESLint will be faster.

### Is ESLint just linting or does it also check style?

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

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

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

### What about ECMAScript 6 support?

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.
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).

### Does ESLint support JSX?

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.

### What about ECMAScript 7/2016 and experimental features?

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.

### Where to ask for help?

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


[npm-image]: https://img.shields.io/npm/v/eslint.svg?style=flat-square
Expand Down
15 changes: 14 additions & 1 deletion tools/eslint/bin/eslint.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/usr/bin/env node
var concat = require("concat-stream"),
configInit = require("../lib/config-initializer"),
cli = require("../lib/cli");

var exitCode = 0,
useStdIn = (process.argv.indexOf("--stdin") > -1);
useStdIn = (process.argv.indexOf("--stdin") > -1),
init = (process.argv.indexOf("--init") > -1);

if (useStdIn) {
process.stdin.pipe(concat({ encoding: "string" }, function(text) {
Expand All @@ -15,6 +17,17 @@ if (useStdIn) {
exitCode = 1;
}
}));
} else if (init) {
configInit.initializeConfig(function(err) {
if (err) {
exitCode = 1;
console.error(err.message);
console.error(err.stack);
} else {
console.log("Successfully created .eslintrc file in " + process.cwd());
exitCode = 0;
}
});
} else {
exitCode = cli.execute(process.argv);
}
Expand Down
9 changes: 9 additions & 0 deletions tools/eslint/conf/environments.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ module.exports = {
"handle-callback-err": [2, "err"]
}
},
worker: {
globals: globals.worker
},
amd: {
globals: globals.amd
},
Expand All @@ -52,6 +55,12 @@ module.exports = {
meteor: {
globals: globals.meteor
},
mongo: {
globals: globals.mongo
},
applescript: {
globals: globals.applescript
},
es6: {
ecmaFeatures: {
arrowFunctions: true,
Expand Down
16 changes: 15 additions & 1 deletion tools/eslint/conf/eslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"no-duplicate-case": 2,
"no-else-return": 0,
"no-empty": 2,
"no-empty-class": 2,
"no-empty-class": 0,
"no-empty-character-class": 2,
"no-empty-label": 2,
"no-eq-null": 0,
"no-eval": 2,
Expand All @@ -56,6 +57,7 @@
"no-loop-func": 2,
"no-mixed-requires": [0, false],
"no-mixed-spaces-and-tabs": [2, false],
"linebreak-style": [0, "unix"],
"no-multi-spaces": 2,
"no-multi-str": 2,
"no-multiple-empty-lines": [0, {"max": 2}],
Expand Down Expand Up @@ -92,32 +94,41 @@
"no-sync": 0,
"no-ternary": 0,
"no-trailing-spaces": 2,
"no-this-before-super": 0,
"no-throw-literal": 0,
"no-undef": 2,
"no-undef-init": 2,
"no-undefined": 0,
"no-unexpected-multiline": 0,
"no-underscore-dangle": 2,
"no-unneeded-ternary": 0,
"no-unreachable": 2,
"no-unused-expressions": 2,
"no-unused-vars": [2, {"vars": "all", "args": "after-used"}],
"no-use-before-define": 2,
"no-void": 0,
"no-var": 0,
"prefer-const": 0,
"no-warning-comments": [0, { "terms": ["todo", "fixme", "xxx"], "location": "start" }],
"no-with": 2,
"no-wrap-func": 2,

"array-bracket-spacing": [0, "never"],
"accessor-pairs": 0,
"block-scoped-var": 0,
"brace-style": [0, "1tbs"],
"camelcase": 2,
"comma-dangle": [2, "never"],
"comma-spacing": 2,
"comma-style": 0,
"complexity": [0, 11],
"computed-property-spacing": [0, "never"],
"consistent-return": 2,
"consistent-this": [0, "that"],
"constructor-super": 0,
"curly": [2, "all"],
"default-case": 0,
"dot-location": 0,
"dot-notation": [2, { "allowKeywords": true }],
"eol-last": 2,
"eqeqeq": 2,
Expand All @@ -130,6 +141,7 @@
"handle-callback-err": 0,
"indent": 0,
"key-spacing": [2, { "beforeColon": false, "afterColon": true }],
"lines-around-comment": 0,
"max-depth": [0, 4],
"max-len": [0, 80, 4],
"max-nested-callbacks": [0, 2],
Expand All @@ -138,6 +150,7 @@
"new-cap": 2,
"new-parens": 2,
"newline-after-var": 0,
"object-curly-spacing": [0, "never"],
"object-shorthand": 0,
"one-var": 0,
"operator-assignment": [0, "always"],
Expand All @@ -159,6 +172,7 @@
"space-infix-ops": 2,
"space-return-throw-case": 2,
"space-unary-ops": [2, { "words": true, "nonwords": false }],
"spaced-comment": 0,
"spaced-line-comment": [0, "always"],
"strict": 2,
"use-isnan": 2,
Expand Down
3 changes: 2 additions & 1 deletion tools/eslint/lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
module.exports = {
linter: require("./eslint"),
cli: require("./cli"),
CLIEngine: require("./cli-engine")
CLIEngine: require("./cli-engine"),
validator: require("./config-validator")
};
Loading

0 comments on commit d91e10b

Please sign in to comment.