Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
  •  
  •  
  •  
Prev Previous commit
Next Next commit
tools: update ESLint to current version
We have been stalled on ESLint 3.8.0 for some time. Current ESLint is
3.13.0. We have been unable to upgrade because of more aggressive
reporting on some rules, including indentation.

ESLint configuration options and bugfixes are now such that we can
reasonably upgrade.

PR-URL: #10561
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
  • Loading branch information
Trott committed Mar 8, 2017
commit 98c3950dc0b52c30ec9e2fd8ce7fd118cfc8af9e
7 changes: 6 additions & 1 deletion .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@ rules:
computed-property-spacing: 2
eol-last: 2
func-call-spacing: 2
indent: [2, 2, {SwitchCase: 1, MemberExpression: 1}]
func-name-matching: 2
indent: [2, 2, {ArrayExpression: first,
CallExpression: {arguments: first},
MemberExpression: 1,
ObjectExpression: first,
SwitchCase: 1}]
key-spacing: [2, {mode: minimum}]
keyword-spacing: 2
linebreak-style: [2, unix]
Expand Down
6 changes: 3 additions & 3 deletions benchmark/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function runBenchmarks() {
if (!test)
return;

if (test.match(/^[\._]/))
if (test.match(/^[._]/))
return process.nextTick(runBenchmarks);

if (outputFormat == 'default')
Expand Down Expand Up @@ -86,7 +86,7 @@ function Benchmark(fn, options) {
this.fn = fn;
this.options = options;
this.config = parseOpts(options);
this._name = require.main.filename.split(/benchmark[\/\\]/).pop();
this._name = require.main.filename.split(/benchmark[/\\]/).pop();
this._start = [0, 0];
this._started = false;

Expand All @@ -101,7 +101,7 @@ function Benchmark(fn, options) {
Benchmark.prototype.http = function(p, args, cb) {
hasWrk();
var self = this;
var regexp = /Requests\/sec:[ \t]+([0-9\.]+)/;
var regexp = /Requests\/sec:[ \t]+([0-9.]+)/;
var url = 'http://127.0.0.1:' + exports.PORT + p;

args = args.concat(url);
Expand Down
2 changes: 1 addition & 1 deletion lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ try {
printDeprecation('fs: re-evaluating native module sources is not ' +
'supported. If you are using the graceful-fs module, ' +
'please update it to a more recent version.',
false);
false);
}

function throwOptionsError(options) {
Expand Down
1 change: 1 addition & 0 deletions lib/internal/process.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ function setupConfig(_source) {
Intl.hasOwnProperty('v8BreakIterator') &&
!process.icu_data_dir) {
const des = Object.getOwnPropertyDescriptor(Intl, 'v8BreakIterator');
// eslint-disable-next-line func-name-matching
des.value = function v8BreakIterator() {
throw new Error('v8BreakIterator: full ICU data not installed. ' +
'See https://github.com/nodejs/node/wiki/Intl');
Expand Down
17 changes: 10 additions & 7 deletions lib/readline.js
Original file line number Diff line number Diff line change
Expand Up @@ -1102,17 +1102,20 @@ function codePointAt(str, index) {
}
return code;
}
exports.codePointAt = internalUtil.deprecate(codePointAt,
'readline.codePointAt is deprecated. ' +
'Use String.prototype.codePointAt instead.');
exports.codePointAt = internalUtil.deprecate(
codePointAt,
'readline.codePointAt is deprecated. ' +
'Use String.prototype.codePointAt instead.');


exports.getStringWidth = internalUtil.deprecate(getStringWidth,
'getStringWidth is deprecated and will be removed.');
exports.getStringWidth = internalUtil.deprecate(
getStringWidth,
'getStringWidth is deprecated and will be removed.');


exports.isFullWidthCodePoint = internalUtil.deprecate(isFullWidthCodePoint,
'isFullWidthCodePoint is deprecated and will be removed.');
exports.isFullWidthCodePoint = internalUtil.deprecate(
isFullWidthCodePoint,
'isFullWidthCodePoint is deprecated and will be removed.');


exports.stripVTControlCharacters = internalUtil.deprecate(
Expand Down
2 changes: 1 addition & 1 deletion lib/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const portPattern = /:[0-9]*$/;
const hostPattern = /^\/\/[^@/]+@[^@/]+/;

// Special case for a simple path URL
const simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/;
const simplePathPattern = /^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/;

const hostnameMaxLen = 255;
// protocols that can allow "unsafe" and "unwise" chars.
Expand Down
10 changes: 5 additions & 5 deletions test/parallel/test-child-process-exec-timeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ cp.exec(cmd, {

// Test the case where a timeout is set, but not expired.
cp.exec(cmd, { timeout: Math.pow(2, 30) },
common.mustCall((err, stdout, stderr) => {
assert.ifError(err);
assert.strictEqual(stdout.trim(), 'child stdout');
assert.strictEqual(stderr.trim(), 'child stderr');
})
common.mustCall((err, stdout, stderr) => {
assert.ifError(err);
assert.strictEqual(stdout.trim(), 'child stdout');
assert.strictEqual(stderr.trim(), 'child stderr');
})
);
4 changes: 2 additions & 2 deletions tools/doc/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function loadGtoc(cb) {
function toID(filename) {
return filename
.replace('.html', '')
.replace(/[^\w\-]/g, '-')
.replace(/[^\w-]/g, '-')
.replace(/-+/g, '-');
}

Expand Down Expand Up @@ -284,7 +284,7 @@ function linkJsTypeDocs(text) {
// Handle types, for example the source Markdown might say
// "This argument should be a {Number} or {String}"
for (i = 0; i < parts.length; i += 2) {
typeMatches = parts[i].match(/\{([^\}]+)\}/g);
typeMatches = parts[i].match(/\{([^}]+)\}/g);
if (typeMatches) {
typeMatches.forEach(function(typeMatch) {
parts[i] = parts[i].replace(typeMatch, typeParser.toLink(typeMatch));
Expand Down
10 changes: 5 additions & 5 deletions tools/doc/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function doJSON(input, filename, cb) {
// <!-- type = module -->
// This is for cases where the markdown semantic structure is lacking.
if (type === 'paragraph' || type === 'html') {
var metaExpr = /<!--([^=]+)=([^\-]+)-->\n*/g;
var metaExpr = /<!--([^=]+)=([^-]+)-->\n*/g;
text = text.replace(metaExpr, function(_0, k, v) {
current[k.trim()] = v.trim();
return '';
Expand Down Expand Up @@ -371,7 +371,7 @@ function parseListItem(item) {
item.name = 'return';
text = text.replace(retExpr, '');
} else {
var nameExpr = /^['`"]?([^'`": \{]+)['`"]?\s*:?\s*/;
var nameExpr = /^['`"]?([^'`": {]+)['`"]?\s*:?\s*/;
var name = text.match(nameExpr);
if (name) {
item.name = name[1];
Expand All @@ -388,7 +388,7 @@ function parseListItem(item) {
}

text = text.trim();
var typeExpr = /^\{([^\}]+)\}/;
var typeExpr = /^\{([^}]+)\}/;
var type = text.match(typeExpr);
if (type) {
item.type = type[1];
Expand Down Expand Up @@ -546,12 +546,12 @@ function deepCopy_(src) {
var eventExpr = /^Event(?::|\s)+['"]?([^"']+).*$/i;
var classExpr = /^Class:\s*([^ ]+).*?$/i;
var propExpr = /^(?:property:?\s*)?[^.]+\.([^ .()]+)\s*?$/i;
var braceExpr = /^(?:property:?\s*)?[^.\[]+(\[[^\]]+\])\s*?$/i;
var braceExpr = /^(?:property:?\s*)?[^.[]+(\[[^\]]+\])\s*?$/i;
var classMethExpr =
/^class\s*method\s*:?[^.]+\.([^ .()]+)\([^)]*\)\s*?$/i;
var methExpr =
/^(?:method:?\s*)?(?:[^.]+\.)?([^ .()]+)\([^)]*\)\s*?$/i;
var newExpr = /^new ([A-Z][a-zA-Z]+)\([^\)]*\)\s*?$/;
var newExpr = /^new ([A-Z][a-zA-Z]+)\([^)]*\)\s*?$/;
var paramExpr = /\((.*)\);?$/;

function newSection(tok) {
Expand Down
2 changes: 1 addition & 1 deletion tools/eslint/LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ESLint
Copyright jQuery Foundation and other contributors, https://jquery.org/
Copyright JS Foundation and other contributors, https://js.foundation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
7 changes: 2 additions & 5 deletions tools/eslint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
[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) |
[Code of Conduct](https://jquery.org/conduct/) |
[Code of Conduct](https://js.foundation/conduct/) |
[Twitter](https://twitter.com/geteslint) |
[Mailing List](https://groups.google.com/group/eslint) |
[Chat Room](https://gitter.im/eslint/eslint)
Expand Down Expand Up @@ -210,10 +210,7 @@ ESLint has full support for ECMAScript 6. By default, this support is off. You c

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.
Once a language feature has been adopted into the ECMAScript standard (stage 4 according to the [TC39 process](https://tc39.github.io/process-document/)), 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?

Expand Down
10 changes: 5 additions & 5 deletions tools/eslint/bin/eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @author Nicholas C. Zakas
*/

/* eslint no-console:off, no-process-exit:off */
/* eslint no-console:off */

"use strict";

Expand Down Expand Up @@ -36,7 +36,7 @@ const concat = require("concat-stream"),
// Execution
//------------------------------------------------------------------------------

process.on("uncaughtException", function(err) {
process.once("uncaughtException", err => {

// lazy load
const lodash = require("lodash");
Expand All @@ -51,17 +51,17 @@ process.on("uncaughtException", function(err) {
console.log(err.stack);
}

process.exit(1);
process.exitCode = 1;
});

if (useStdIn) {
process.stdin.pipe(concat({ encoding: "string" }, function(text) {
process.stdin.pipe(concat({ encoding: "string" }, text => {
process.exitCode = cli.execute(process.argv, text);
}));
} else if (init) {
const configInit = require("../lib/config/config-initializer");

configInit.initializeConfig(function(err) {
configInit.initializeConfig(err => {
if (err) {
process.exitCode = 1;
console.error(err.message);
Expand Down
14 changes: 10 additions & 4 deletions tools/eslint/conf/eslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"rules": {
"no-alert": "off",
"no-array-constructor": "off",
"no-await-in-loop": "off",
"no-bitwise": "off",
"no-caller": "off",
"no-case-declarations": "error",
Expand Down Expand Up @@ -41,7 +42,7 @@
"no-fallthrough": "error",
"no-floating-decimal": "off",
"no-func-assign": "error",
"no-global-assign": "off",
"no-global-assign": "error",
"no-implicit-coercion": "off",
"no-implicit-globals": "off",
"no-implied-eval": "off",
Expand All @@ -63,9 +64,9 @@
"no-multi-spaces": "off",
"no-multi-str": "off",
"no-multiple-empty-lines": "off",
"no-native-reassign": "error",
"no-native-reassign": "off",
"no-negated-condition": "off",
"no-negated-in-lhs": "error",
"no-negated-in-lhs": "off",
"no-nested-ternary": "off",
"no-new": "off",
"no-new-func": "off",
Expand All @@ -91,6 +92,7 @@
"no-restricted-properties": "off",
"no-restricted-syntax": "off",
"no-return-assign": "off",
"no-return-await": "off",
"no-script-url": "off",
"no-self-assign": "error",
"no-self-compare": "off",
Expand All @@ -115,7 +117,7 @@
"no-unneeded-ternary": "off",
"no-unreachable": "error",
"no-unsafe-finally": "error",
"no-unsafe-negation": "off",
"no-unsafe-negation": "error",
"no-unused-expressions": "off",
"no-unused-labels": "error",
"no-unused-vars": "error",
Expand All @@ -126,6 +128,7 @@
"no-useless-constructor": "off",
"no-useless-escape": "off",
"no-useless-rename": "off",
"no-useless-return": "off",
"no-void": "off",
"no-var": "off",
"no-warning-comments": "off",
Expand All @@ -141,6 +144,7 @@
"brace-style": "off",
"callback-return": "off",
"camelcase": "off",
"capitalized-comments": "off",
"class-methods-use-this": "off",
"comma-dangle": "off",
"comma-spacing": "off",
Expand Down Expand Up @@ -200,6 +204,7 @@
"padded-blocks": "off",
"prefer-arrow-callback": "off",
"prefer-const": "off",
"prefer-destructuring": "off",
"prefer-numeric-literals": "off",
"prefer-reflect": "off",
"prefer-rest-params": "off",
Expand All @@ -208,6 +213,7 @@
"quote-props": "off",
"quotes": "off",
"radix": "off",
"require-await": "off",
"require-jsdoc": "off",
"require-yield": "error",
"rest-spread-spacing": "off",
Expand Down
Loading