Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eslint 4.1.0 #13895

Closed
wants to merge 4 commits into from
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions benchmark/.eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Benchmarks-specific linter rules

rules:
# Stylistic Issues
# http://eslint.org/docs/rules/#stylistic-issues
indent: [2, 2, {ArrayExpression: first,
CallExpression: {arguments: first},
FunctionDeclaration: {parameters: first},
FunctionExpression: {parameters: first},
MemberExpression: off,
ObjectExpression: first,
SwitchCase: 1}]
indent-legacy: 0
15 changes: 7 additions & 8 deletions benchmark/_benchmark_progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ class BenchmarkProgress {
const runsPerFile = this.runsPerFile;
const completedFiles = Math.floor(completedRuns / runsPerFile);
const scheduledFiles = this.benchmarks.length;
const completedRunsForFile = finished ? runsPerFile :
completedRuns % runsPerFile;
const completedRunsForFile =
finished ? runsPerFile : completedRuns % runsPerFile;
const completedConfig = this.completedConfig;
const scheduledConfig = this.scheduledConfig;

Expand All @@ -101,12 +101,11 @@ class BenchmarkProgress {
const percent = pad(Math.floor(completedRate * 100), 3, ' ');

const caption = finished ? 'Done\n' : this.currentFile;
return `[${getTime(diff)}|% ${
percent}| ${
fraction(completedFiles, scheduledFiles)} files | ${
fraction(completedRunsForFile, runsPerFile)} runs | ${
fraction(completedConfig, scheduledConfig)} configs]: ${
caption} `;
return `[${getTime(diff)}|% ${percent}| ` +
`${fraction(completedFiles, scheduledFiles)} files | ` +
`${fraction(completedRunsForFile, runsPerFile)} runs | ` +
`${fraction(completedConfig, scheduledConfig)} configs]: ` +
`${caption} `;
}

updateProgress(finished) {
Expand Down
17 changes: 8 additions & 9 deletions benchmark/_http-benchmarkers.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ exports.PORT = process.env.PORT || 12346;
class AutocannonBenchmarker {
constructor() {
this.name = 'autocannon';
this.executable = process.platform === 'win32' ?
'autocannon.cmd' :
'autocannon';
this.executable =
process.platform === 'win32' ? 'autocannon.cmd' : 'autocannon';
const result = child_process.spawnSync(this.executable, ['-h']);
this.present = !(result.error && result.error.code === 'ENOENT');
}
Expand Down Expand Up @@ -136,19 +135,19 @@ exports.run = function(options, callback) {
benchmarker: exports.default_http_benchmarker
}, options);
if (!options.benchmarker) {
callback(new Error(`Could not locate required http benchmarker. See ${
requirementsURL} for further instructions.`));
callback(new Error('Could not locate required http benchmarker. See ' +
`${requirementsURL} for further instructions.`));
return;
}
const benchmarker = benchmarkers[options.benchmarker];
if (!benchmarker) {
callback(new Error(`Requested benchmarker '${
options.benchmarker}' is not supported`));
callback(new Error(`Requested benchmarker '${options.benchmarker}' ` +
'is not supported'));
return;
}
if (!benchmarker.present) {
callback(new Error(`Requested benchmarker '${
options.benchmarker}' is not installed`));
callback(new Error(`Requested benchmarker '${options.benchmarker}' ` +
'is not installed'));
return;
}

Expand Down
4 changes: 2 additions & 2 deletions benchmark/buffers/buffer-compare-offset.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ function compareUsingOffset(b0, b1, len, iter) {
function main(conf) {
const iter = (conf.millions >>> 0) * 1e6;
const size = (conf.size >>> 0);
const method = conf.method === 'slice' ?
compareUsingSlice : compareUsingOffset;
const method =
conf.method === 'slice' ? compareUsingSlice : compareUsingOffset;
method(Buffer.alloc(size, 'a'),
Buffer.alloc(size, 'b'),
size >> 1,
Expand Down
2 changes: 1 addition & 1 deletion benchmark/child_process/child-process-read-ipc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if (process.argv[2] === 'child') {

const options = { 'stdio': ['ignore', 1, 2, 'ipc'] };
const child = spawn(process.argv[0],
[process.argv[1], 'child', len], options);
[process.argv[1], 'child', len], options);

var bytes = 0;
child.on('message', function(msg) {
Expand Down
9 changes: 3 additions & 6 deletions benchmark/compare.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ const cli = CLI(`usage: ./node compare.js [options] [--] <category> ...
--filter pattern string to filter benchmark scripts
--set variable=value set benchmark variable (can be repeated)
--no-progress don't show benchmark progress indicator
`, {
arrayArgs: ['set'],
boolArgs: ['no-progress']
});
`, { arrayArgs: ['set'], boolArgs: ['no-progress'] });

if (!cli.optional.new || !cli.optional.old) {
cli.abort(cli.usage);
Expand Down Expand Up @@ -85,8 +82,8 @@ if (showProgress) {
// Escape quotes (") for correct csv formatting
conf = conf.replace(/"/g, '""');

console.log(`"${job.binary}", "${job.filename}", "${conf}", ${
data.rate}, ${data.time}`);
console.log(`"${job.binary}", "${job.filename}", "${conf}", ` +
`${data.rate}, ${data.time}`);
if (showProgress) {
// One item in the subqueue has been completed.
progress.completeConfig(data);
Expand Down
4 changes: 1 addition & 3 deletions benchmark/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ const cli = CLI(`usage: ./node run.js [options] [--] <category> ...
--filter pattern string to filter benchmark scripts
--set variable=value set benchmark variable (can be repeated)
--format [simple|csv] optional value that specifies the output format
`, {
arrayArgs: ['set']
});
`, { arrayArgs: ['set'] });
const benchmarks = cli.benchmarks();

if (benchmarks.length === 0) {
Expand Down
4 changes: 1 addition & 3 deletions benchmark/scatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ const cli = CLI(`usage: ./node scatter.js [options] [--] <filename>

--runs 30 number of samples
--set variable=value set benchmark variable (can be repeated)
`, {
arrayArgs: ['set']
});
`, { arrayArgs: ['set'] });

if (cli.items.length !== 1) {
cli.abort(cli.usage);
Expand Down
1 change: 1 addition & 0 deletions tools/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ rules:
MemberExpression: off,
ObjectExpression: first,
SwitchCase: 1}]
indent-legacy: 0
4 changes: 4 additions & 0 deletions tools/eslint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ These folks keep the project moving and are resources for help.

We have scheduled releases every two weeks on Friday or Saturday.

## Code of Conduct

ESLint adheres to the [JS Foundation Code of Conduct](https://js.foundation/community/code-of-conduct).

## Filing Issues

Before filing an issue, please be sure to read the guidelines for what you're reporting:
Expand Down
68 changes: 68 additions & 0 deletions tools/eslint/conf/config-schema.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/**
* @fileoverview Defines a schema for configs.
* @author Sylvan Mably
*/

"use strict";

const baseConfigProperties = {
env: { type: "object" },
globals: { type: "object" },
parser: { type: ["string", "null"] },
parserOptions: { type: "object" },
plugins: { type: "array" },
rules: { type: "object" },
settings: { type: "object" }
};

const overrideProperties = Object.assign(
{},
baseConfigProperties,
{
files: {
oneOf: [
{ type: "string" },
{
type: "array",
items: { type: "string" },
minItems: 1
}
]
},
excludedFiles: {
oneOf: [
{ type: "string" },
{
type: "array",
items: { type: "string" }
}
]
}
}
);

const topLevelConfigProperties = Object.assign(
{},
baseConfigProperties,
{
extends: { type: ["string", "array"] },
root: { type: "boolean" },
overrides: {
type: "array",
items: {
type: "object",
properties: overrideProperties,
required: ["files"],
additionalProperties: false
}
}
}
);

const configSchema = {
type: "object",
properties: topLevelConfigProperties,
additionalProperties: false
};

module.exports = configSchema;
15 changes: 0 additions & 15 deletions tools/eslint/conf/config-schema.json

This file was deleted.

6 changes: 1 addition & 5 deletions tools/eslint/conf/default-config-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,5 @@ module.exports = deepFreeze({
rules: {},
settings: {},
parser: "espree",
parserOptions: {
ecmaVersion: 5,
sourceType: "script",
ecmaFeatures: {}
}
parserOptions: {}
});
Loading