devDeps: eslint-config-babel v5.0.0 (#139)

This commit is contained in:
Kai Cataldo 2017-01-15 22:34:53 -05:00 committed by Henry Zhu
parent da75840794
commit ad5698ed19
5 changed files with 13 additions and 15 deletions

View File

@ -55,9 +55,8 @@
"babel-preset-es2015": "^6.14.0", "babel-preset-es2015": "^6.14.0",
"babel-register": "^6.14.0", "babel-register": "^6.14.0",
"compat-table": "kangax/compat-table#b0cec63ea21f3a7788a8eececcb918de903b7fc5", "compat-table": "kangax/compat-table#b0cec63ea21f3a7788a8eececcb918de903b7fc5",
"eslint": "^3.3.1", "eslint": "^3.13.1",
"eslint-config-babel": "^3.0.0", "eslint-config-babel": "^5.0.0",
"eslint-plugin-babel": "^4.0.0",
"eslint-plugin-flowtype": "^2.29.1", "eslint-plugin-flowtype": "^2.29.1",
"lodash": "^4.15.0", "lodash": "^4.15.0",
"mocha": "^3.0.2", "mocha": "^3.0.2",

View File

@ -80,7 +80,7 @@ const envMap = {
}; };
const getLowestImplementedVersion = ({ features }, env) => { const getLowestImplementedVersion = ({ features }, env) => {
let tests = flatten(compatibilityTests const tests = flatten(compatibilityTests
.filter((test) => { .filter((test) => {
return features.indexOf(test.name) >= 0 || return features.indexOf(test.name) >= 0 ||
// for features === ["DataView"] // for features === ["DataView"]
@ -104,7 +104,7 @@ const getLowestImplementedVersion = ({ features }, env) => {
}) })
); );
let envTests = tests const envTests = tests
.map(({ res: test, name, isBuiltIn }, i) => { .map(({ res: test, name, isBuiltIn }, i) => {
// Babel itself doesn't implement the feature correctly, // Babel itself doesn't implement the feature correctly,
// don't count against it // don't count against it
@ -133,7 +133,7 @@ const getLowestImplementedVersion = ({ features }, env) => {
.shift(); .shift();
}); });
let envFiltered = envTests.filter((t) => t); const envFiltered = envTests.filter((t) => t);
if (envTests.length > envFiltered.length || envTests.length === 0) { if (envTests.length > envFiltered.length || envTests.length === 0) {
// envTests.forEach((test, i) => { // envTests.forEach((test, i) => {
// if (!test) { // if (!test) {

View File

@ -111,7 +111,7 @@ export const electronVersionToChromeVersion = (semverVer) => {
throw new Error("Electron version must be a semver version"); throw new Error("Electron version must be a semver version");
} }
let result = electronToChromium[m[1]]; const result = electronToChromium[m[1]];
if (!result) { if (!result) {
throw new Error(`Electron version ${m[1]} is either too old or too new`); throw new Error(`Electron version ${m[1]} is either too old or too new`);
} }
@ -122,7 +122,7 @@ export const electronVersionToChromeVersion = (semverVer) => {
const _extends = Object.assign || function (target) { const _extends = Object.assign || function (target) {
for (let i = 1; i < arguments.length; i++) { for (let i = 1; i < arguments.length; i++) {
const source = arguments[i]; const source = arguments[i];
for (let key in source) { for (const key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) { if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key]; target[key] = source[key];
} }
@ -178,7 +178,7 @@ export function validatePluginsOption(opts = [], type) {
throw new Error(`The '${type}' option must be an Array<string> of plugins/built-ins`); throw new Error(`The '${type}' option must be an Array<string> of plugins/built-ins`);
} }
let unknownOpts = []; const unknownOpts = [];
opts.forEach((opt) => { opts.forEach((opt) => {
if (validIncludesAndExcludes.indexOf(opt) === -1) { if (validIncludesAndExcludes.indexOf(opt) === -1) {
unknownOpts.push(opt); unknownOpts.push(opt);
@ -201,7 +201,7 @@ const validateIncludeOption = (opts) => validatePluginsOption(opts, "include");
const validateExcludeOption = (opts) => validatePluginsOption(opts, "exclude"); const validateExcludeOption = (opts) => validatePluginsOption(opts, "exclude");
export function checkDuplicateIncludeExcludes(include, exclude) { export function checkDuplicateIncludeExcludes(include, exclude) {
let duplicates = []; const duplicates = [];
include.forEach((opt) => { include.forEach((opt) => {
if (exclude.indexOf(opt) >= 0) { if (exclude.indexOf(opt) >= 0) {
duplicates.push(opt); duplicates.push(opt);
@ -254,7 +254,7 @@ export default function buildPreset(context, opts = {}) {
const useBuiltIns = opts.useBuiltIns; const useBuiltIns = opts.useBuiltIns;
const filterPlugins = filterItem.bind(null, targets, exclude.plugins, pluginList); const filterPlugins = filterItem.bind(null, targets, exclude.plugins, pluginList);
let transformations = Object.keys(pluginList) const transformations = Object.keys(pluginList)
.filter(filterPlugins) .filter(filterPlugins)
.concat(include.plugins); .concat(include.plugins);

View File

@ -4,7 +4,7 @@ function isPolyfillSource(value) {
export default function ({ types: t }) { export default function ({ types: t }) {
function createImportDeclaration(polyfill) { function createImportDeclaration(polyfill) {
let declar = t.importDeclaration([], t.stringLiteral(polyfill)); const declar = t.importDeclaration([], t.stringLiteral(polyfill));
declar._blockHoist = 3; declar._blockHoist = 3;
return declar; return declar;
} }
@ -43,7 +43,7 @@ export default function ({ types: t }) {
} }
function createImports(polyfills, requireType, regenerator) { function createImports(polyfills, requireType, regenerator) {
let imports = polyfills const imports = polyfills
.filter((el, i, arr) => arr.indexOf(el) === i) .filter((el, i, arr) => arr.indexOf(el) === i)
.map((polyfill) => createImport(polyfill, requireType, true)); .map((polyfill) => createImport(polyfill, requireType, true));

View File

@ -145,12 +145,11 @@ describe("babel-preset-env", () => {
}); });
it("doesn't throw when specifiying a decimal for node", () => { it("doesn't throw when specifiying a decimal for node", () => {
let targets;
const plugin = { const plugin = {
node: 6 node: 6
}; };
targets = { const targets = {
"node": 6.5 "node": 6.5
}; };