From 465a6e7c535d3da9f377f3c492abd55a4bf1b1f0 Mon Sep 17 00:00:00 2001 From: Ben Mosher Date: Wed, 23 Mar 2016 06:13:38 -0400 Subject: [PATCH 1/3] removed extraneous babel presets --- .babelrc | 10 ++-------- package.json | 4 ++-- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.babelrc b/.babelrc index 9d198317d..49097e668 100644 --- a/.babelrc +++ b/.babelrc @@ -1,11 +1,5 @@ { - "presets": [ - "es2015", - "react", - "stage-1", - ], - plugins: [ - "transform-runtime", - ], + "presets": [ "es2015-loose" ], + "plugins": [ "transform-runtime" ], "sourceMaps": "inline" } diff --git a/package.json b/package.json index f43754f30..63220ca4b 100644 --- a/package.json +++ b/package.json @@ -38,8 +38,8 @@ "devDependencies": { "babel-eslint": "next", "babel-plugin-transform-runtime": "6.5.2", - "babel-preset-es2015": "6.5.0", - "babel-preset-react": "6.5.0", + "babel-preset-es2015": "^6.6.0", + "babel-preset-es2015-loose": "^7.0.0", "babel-preset-stage-1": "6.5.0", "chai": "^3.4.0", "coveralls": "^2.11.4", From e9bd5383d919d58289ac80569f34603e2a9f46e5 Mon Sep 17 00:00:00 2001 From: Ben Mosher Date: Wed, 23 Mar 2016 06:45:19 -0400 Subject: [PATCH 2/3] removed babel-runtime, converted to es6-* ponyfills --- .babelrc | 1 - package.json | 14 +++++--------- src/core/getExports.js | 3 +++ src/core/parse.js | 5 +++-- src/core/resolve.js | 8 ++++++-- src/rules/export.js | 4 ++++ src/rules/namespace.js | 3 +++ src/rules/no-deprecated.js | 2 ++ src/rules/no-duplicates.js | 4 ++++ src/rules/no-unresolved.js | 3 +++ tests/src/core/getExports.js | 3 ++- tests/src/package.js | 2 ++ tests/src/rules/no-unresolved.js | 5 +++-- tests/src/utils.js | 5 +++-- 14 files changed, 43 insertions(+), 19 deletions(-) diff --git a/.babelrc b/.babelrc index 49097e668..5427da412 100644 --- a/.babelrc +++ b/.babelrc @@ -1,5 +1,4 @@ { "presets": [ "es2015-loose" ], - "plugins": [ "transform-runtime" ], "sourceMaps": "inline" } diff --git a/package.json b/package.json index 63220ca4b..690a67283 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,6 @@ "homepage": "https://github.com/benmosher/eslint-plugin-import", "devDependencies": { "babel-eslint": "next", - "babel-plugin-transform-runtime": "6.5.2", "babel-preset-es2015": "^6.6.0", "babel-preset-es2015-loose": "^7.0.0", "babel-preset-stage-1": "6.5.0", @@ -61,14 +60,11 @@ "eslint": "2.x" }, "dependencies": { - "babel-runtime": "6.5.0", "doctrine": "1.2.0", - "eslint-import-resolver-node": "^0.1.0" - }, - "greenkeeper": { - "ignore": [ - "babel", - "babel-runtime" - ] + "es6-map": "^0.1.3", + "es6-set": "^0.1.4", + "es6-symbol": "*", + "eslint-import-resolver-node": "^0.1.0", + "object-assign": "^4.0.1" } } diff --git a/src/core/getExports.js b/src/core/getExports.js index 98c62a0fa..7ef4f5f39 100644 --- a/src/core/getExports.js +++ b/src/core/getExports.js @@ -1,3 +1,6 @@ +import 'es6-symbol/implement' +import Map from 'es6-map' + import * as fs from 'fs' import { createHash } from 'crypto' diff --git a/src/core/parse.js b/src/core/parse.js index 99d280f3f..21b3561ea 100644 --- a/src/core/parse.js +++ b/src/core/parse.js @@ -1,4 +1,5 @@ import moduleRequire from './module-require' +import assign from 'object-assign' export default function (content, context) { @@ -9,8 +10,8 @@ export default function (content, context) { if (!parserPath) throw new Error("parserPath is required!") // hack: espree blows up with frozen options - parserOptions = Object.assign({}, parserOptions) - parserOptions.ecmaFeatures = Object.assign({}, parserOptions.ecmaFeatures) + parserOptions = assign({}, parserOptions) + parserOptions.ecmaFeatures = assign({}, parserOptions.ecmaFeatures) // always attach comments parserOptions.attachComment = true diff --git a/src/core/resolve.js b/src/core/resolve.js index a91839dfd..9a15d04cd 100644 --- a/src/core/resolve.js +++ b/src/core/resolve.js @@ -1,3 +1,7 @@ +import 'es6-symbol/implement' +import Map from 'es6-map' +import assign from 'object-assign' + import fs from 'fs' import { dirname, basename, join } from 'path' @@ -46,7 +50,7 @@ export function relative(modulePath, sourceFile, settings) { const sourceDir = dirname(sourceFile) , cacheKey = sourceDir + hashObject(settings) + modulePath - const cacheSettings = Object.assign({ + const cacheSettings = assign({ lifetime: 30, // seconds }, settings['import/cache']) @@ -82,7 +86,7 @@ export function relative(modulePath, sourceFile, settings) { const resolvers = resolverReducer(configResolvers, new Map()) - for (let [name, config] of resolvers.entries()) { + for (let [name, config] of resolvers) { const resolver = require(`eslint-import-resolver-${name}`) let fullPath = withResolver(resolver, config) diff --git a/src/rules/export.js b/src/rules/export.js index e972db8a5..ba1206430 100644 --- a/src/rules/export.js +++ b/src/rules/export.js @@ -1,3 +1,7 @@ +import 'es6-symbol/implement' +import Map from 'es6-map' +import Set from 'es6-set' + import ExportMap, { recursivePatternCapture } from '../core/getExports' module.exports = function (context) { diff --git a/src/rules/namespace.js b/src/rules/namespace.js index a71023684..32ae15a07 100644 --- a/src/rules/namespace.js +++ b/src/rules/namespace.js @@ -1,3 +1,6 @@ +import 'es6-symbol/implement' +import Map from 'es6-map' + import Exports from '../core/getExports' import importDeclaration from '../importDeclaration' import declaredScope from '../core/declaredScope' diff --git a/src/rules/no-deprecated.js b/src/rules/no-deprecated.js index 89da2a825..034827034 100644 --- a/src/rules/no-deprecated.js +++ b/src/rules/no-deprecated.js @@ -1,3 +1,5 @@ +import Map from 'es6-map' + import Exports from '../core/getExports' import declaredScope from '../core/declaredScope' diff --git a/src/rules/no-duplicates.js b/src/rules/no-duplicates.js index e25695cb9..9383dc9db 100644 --- a/src/rules/no-duplicates.js +++ b/src/rules/no-duplicates.js @@ -1,3 +1,7 @@ +import 'es6-symbol/implement' +import Map from 'es6-map' +import Set from 'es6-set' + import resolve from '../core/resolve' module.exports = function (context) { diff --git a/src/rules/no-unresolved.js b/src/rules/no-unresolved.js index 902046180..8afd1613d 100644 --- a/src/rules/no-unresolved.js +++ b/src/rules/no-unresolved.js @@ -2,6 +2,9 @@ * @fileOverview Ensures that an imported path exists, given resolution rules. * @author Ben Mosher */ + +import 'es6-symbol/implement' + import resolve from '../core/resolve' module.exports = function (context) { diff --git a/tests/src/core/getExports.js b/tests/src/core/getExports.js index c36c5fff1..c9ae6dd6d 100644 --- a/tests/src/core/getExports.js +++ b/tests/src/core/getExports.js @@ -1,3 +1,4 @@ +import assign from 'object-assign' import { expect } from 'chai' import ExportMap from 'core/getExports' @@ -45,7 +46,7 @@ describe('getExports', function () { const firstAccess = ExportMap.get('./named-exports', fakeContext) expect(firstAccess).to.exist - const differentSettings = Object.assign( + const differentSettings = assign( {}, fakeContext, { parserPath: 'espree' }) diff --git a/tests/src/package.js b/tests/src/package.js index 137d9c3ea..290a1f7a0 100644 --- a/tests/src/package.js +++ b/tests/src/package.js @@ -1,3 +1,5 @@ +import 'es6-symbol/implement' + var expect = require('chai').expect var path = require('path') diff --git a/tests/src/rules/no-unresolved.js b/tests/src/rules/no-unresolved.js index cdbdf4469..351fac591 100644 --- a/tests/src/rules/no-unresolved.js +++ b/tests/src/rules/no-unresolved.js @@ -1,5 +1,6 @@ -var path = require('path') +import * as path from 'path' +import assign from 'object-assign' import { test } from '../utils' import { RuleTester } from 'eslint' @@ -11,7 +12,7 @@ function runResolverTests(resolver) { // redefine 'test' to set a resolver // thus 'rest'. needed something 4-chars-long for formatting simplicity function rest(specs) { - specs.settings = Object.assign({}, + specs.settings = assign({}, specs.settings, { 'import/resolver': resolver } ) diff --git a/tests/src/utils.js b/tests/src/utils.js index 285fe3490..2061a324c 100644 --- a/tests/src/utils.js +++ b/tests/src/utils.js @@ -1,7 +1,8 @@ import path from 'path' +import assign from 'object-assign' // warms up the module cache. this import takes a while (>500ms) -require('babel-eslint') +import 'babel-eslint' export function testFilePath(relativePath) { return path.join(process.cwd(), './tests/files', relativePath) @@ -10,7 +11,7 @@ export function testFilePath(relativePath) { export const FILENAME = testFilePath('foo.js') export function test(t) { - return Object.assign({ + return assign({ filename: FILENAME, parserOptions: { sourceType: 'module', From 5046081a199b7eea5f141e073ea981e9a66bbede Mon Sep 17 00:00:00 2001 From: Ben Mosher Date: Wed, 23 Mar 2016 06:45:40 -0400 Subject: [PATCH 3/3] removed extraneous stage-1 preset --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 690a67283..86448e2dd 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,6 @@ "babel-eslint": "next", "babel-preset-es2015": "^6.6.0", "babel-preset-es2015-loose": "^7.0.0", - "babel-preset-stage-1": "6.5.0", "chai": "^3.4.0", "coveralls": "^2.11.4", "cross-env": "^1.0.7",