diff --git a/packages/babel-cli/src/babel-node.js b/packages/babel-cli/src/babel-node.js index 60c04648ca..c45af6c4da 100755 --- a/packages/babel-cli/src/babel-node.js +++ b/packages/babel-cli/src/babel-node.js @@ -21,7 +21,7 @@ if (argSeparator > -1) { } getV8Flags(function (err, v8Flags) { - babelArgs.forEach(function(arg){ + babelArgs.forEach(function(arg) { let flag = arg.split("=")[0]; switch (flag) { diff --git a/packages/babel-core/src/transformation/internal-plugins/block-hoist.js b/packages/babel-core/src/transformation/internal-plugins/block-hoist.js index 014b9e7711..c1934abf43 100644 --- a/packages/babel-core/src/transformation/internal-plugins/block-hoist.js +++ b/packages/babel-core/src/transformation/internal-plugins/block-hoist.js @@ -26,7 +26,7 @@ export default new Plugin({ } if (!hasChange) return; - node.body = sortBy(node.body, function(bodyNode){ + node.body = sortBy(node.body, function(bodyNode) { let priority = bodyNode && bodyNode._blockHoist; if (priority == null) priority = 1; if (priority === true) priority = 2; diff --git a/packages/babel-core/src/transformation/internal-plugins/shadow-functions.js b/packages/babel-core/src/transformation/internal-plugins/shadow-functions.js index 980ff3c26c..95db393195 100644 --- a/packages/babel-core/src/transformation/internal-plugins/shadow-functions.js +++ b/packages/babel-core/src/transformation/internal-plugins/shadow-functions.js @@ -4,7 +4,7 @@ import * as t from "babel-types"; const SUPER_THIS_BOUND = Symbol("super this bound"); const superVisitor = { - CallExpression(path){ + CallExpression(path) { if (!path.get("callee").isSuper()) return; const {node} = path; @@ -71,7 +71,7 @@ function remap(path, key) { return false; }); - if (shadowFunction && fnPath.isProgram() && !shadowFunction.isProgram()){ + if (shadowFunction && fnPath.isProgram() && !shadowFunction.isProgram()) { // If the shadow wasn't found, take the closest function as a backup. // This is a bit of a hack, but it will allow the parameter transforms to work properly // without introducing yet another shadow-controlling flag. @@ -92,7 +92,7 @@ function remap(path, key) { fnPath.setData(key, id); - if (key === "this" && fnPath.isMethod({kind: "constructor"})){ + if (key === "this" && fnPath.isMethod({kind: "constructor"})) { fnPath.scope.push({ id }); fnPath.traverse(superVisitor, { id }); diff --git a/packages/babel-plugin-transform-es2015-classes/src/index.js b/packages/babel-plugin-transform-es2015-classes/src/index.js index f922f99437..9b4d371e5c 100644 --- a/packages/babel-plugin-transform-es2015-classes/src/index.js +++ b/packages/babel-plugin-transform-es2015-classes/src/index.js @@ -8,7 +8,7 @@ export default function ({ types: t }) { return { visitor: { - ExportDefaultDeclaration(path){ + ExportDefaultDeclaration(path) { if (!path.get("declaration").isClassDeclaration()) return; let { node } = path; diff --git a/packages/babel-plugin-transform-es2015-destructuring/src/index.js b/packages/babel-plugin-transform-es2015-destructuring/src/index.js index 0c2a651e81..95533c4618 100644 --- a/packages/babel-plugin-transform-es2015-destructuring/src/index.js +++ b/packages/babel-plugin-transform-es2015-destructuring/src/index.js @@ -327,14 +327,14 @@ export default function ({ types: t }) { return { visitor: { - ExportNamedDeclaration(path){ + ExportNamedDeclaration(path) { let declaration = path.get("declaration"); if (!declaration.isVariableDeclaration()) return; if (!variableDeclarationHasPattern(declaration.node)) return; let specifiers = []; - for (let name in path.getOuterBindingIdentifiers(path)){ + for (let name in path.getOuterBindingIdentifiers(path)) { let id = t.identifier(name); specifiers.push(t.exportSpecifier(id, id)); } diff --git a/packages/babel-plugin-transform-regenerator/src/visit.js b/packages/babel-plugin-transform-regenerator/src/visit.js index 6d7468fa52..8d96f2b404 100644 --- a/packages/babel-plugin-transform-regenerator/src/visit.js +++ b/packages/babel-plugin-transform-regenerator/src/visit.js @@ -146,7 +146,7 @@ function getOuterFnExpr(funPath) { let node = funPath.node; t.assertFunction(node); - if (!node.id){ + if (!node.id) { // Default-exported function declarations, and function expressions may not // have a name to reference, so we explicitly add one. node.id = funPath.scope.parent.generateUidIdentifier("callee"); diff --git a/packages/babel-polyfill/src/index.js b/packages/babel-polyfill/src/index.js index 5ff627aeb6..d7def88ad3 100644 --- a/packages/babel-polyfill/src/index.js +++ b/packages/babel-polyfill/src/index.js @@ -13,7 +13,7 @@ import "babel-regenerator-runtime"; import "core-js/fn/regexp/escape"; let DEFINE_PROPERTY = "defineProperty"; -function define(O, key, value){ +function define(O, key, value) { O[key] || Object[DEFINE_PROPERTY](O, key, { writable: true, configurable: true, @@ -24,6 +24,6 @@ function define(O, key, value){ define(String.prototype, "padLeft", "".padStart); define(String.prototype, "padRight", "".padEnd); -"pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach(function(key){ +"pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach(function(key) { [][key] && define(Array, key, Function.call.bind([][key])); }); diff --git a/packages/babel-register/src/node.js b/packages/babel-register/src/node.js index 4d9dfd378c..36b877da16 100644 --- a/packages/babel-register/src/node.js +++ b/packages/babel-register/src/node.js @@ -36,7 +36,7 @@ let maps = {}; let cwd = process.cwd(); -function getRelativePath(filename){ +function getRelativePath(filename) { return path.relative(cwd, filename); } diff --git a/packages/babel-traverse/src/context.js b/packages/babel-traverse/src/context.js index b8ffaf0e20..84a1422fac 100644 --- a/packages/babel-traverse/src/context.js +++ b/packages/babel-traverse/src/context.js @@ -104,7 +104,7 @@ export default class TraversalContext { for (let path of queue) { path.resync(); - if (path.contexts.length === 0 || path.contexts[path.contexts.length - 1] !== this){ + if (path.contexts.length === 0 || path.contexts[path.contexts.length - 1] !== this) { // The context might already have been pushed when this path was inserted and queued. // If we always re-pushed here, we could get duplicates and risk leaving contexts // on the stack after the traversal has completed, which could break things. diff --git a/packages/babel-traverse/src/path/context.js b/packages/babel-traverse/src/path/context.js index ce1f6f5361..360f17c684 100644 --- a/packages/babel-traverse/src/path/context.js +++ b/packages/babel-traverse/src/path/context.js @@ -221,7 +221,7 @@ export function requeue(pathToQueue = this) { } } -export function _getQueueContexts(){ +export function _getQueueContexts() { let path = this; let contexts = this.contexts; while (!contexts.length) { diff --git a/packages/babel-traverse/src/visitors.js b/packages/babel-traverse/src/visitors.js index 36f762ae46..6f0f4f9d9a 100644 --- a/packages/babel-traverse/src/visitors.js +++ b/packages/babel-traverse/src/visitors.js @@ -219,7 +219,7 @@ function ensureEntranceObjects(obj) { } } -function ensureCallbackArrays(obj){ +function ensureCallbackArrays(obj) { if (obj.enter && !Array.isArray(obj.enter)) obj.enter = [obj.enter]; if (obj.exit && !Array.isArray(obj.exit)) obj.exit = [obj.exit]; } diff --git a/packages/babel-types/src/validators.js b/packages/babel-types/src/validators.js index 678b318c80..720579d87e 100644 --- a/packages/babel-types/src/validators.js +++ b/packages/babel-types/src/validators.js @@ -119,7 +119,7 @@ export function isReferenced(node: Object, parent: Object): boolean { case "ClassExpression": return parent.id !== node; - // yes: class { [NODE](){} } + // yes: class { [NODE]() {} } case "ClassMethod": case "ObjectMethod": return parent.key === node && parent.computed;