Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simpler babel settings #226

Merged
merged 3 commits into from
Mar 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
{
"presets": [
"es2015",
"react",
"stage-1",
],
plugins: [
"transform-runtime",
],
"presets": [ "es2015-loose" ],
"sourceMaps": "inline"
}
19 changes: 7 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@
"homepage": "https://github.com/benmosher/eslint-plugin-import",
"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-stage-1": "6.5.0",
"babel-preset-es2015": "^6.6.0",
"babel-preset-es2015-loose": "^7.0.0",
"chai": "^3.4.0",
"coveralls": "^2.11.4",
"cross-env": "^1.0.7",
Expand All @@ -61,14 +59,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"
}
}
3 changes: 3 additions & 0 deletions src/core/getExports.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import 'es6-symbol/implement'
import Map from 'es6-map'

import * as fs from 'fs'

import { createHash } from 'crypto'
Expand Down
5 changes: 3 additions & 2 deletions src/core/parse.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import moduleRequire from './module-require'
import assign from 'object-assign'

export default function (content, context) {

Expand All @@ -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
Expand Down
8 changes: 6 additions & 2 deletions src/core/resolve.js
Original file line number Diff line number Diff line change
@@ -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'

Expand Down Expand Up @@ -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'])

Expand Down Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions src/rules/export.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions src/rules/namespace.js
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 2 additions & 0 deletions src/rules/no-deprecated.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Map from 'es6-map'

import Exports from '../core/getExports'
import declaredScope from '../core/declaredScope'

Expand Down
4 changes: 4 additions & 0 deletions src/rules/no-duplicates.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions src/rules/no-unresolved.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion tests/src/core/getExports.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import assign from 'object-assign'
import { expect } from 'chai'
import ExportMap from 'core/getExports'

Expand Down Expand Up @@ -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' })
Expand Down
2 changes: 2 additions & 0 deletions tests/src/package.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'es6-symbol/implement'

var expect = require('chai').expect

var path = require('path')
Expand Down
5 changes: 3 additions & 2 deletions tests/src/rules/no-unresolved.js
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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 }
)
Expand Down
5 changes: 3 additions & 2 deletions tests/src/utils.js
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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',
Expand Down