From 5bb1f8c96e6efc217b173816f193fbfc59f68398 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 13 Oct 2016 15:37:07 -0400 Subject: [PATCH] update eslint-config, fixes, add commands (#4721) * update eslint-config, fixes, add commands * switch plugin --- Makefile | 5 ++++- package.json | 8 +++++--- packages/babel-cli/src/babel-doctor/rules/deduped.js | 2 +- packages/babel-cli/src/babel-doctor/rules/has-config.js | 2 +- .../src/transformation/file/options/build-config-chain.js | 4 ++-- .../src/index.js | 2 +- packages/babel-preset-es2015/src/index.js | 2 +- 7 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index e8aeb08b24e4..fd50fca97f11 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ MAKEFLAGS = -j1 export NODE_ENV = test -.PHONY: build build-dist watch lint clean test-clean test-only test test-cov test-ci publish bootstrap +.PHONY: build build-dist watch lint fix clean test-clean test-only test test-cov test-ci publish bootstrap build: clean ./node_modules/.bin/gulp build @@ -20,6 +20,9 @@ watch: clean lint: ./node_modules/.bin/eslint packages/*/src +fix: + ./node_modules/.bin/eslint packages/*/src --fix + clean: test-clean rm -rf packages/*/lib rm -rf packages/babel-polyfill/browser* diff --git a/package.json b/package.json index 10dcf91c0c4c..5d2246f3d665 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,9 @@ "license": "MIT", "scripts": { "test": "make test", - "build": "make build" + "build": "make build", + "lint": "make lint", + "fix": "make fix" }, "devDependencies": { "async": "^1.5.0", @@ -23,9 +25,9 @@ "codecov.io": "^0.1.6", "derequire": "^2.0.2", "eslint": "^3.7.1", - "eslint-config-babel": "^1.0.1", + "eslint-config-babel": "^2.0.1", "eslint-plugin-babel": "^3.3.0", - "eslint-plugin-flow-vars": "^0.5.0", + "eslint-plugin-flowtype": "^2.20.0", "flow-bin": "^0.33.0", "gulp": "^3.9.0", "gulp-babel": "^6.0.0", diff --git a/packages/babel-cli/src/babel-doctor/rules/deduped.js b/packages/babel-cli/src/babel-doctor/rules/deduped.js index 43e28b6d7f5d..64f5afddab26 100644 --- a/packages/babel-cli/src/babel-doctor/rules/deduped.js +++ b/packages/babel-cli/src/babel-doctor/rules/deduped.js @@ -1,4 +1,4 @@ -export default async function (packages) { // eslint-disable-line require-yield +export default async function (packages) { let foundDeps = {}; let foundDuplicated = false; let duplicatedPackages = {}; diff --git a/packages/babel-cli/src/babel-doctor/rules/has-config.js b/packages/babel-cli/src/babel-doctor/rules/has-config.js index 83ef13c1367f..605cd457a7d9 100644 --- a/packages/babel-cli/src/babel-doctor/rules/has-config.js +++ b/packages/babel-cli/src/babel-doctor/rules/has-config.js @@ -1,7 +1,7 @@ import path from "path"; import fs from "fs"; -export default async function () { // eslint-disable-line require-yield +export default async function () { let cwd = process.cwd(); let parts = cwd.split(path.sep); diff --git a/packages/babel-core/src/transformation/file/options/build-config-chain.js b/packages/babel-core/src/transformation/file/options/build-config-chain.js index f9b43e3a6bbc..efeb3af8f2e6 100644 --- a/packages/babel-core/src/transformation/file/options/build-config-chain.js +++ b/packages/babel-core/src/transformation/file/options/build-config-chain.js @@ -26,7 +26,7 @@ function exists(filename) { export default function buildConfigChain(opts: Object = {}, log?: Logger) { let filename = opts.filename; let builder = new ConfigChainBuilder(log); - + // resolve all .babelrc files if (opts.babelrc !== false) { builder.findConfigs(filename); @@ -37,7 +37,7 @@ export default function buildConfigChain(opts: Object = {}, log?: Logger) { alias: "base", dirname: filename && path.dirname(filename) }); - + return builder.configs; } diff --git a/packages/babel-plugin-transform-es2015-modules-systemjs/src/index.js b/packages/babel-plugin-transform-es2015-modules-systemjs/src/index.js index 5b1619d245b2..ac8a8e2889d6 100644 --- a/packages/babel-plugin-transform-es2015-modules-systemjs/src/index.js +++ b/packages/babel-plugin-transform-es2015-modules-systemjs/src/index.js @@ -174,7 +174,7 @@ export default function ({ types: t }) { beforeBody.push(buildExportCall(name, node.id)); removedPaths.push(path); } else { - bindingIdentifiers = { [name]: node.id }; + bindingIdentifiers = { [name]: node.id }; } } else { bindingIdentifiers = declar.getBindingIdentifiers(); diff --git a/packages/babel-preset-es2015/src/index.js b/packages/babel-preset-es2015/src/index.js index 67b055982ae7..57d96082d120 100644 --- a/packages/babel-preset-es2015/src/index.js +++ b/packages/babel-preset-es2015/src/index.js @@ -52,7 +52,7 @@ function preset(context, opts = {}) { // be DRY const optsLoose = { loose }; - + return { plugins: [ [transformES2015TemplateLiterals, { loose, spec }],