Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 1 addition & 2 deletions test/parallel/test-async-wrap-disabled-propagate-parent.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const providers = Object.keys(async_wrap.Providers);
const uidSymbol = Symbol('uid');

let cntr = 0;
let server;
let client;

function init(uid, type, parentUid, parentHandle) {
Expand All @@ -34,7 +33,7 @@ function noop() { }
async_wrap.setupHooks({ init });
async_wrap.enable();

server = net.createServer(function(c) {
const server = net.createServer(function(c) {
client = c;
// Allow init callback to run before closing.
setImmediate(() => {
Expand Down
3 changes: 1 addition & 2 deletions test/parallel/test-async-wrap-propagate-parent.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const providers = Object.keys(async_wrap.Providers);
const uidSymbol = Symbol('uid');

let cntr = 0;
let server;
let client;

function init(uid, type, parentUid, parentHandle) {
Expand All @@ -34,7 +33,7 @@ function noop() { }
async_wrap.setupHooks({ init });
async_wrap.enable();

server = net.createServer(function(c) {
const server = net.createServer(function(c) {
client = c;
// Allow init callback to run before closing.
setImmediate(() => {
Expand Down
37 changes: 18 additions & 19 deletions test/parallel/test-stream-writev.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,24 @@ function test(decode, uncork, multi, next) {
assert(false, 'Should not call _write');
};

var expectChunks = decode ?
[
{ encoding: 'buffer',
chunk: [104, 101, 108, 108, 111, 44, 32] },
{ encoding: 'buffer',
chunk: [119, 111, 114, 108, 100] },
{ encoding: 'buffer',
chunk: [33] },
{ encoding: 'buffer',
chunk: [10, 97, 110, 100, 32, 116, 104, 101, 110, 46, 46, 46] },
{ encoding: 'buffer',
chunk: [250, 206, 190, 167, 222, 173, 190, 239, 222, 202, 251, 173]}
] : [
{ encoding: 'ascii', chunk: 'hello, ' },
{ encoding: 'utf8', chunk: 'world' },
{ encoding: 'buffer', chunk: [33] },
{ encoding: 'binary', chunk: '\nand then...' },
{ encoding: 'hex', chunk: 'facebea7deadbeefdecafbad' }
];
var expectChunks = decode ? [
{ encoding: 'buffer',
chunk: [104, 101, 108, 108, 111, 44, 32] },
{ encoding: 'buffer',
chunk: [119, 111, 114, 108, 100] },
{ encoding: 'buffer',
chunk: [33] },
{ encoding: 'buffer',
chunk: [10, 97, 110, 100, 32, 116, 104, 101, 110, 46, 46, 46] },
{ encoding: 'buffer',
chunk: [250, 206, 190, 167, 222, 173, 190, 239, 222, 202, 251, 173]}
] : [
{ encoding: 'ascii', chunk: 'hello, ' },
{ encoding: 'utf8', chunk: 'world' },
{ encoding: 'buffer', chunk: [33] },
{ encoding: 'binary', chunk: '\nand then...' },
{ encoding: 'hex', chunk: 'facebea7deadbeefdecafbad' }
];

var actualChunks;
w._writev = function(chunks, cb) {
Expand Down
3 changes: 1 addition & 2 deletions test/parallel/test-timers-immediate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ var assert = require('assert');
let immediateA = false;
let immediateB = false;
let immediateC = [];
let before;

setImmediate(function() {
try {
Expand All @@ -16,7 +15,7 @@ setImmediate(function() {
clearImmediate(immediateB);
});

before = process.hrtime();
const before = process.hrtime();

immediateB = setImmediate(function() {
immediateB = true;
Expand Down
6 changes: 3 additions & 3 deletions test/parallel/test-timers-unref.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let timeout_fired = false;
let unref_interval = false;
let unref_timer = false;
let unref_callbacks = 0;
let interval, check_unref, checks = 0;
let checks = 0;

var LONG_TIME = 10 * 1000;
var SHORT_TIME = 100;
Expand All @@ -28,7 +28,7 @@ setTimeout(function() {
timeout_fired = true;
}, LONG_TIME).unref();

interval = setInterval(function() {
const interval = setInterval(function() {
unref_interval = true;
clearInterval(interval);
}, SHORT_TIME);
Expand All @@ -38,7 +38,7 @@ setTimeout(function() {
unref_timer = true;
}, SHORT_TIME).unref();

check_unref = setInterval(function() {
const check_unref = setInterval(function() {
if (checks > 5 || (unref_interval && unref_timer))
clearInterval(check_unref);
checks += 1;
Expand Down
2,892 changes: 2,892 additions & 0 deletions tools/eslint/CHANGELOG.md

Large diffs are not rendered by default.

32 changes: 20 additions & 12 deletions tools/eslint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

# ESLint

[Website](http://eslint.org) | [Configuring](http://eslint.org/docs/user-guide/configuring) | [Rules](http://eslint.org/docs/rules/) | [Contributing](http://eslint.org/docs/developer-guide/contributing) | [Reporting Bugs](http://eslint.org/docs/developer-guide/contributing/reporting-bugs) | [Twitter](https://twitter.com/geteslint) | [Mailing List](https://groups.google.com/group/eslint)
[Website](http://eslint.org) | [Configuring](http://eslint.org/docs/user-guide/configuring) | [Rules](http://eslint.org/docs/rules/) | [Contributing](http://eslint.org/docs/developer-guide/contributing) | [Reporting Bugs](http://eslint.org/docs/developer-guide/contributing/reporting-bugs) | [Twitter](https://twitter.com/geteslint) | [Mailing List](https://groups.google.com/group/eslint) | [Chat Room](https://gitter.im/eslint/eslint)

ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code. In many ways, it is similar to JSLint and JSHint with a few exceptions:

Expand Down Expand Up @@ -39,17 +39,17 @@ After running `eslint --init`, you'll have a `.eslintrc` file in your directory.
```json
{
"rules": {
"semi": [2, "always"],
"quotes": [2, "double"]
"semi": ["error", "always"],
"quotes": ["error", "double"]
}
}
```

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:

* `0` - turn the rule off
* `1` - turn the rule on as a warning (doesn't affect exit code)
* `2` - turn the rule on as an error (exit code will be 1)
* `"off"` or `0` - turn the rule off
* `"warn"` or `1` - turn the rule on as a warning (doesn't affect exit code)
* `"error"` or `2` - turn the rule on as an error (exit code will be 1)

The three error levels allow you fine-grained control over how ESLint applies rules (for more configuration options and details, see the [configuration docs](http://eslint.org/docs/user-guide/configuring)).

Expand All @@ -66,12 +66,14 @@ These folks keep the project moving and are resources for help:
* Ilya Volodin ([@ilyavolodin](https://github.com/ilyavolodin)) - reviewer
* Brandon Mills ([@btmills](https://github.com/btmills)) - reviewer
* Gyandeep Singh ([@gyandeeps](https://github.com/gyandeeps)) - reviewer
* Toru Nagashima ([@mysticatea](https://github.com/mysticatea)) - reviewer
* Mathias Schreck ([@lo1tuma](https://github.com/lo1tuma)) - committer
* Jamund Ferguson ([@xjamundx](https://github.com/xjamundx)) - committer
* Ian VanSchooten ([@ianvs](https://github.com/ianvs)) - committer
* Toru Nagashima ([@mysticatea](https://github.com/mysticatea)) - committer
* Burak Yiğit Kaya ([@byk](https://github.com/byk)) - committer
* Alberto Rodríguez ([@alberto](https://github.com/alberto)) - committer
* Kai Cataldo ([@kaicataldo](https://github.com/kaicataldo)) - committer
* Michael Ficarra ([@michaelficarra](https://github.com/michaelficarra)) - committer

## Releases

Expand All @@ -83,6 +85,7 @@ Before filing an issue, please be sure to read the guidelines for what you're re

* [Bug Report](http://eslint.org/docs/developer-guide/contributing/reporting-bugs)
* [Propose a New Rule](http://eslint.org/docs/developer-guide/contributing/new-rules)
* [Proposing a Rule Change](http://eslint.org/docs/developer-guide/contributing/rule-changes)
* [Request a Change](http://eslint.org/docs/developer-guide/contributing/changes)

## Frequently Asked Questions
Expand All @@ -109,18 +112,23 @@ If you are using both JSHint and JSCS on your files, then using just ESLint will

ESLint does both traditional linting (looking for problematic patterns) and style checking (enforcement of conventions). You can use it for both.

### What about ECMAScript 6 support?

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?
### What about ECMAScript 6 support?

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

### What about 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.

Once a language feature has been adopted into the ECMAScript standard, we will accept
issues and pull requests related to the new feature, subject to our [contributing
guidelines](http://eslint.org/docs/developer-guide/contributing). Until then, please use
the appropriate parser and plugin(s) for your experimental feature.

### Where to ask for help?

Join our [Mailing List](https://groups.google.com/group/eslint) or [Chatroom](https://gitter.im/eslint/eslint)
Expand Down
21 changes: 20 additions & 1 deletion tools/eslint/bin/eslint.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,31 @@ if (debug) {

// now we can safely include the other modules that use debug
var concat = require("concat-stream"),
cli = require("../lib/cli");
cli = require("../lib/cli"),
path = require("path"),
fs = require("fs");

//------------------------------------------------------------------------------
// Execution
//------------------------------------------------------------------------------

process.on("uncaughtException", function(err){
// lazy load
var lodash = require("lodash");

if (typeof err.messageTemplate === "string" && err.messageTemplate.length > 0) {
var template = lodash.template(fs.readFileSync(path.resolve(__dirname, "../messages/" + err.messageTemplate + ".txt"), "utf-8"));

console.log("\nOops! Something went wrong! :(");
console.log("\n" + template(err.messageData || {}));
} else {
console.log(err.message);
console.log(err.stack);
}

process.exit(1);
});

if (useStdIn) {
process.stdin.pipe(concat({ encoding: "string" }, function(text) {
try {
Expand Down
3 changes: 1 addition & 2 deletions tools/eslint/conf/cli-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,5 @@ module.exports = {
cacheLocation: "",
cacheFile: ".eslintcache",
fix: false,
allowInlineConfig: true,
cwd: process.cwd()
allowInlineConfig: true
};
Loading