Skip to content

Commit

Permalink
Bump eslint-config-babel and fix lint (#5129)
Browse files Browse the repository at this point in the history
  • Loading branch information
existentialism authored and danez committed Jan 17, 2017
1 parent 2457c8e commit 8c35b32
Show file tree
Hide file tree
Showing 20 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -26,7 +26,7 @@
"codecov": "^1.0.1",
"derequire": "^2.0.2",
"eslint": "^3.9.0",
"eslint-config-babel": "^5.0.0",
"eslint-config-babel": "^6.0.0",
"eslint-plugin-flowtype": "^2.20.0",
"flow-bin": "^0.34.0",
"gulp": "^3.9.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-code-frame/src/index.js
@@ -1,4 +1,4 @@
import jsTokens, {matchToToken} from "js-tokens";
import jsTokens, { matchToToken } from "js-tokens";
import esutils from "esutils";
import Chalk from "chalk";

Expand Down
2 changes: 1 addition & 1 deletion packages/babel-code-frame/test/index.js
Expand Up @@ -109,7 +109,7 @@ describe("babel-code-frame", function () {

it("opts.highlightCode", function () {
const rawLines = "console.log('babel')";
const result = codeFrame(rawLines, 1, 9, {highlightCode: true});
const result = codeFrame(rawLines, 1, 9, { highlightCode: true });
const stripped = chalk.stripColor(result);
assert.ok(result.length > stripped.length);
assert.equal(stripped, [
Expand Down
Expand Up @@ -7,7 +7,7 @@ const superVisitor = {
CallExpression(path) {
if (!path.get("callee").isSuper()) return;

const {node} = path;
const { node } = path;
if (node[SUPER_THIS_BOUND]) return;
node[SUPER_THIS_BOUND] = true;

Expand Down Expand Up @@ -101,7 +101,7 @@ function remap(path, key) {
const classPath = fnPath.findParent((p) => p.isClass());
const hasSuperClass = !!(classPath && classPath.node && classPath.node.superClass);

if (key === "this" && fnPath.isMethod({kind: "constructor"}) && hasSuperClass) {
if (key === "this" && fnPath.isMethod({ kind: "constructor" }) && hasSuperClass) {
fnPath.scope.push({ id });

fnPath.traverse(superVisitor, { id });
Expand Down
4 changes: 2 additions & 2 deletions packages/babel-core/test/evaluation.js
Expand Up @@ -64,6 +64,6 @@ describe("evaluation", function () {
addTest("'abc' === 'xyz' || (1 === 1 && 'four' === 'four')", "LogicalExpression", true);
addTest("'abc' === 'abc' && (1 === 1 && 'four' === 'four')", "LogicalExpression", true);
addTest("({})", "ObjectExpression", {});
addTest("({a: '1'})", "ObjectExpression", {a: "1"});
addTest("({['a' + 'b']: 10 * 20, 'z': [1, 2, 3]})", "ObjectExpression", {ab: 200, z: [1, 2, 3]});
addTest("({a: '1'})", "ObjectExpression", { a: "1" });
addTest("({['a' + 'b']: 10 * 20, 'z': [1, 2, 3]})", "ObjectExpression", { ab: 200, z: [1, 2, 3] });
});
2 changes: 1 addition & 1 deletion packages/babel-generator/src/buffer.js
Expand Up @@ -55,7 +55,7 @@ export default class Buffer {
return this.map = map.get();
},
set(value) {
Object.defineProperty(this, "map", {value, writable: true});
Object.defineProperty(this, "map", { value, writable: true });
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-generator/src/index.js
Expand Up @@ -2,7 +2,7 @@ import detectIndent from "detect-indent";
import SourceMap from "./source-map";
import * as messages from "babel-messages";
import Printer from "./printer";
import type {Format} from "./printer";
import type { Format } from "./printer";

/**
* Babel's code generator, turns an ast into code, maintaining sourcemaps,
Expand Down
6 changes: 3 additions & 3 deletions packages/babel-generator/src/node/parentheses.js
Expand Up @@ -43,7 +43,7 @@ export function UpdateExpression(node: Object, parent: Object): boolean {
}

export function ObjectExpression(node: Object, parent: Object, printStack: Array<Object>): boolean {
return isFirstInStatement(printStack, {considerArrow: true});
return isFirstInStatement(printStack, { considerArrow: true });
}

export function Binary(node: Object, parent: Object): boolean {
Expand Down Expand Up @@ -150,7 +150,7 @@ export function YieldExpression(node: Object, parent: Object): boolean {
export { YieldExpression as AwaitExpression };

export function ClassExpression(node: Object, parent: Object, printStack: Array<Object>): boolean {
return isFirstInStatement(printStack, {considerDefaultExports: true});
return isFirstInStatement(printStack, { considerDefaultExports: true });
}

export function UnaryLike(node: Object, parent: Object): boolean {
Expand All @@ -166,7 +166,7 @@ export function UnaryLike(node: Object, parent: Object): boolean {
}

export function FunctionExpression(node: Object, parent: Object, printStack: Array<Object>): boolean {
return isFirstInStatement(printStack, {considerDefaultExports: true});
return isFirstInStatement(printStack, { considerDefaultExports: true });
}

export function ArrowFunctionExpression(node: Object, parent: Object): boolean {
Expand Down
4 changes: 2 additions & 2 deletions packages/babel-plugin-transform-class-properties/src/index.js
Expand Up @@ -29,13 +29,13 @@ export default function ({ types: t }) {
});
`);

const buildClassPropertySpec = (ref, {key, value, computed}) => buildObjectDefineProperty({
const buildClassPropertySpec = (ref, { key, value, computed }) => buildObjectDefineProperty({
REF: ref,
KEY: (t.isIdentifier(key) && !computed) ? t.stringLiteral(key.name) : key,
VALUE: value ? value : t.identifier("undefined")
});

const buildClassPropertyNonSpec = (ref, {key, value, computed}) => t.expressionStatement(
const buildClassPropertyNonSpec = (ref, { key, value, computed }) => t.expressionStatement(
t.assignmentExpression("=", t.memberExpression(ref, key, computed || t.isLiteral(key)), value)
);

Expand Down
Expand Up @@ -506,7 +506,7 @@ export default function ({ types: t }) {
for (const nodeOut of nodesOut) {
if (!nodeOut.declarations) continue;
for (const declaration of nodeOut.declarations) {
const {name} = declaration.id;
const { name } = declaration.id;
if (scope.bindings[name]) {
scope.bindings[name].kind = nodeOut.kind;
}
Expand Down
Expand Up @@ -355,7 +355,7 @@ export default function () {
}

for (const source in imports) {
const {specifiers, maxBlockHoist} = imports[source];
const { specifiers, maxBlockHoist } = imports[source];
if (specifiers.length) {
const uid = addRequire(source, maxBlockHoist);

Expand Down
Expand Up @@ -21,7 +21,7 @@ test("Re-export doesn't overwrite __esModule flag", function () {

code = babel.transform(code, {
"plugins": [
[require("../"), {loose: true}],
[require("../"), { loose: true }],
],
"ast": false,
}).code;
Expand Down
12 changes: 6 additions & 6 deletions packages/babel-plugin-transform-es2015-parameters/src/rest.js
Expand Up @@ -67,7 +67,7 @@ const memberExpressionOptimisationVisitor = {
if (state.noOptimise) {
state.deopted = true;
} else {
const {parentPath} = path;
const { parentPath } = path;

// Is this identifier the right hand side of a default parameter?
if (parentPath.listKey === "params" && parentPath.key < state.offset) {
Expand Down Expand Up @@ -117,13 +117,13 @@ const memberExpressionOptimisationVisitor = {
// if we know that this member expression is referencing a number then
// we can safely optimise it
if (parentPath.get("property").isBaseType("number")) {
state.candidates.push({cause: "indexGetter", path});
state.candidates.push({ cause: "indexGetter", path });
return;
}
}
// args.length
else if (parentPath.node.property.name === "length") {
state.candidates.push({cause: "lengthGetter", path});
state.candidates.push({ cause: "lengthGetter", path });
return;
}
}
Expand All @@ -136,7 +136,7 @@ const memberExpressionOptimisationVisitor = {
if (state.offset === 0 && parentPath.isSpreadElement()) {
const call = parentPath.parentPath;
if (call.isCallExpression() && call.node.arguments.length === 1) {
state.candidates.push({cause: "argSpread", path});
state.candidates.push({ cause: "argSpread", path });
return;
}
}
Expand Down Expand Up @@ -176,7 +176,7 @@ function optimiseIndexGetter(path, argsId, offset) {
const { scope } = path;
if (!scope.isPure(index)) {
const temp = scope.generateUidIdentifierBasedOnNode(index);
scope.push({id: temp, kind: "var"});
scope.push({ id: temp, kind: "var" });
path.parentPath.replaceWith(restIndexImpure({
ARGUMENTS: argsId,
INDEX: index,
Expand Down Expand Up @@ -246,7 +246,7 @@ export const visitor = {

// There are only "shorthand" references
if (!state.deopted && !state.references.length) {
for (const {path, cause} of (state.candidates: Array)) {
for (const { path, cause } of (state.candidates: Array)) {
switch (cause) {
case "indexGetter":
optimiseIndexGetter(path, argsId, state.offset);
Expand Down
Expand Up @@ -2,7 +2,7 @@ export default function ({ types: t }) {
return {
visitor: {
ObjectProperty: {
exit({node}) {
exit({ node }) {
const key = node.key;
if (!node.computed && t.isIdentifier(key) && !t.isValidIdentifier(key.name)) {
// default: "bar" -> "default": "bar"
Expand Down
Expand Up @@ -50,7 +50,7 @@ export default function ({ types: t }) {
: null;

const fileNameIdentifier = path.scope.generateUidIdentifier(FILE_NAME_VAR);
path.hub.file.scope.push({id: fileNameIdentifier, init: t.stringLiteral(fileName)});
path.hub.file.scope.push({ id: fileNameIdentifier, init: t.stringLiteral(fileName) });
state.fileNameIdentifier = fileNameIdentifier;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/babel-preset-es2015/test/index.js
Expand Up @@ -21,7 +21,7 @@ describe("es2015 preset", function () {
describe("loose", function () {
it("throws on non-boolean value", function () {
expect(function () {
es2015.buildPreset(null, { loose: 1});
es2015.buildPreset(null, { loose: 1 });
}).to.throw(/must be a boolean/);
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-template/src/index.js
Expand Up @@ -36,7 +36,7 @@ export default function (code: string, opts?: Object): Function {
try {
ast = babylon.parse(code, opts);

ast = traverse.removeProperties(ast, {preserveComments: opts.preserveComments});
ast = traverse.removeProperties(ast, { preserveComments: opts.preserveComments });

traverse.cheap(ast, function (node) {
node[FROM_TEMPLATE] = true;
Expand Down
4 changes: 2 additions & 2 deletions packages/babel-template/test/index.js
Expand Up @@ -13,7 +13,7 @@ describe("templating", function () {

it("import statements are allowed with sourceType: module", function () {
chai.expect(function () {
template("import foo from 'foo'", {sourceType: "module"})({});
template("import foo from 'foo'", { sourceType: "module" })({});
}).not.to.throw();
});

Expand All @@ -24,7 +24,7 @@ describe("templating", function () {
});

it("should preserve comments with a flag", function () {
const output = template(comments, {preserveComments: true})();
const output = template(comments, { preserveComments: true })();
chai.expect(generator(output).code).to.be.equal(comments);
});
});
2 changes: 1 addition & 1 deletion packages/babel-traverse/test/inference.js
Expand Up @@ -4,7 +4,7 @@ import { parse } from "babylon";
import * as t from "babel-types";

function getPath(code) {
const ast = parse(code, {plugins: ["flow", "asyncGenerators"]});
const ast = parse(code, { plugins: ["flow", "asyncGenerators"] });
let path;
traverse(ast, {
Program: function (_path) {
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-types/test/retrievers.js
Expand Up @@ -3,7 +3,7 @@ import assert from "assert";
import { parse } from "babylon";

function getBody(program) {
return parse(program, {sourceType: "module"}).program.body;
return parse(program, { sourceType: "module" }).program.body;
}

describe("retrievers", function () {
Expand Down

0 comments on commit 8c35b32

Please sign in to comment.