Run new lint rules (#5413)

This commit is contained in:
Brian Ng
2017-03-04 09:46:01 -06:00
committed by Henry Zhu
parent f7e2d88f6c
commit 8a82cc060a
181 changed files with 1459 additions and 1454 deletions

View File

@@ -29,10 +29,10 @@ program.parse(process.argv);
register({
extensions: program.extensions,
ignore: program.ignore,
only: program.only,
plugins: program.plugins,
presets: program.presets,
ignore: program.ignore,
only: program.only,
plugins: program.plugins,
presets: program.presets,
});
//
@@ -55,8 +55,8 @@ const replPlugin = ({ types: t }) => ({
// If the executed code doesn't evaluate to a value,
// prevent implicit strict mode from printing 'use strict'.
path.pushContainer("body", t.expressionStatement(t.identifier("undefined")));
}
}
},
},
});
//
@@ -68,11 +68,11 @@ const _eval = function (code, filename) {
code = babel.transform(code, {
filename: filename,
presets: program.presets,
plugins: (program.plugins || []).concat([replPlugin])
plugins: (program.plugins || []).concat([replPlugin]),
}).code;
return vm.runInThisContext(code, {
filename: filename
filename: filename,
});
};
@@ -85,10 +85,10 @@ if (program.eval || program.print) {
const module = new Module(global.__filename);
module.filename = global.__filename;
module.paths = Module._nodeModulePaths(global.__dirname);
module.paths = Module._nodeModulePaths(global.__dirname);
global.exports = module.exports;
global.module = module;
global.module = module;
global.require = module.require.bind(module);
const result = _eval(code, global.__filename);
@@ -141,7 +141,7 @@ function replStart() {
input: process.stdin,
output: process.stdout,
eval: replEval,
useGlobal: true
useGlobal: true,
});
}

View File

@@ -14,7 +14,7 @@ let userArgs;
// separate node arguments from script arguments
const argSeparator = babelArgs.indexOf("--");
if (argSeparator > -1) {
userArgs = babelArgs.slice(argSeparator); // including the --
userArgs = babelArgs.slice(argSeparator); // including the --
babelArgs = babelArgs.slice(0, argSeparator);
}

View File

@@ -14,7 +14,7 @@ export default function (commander, filenames) {
const data = util.compile(src, {
sourceFileName: slash(path.relative(dest + "/..", src)),
sourceMapTarget: path.basename(relative)
sourceMapTarget: path.basename(relative),
});
if (!commander.copyFiles && data.ignored) return;
@@ -74,7 +74,7 @@ export default function (commander, filenames) {
awaitWriteFinish: {
stabilityThreshold: 50,
pollInterval: 10,
}
},
});
["add", "change"].forEach(function (type) {

View File

@@ -1,5 +1,5 @@
import convertSourceMap from "convert-source-map";
import sourceMap from "source-map";
import sourceMap from "source-map";
import slash from "slash";
import path from "path";
import fs from "fs";
@@ -16,7 +16,7 @@ export default function (commander, filenames, opts) {
const buildResult = function () {
const map = new sourceMap.SourceMapGenerator({
file: path.basename(commander.outFile || "") || "stdout",
sourceRoot: opts.sourceRoot
sourceRoot: opts.sourceRoot,
});
let code = "";
@@ -64,7 +64,7 @@ export default function (commander, filenames, opts) {
return {
map: map,
code: code
code: code,
};
};
@@ -156,7 +156,7 @@ export default function (commander, filenames, opts) {
awaitWriteFinish: {
stabilityThreshold: 50,
pollInterval: 10,
}
},
}).on("all", function (type, filename) {
if (util.shouldIgnore(filename) || !util.canCompile(filename, commander.extensions)) return;

View File

@@ -1,11 +1,11 @@
#!/usr/bin/env node
import fs from "fs";
import fs from "fs";
import commander from "commander";
import kebabCase from "lodash/kebabCase";
import { options, util, version } from "babel-core";
import uniq from "lodash/uniq";
import glob from "glob";
import uniq from "lodash/uniq";
import glob from "glob";
import dirCommand from "./dir";
import fileCommand from "./file";

View File

@@ -1,21 +1,21 @@
const includes = require("lodash/includes");
const readdir = require("fs-readdir-recursive");
const helper = require("babel-helper-fixtures");
const assert = require("assert");
const rimraf = require("rimraf");
const includes = require("lodash/includes");
const readdir = require("fs-readdir-recursive");
const helper = require("babel-helper-fixtures");
const assert = require("assert");
const rimraf = require("rimraf");
const outputFileSync = require("output-file-sync");
const child = require("child_process");
const merge = require("lodash/merge");
const path = require("path");
const chai = require("chai");
const fs = require("fs");
const child = require("child_process");
const merge = require("lodash/merge");
const path = require("path");
const chai = require("chai");
const fs = require("fs");
const fixtureLoc = path.join(__dirname, "fixtures");
const tmpLoc = path.join(__dirname, "tmp");
const presetLocs = [
path.join(__dirname, "../../babel-preset-es2015"),
path.join(__dirname, "../../babel-preset-react")
path.join(__dirname, "../../babel-preset-react"),
].join(",");
const pluginLocs = [
@@ -150,7 +150,7 @@ fs.readdirSync(fixtureLoc).forEach(function (binName) {
const testLoc = path.join(suiteLoc, testName);
const opts = {
args: []
args: [],
};
const optionsLoc = path.join(testLoc, "options.json");
@@ -166,7 +166,7 @@ fs.readdirSync(fixtureLoc).forEach(function (binName) {
});
opts.outFiles = readDir(path.join(testLoc, "out-files"));
opts.inFiles = readDir(path.join(testLoc, "in-files"));
opts.inFiles = readDir(path.join(testLoc, "in-files"));
const babelrcLoc = path.join(testLoc, ".babelrc");
if (fs.existsSync(babelrcLoc)) {