Skip to content

Commit

Permalink
tests pass, compiling under babel 6
Browse files Browse the repository at this point in the history
  • Loading branch information
benmosher committed Nov 2, 2015
1 parent b50ca8b commit 988d90d
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 36 deletions.
5 changes: 3 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"optional": ["runtime"]
}
"presets": ["es2015"],
"plugins": ["transform-runtime"]
}
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@
"homepage": "https://github.com/benmosher/eslint-plugin-import",
"devDependencies": {
"acorn-to-esprima": "^1.0.5",
"babel": "5.8.29",
"babel": "^6.0.12",
"babel-cli": "^6.0.12",
"babel-eslint": "^4.1.3",
"babel-plugin-transform-es2015-modules-commonjs": "^6.0.12",
"babel-plugin-transform-runtime": "^6.0.2",
"babel-preset-es2015": "^6.0.12",
"babel-types": "^6.0.13",
"chai": "^3.4.0",
"eslint": ">=1.8.0",
"istanbul": "^0.4.0",
Expand All @@ -47,8 +52,8 @@
"eslint": ">=0.16.0"
},
"dependencies": {
"babel-core": "5.x",
"babel-runtime": "5.8.29",
"babel-cli": "^6.0.12",
"babel-runtime": "^6.0.12",
"resolve": "1.1.6"
}
}
6 changes: 3 additions & 3 deletions src/rules/default.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { get as getExports } from '../core/getExports'
import Exports from '../core/getExports'

export default function (context) {
module.exports = function (context) {

function checkDefault(specifierType, node) {

Expand All @@ -14,7 +14,7 @@ export default function (context) {
})

if (!defaultSpecifier) return
var imports = getExports(node.source.value, context)
var imports = Exports.get(node.source.value, context)
if (imports == null) return

if (!imports.hasDefault) {
Expand Down
2 changes: 1 addition & 1 deletion src/rules/export.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ExportMap from '../core/getExports'

export default function (context) {
module.exports = function (context) {
const defaults = new Set()
, named = new Map()

Expand Down
2 changes: 1 addition & 1 deletion src/rules/imports-first.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function (context) {
module.exports = function (context) {
return {
"Program": function (n) {
const body = n.body
Expand Down
6 changes: 2 additions & 4 deletions src/rules/named.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
'use strict'

var getExports = require('../core/getExports').get
import Exports from '../core/getExports'

module.exports = function (context) {
function checkSpecifiers(key, type, node) {
Expand All @@ -11,7 +9,7 @@ module.exports = function (context) {
return // no named imports/exports
}

const imports = getExports(node.source.value, context)
const imports = Exports.get(node.source.value, context)
if (imports == null) return

var names = imports.named
Expand Down
6 changes: 3 additions & 3 deletions src/rules/namespace.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { get as getExports } from '../core/getExports'
import Exports from '../core/getExports'
import importDeclaration from '../importDeclaration'

export default function (context) {
module.exports = function (context) {

const namespaces = new Map()

function getImportsAndReport(namespace) {
var declaration = importDeclaration(context)

var imports = getExports(declaration.source.value, context)
var imports = Exports.get(declaration.source.value, context)
if (imports == null) return null

if (!imports.hasNamed) {
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-duplicates.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import resolve from '../core/resolve'

export default function (context) {
module.exports = function (context) {
const imported = new Map()
return {
"ImportDeclaration": function (n) {
Expand Down
6 changes: 2 additions & 4 deletions src/rules/no-errors.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
'use strict'

var getExports = require('../core/getExports').get
import Exports from '../core/getExports'

module.exports = function (context) {
function message(node, errors) {
Expand All @@ -19,7 +17,7 @@ module.exports = function (context) {

return {
'ImportDeclaration': function (node) {
var imports = getExports(node.source.value, context)
var imports = Exports.get(node.source.value, context)
if (imports == null) return

if (imports.errors.length > 0) {
Expand Down
6 changes: 3 additions & 3 deletions src/rules/no-named-as-default.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { get as getExports } from '../core/getExports'
import Exports from '../core/getExports'
import importDeclaration from '../importDeclaration'

export default function (context) {
module.exports = function (context) {
function checkDefault(nameKey, defaultSpecifier) {
var declaration = importDeclaration(context)

var imports = getExports(declaration.source.value, context)
var imports = Exports.get(declaration.source.value, context)
if (imports == null) return

if (imports.hasDefault &&
Expand Down
6 changes: 3 additions & 3 deletions src/rules/no-require.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { get as getExports } from '../core/getExports'
import Exports from '../core/getExports'

export default function (context) {
module.exports = function (context) {
return {
'CallExpression': function (call) {
if (call.callee.type !== 'Identifier') return
Expand All @@ -12,7 +12,7 @@ export default function (context) {
if (module.type !== 'Literal') return
if (typeof module.value !== 'string') return

var imports = getExports(module.value, context)
var imports = Exports.get(module.value, context)
if (!imports || imports.hasDefault || imports.hasNamed) {
context.report(call.callee,
'CommonJS require of ES module \'' + module.value + '\'.')
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-unresolved.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
import resolve from '../core/resolve'

export default function (context) {
module.exports = function (context) {

function checkSource(node) {
if (node.source == null) return
Expand Down
7 changes: 3 additions & 4 deletions tests/src/core/getExports.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
'use strict'
import { expect } from 'chai'
import path from 'path'

var expect = require('chai').expect
, path = require('path')
var ExportMap = require('../../../lib/core/getExports')
import ExportMap from '../../../lib/core/getExports'

function getFilename(file) {
return path.join(__dirname, '..', '..', 'files', file || 'foo.js')
Expand Down
5 changes: 2 additions & 3 deletions tests/src/rules/no-unresolved.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
var path = require('path')

var test = require('../utils').test
import { test } from '../utils'

var linter = require('eslint').linter,
RuleTester = require('eslint').RuleTester
import { RuleTester } from 'eslint'

var ruleTester = new RuleTester()
, rule = require('../../../lib/rules/no-unresolved')
Expand Down

0 comments on commit 988d90d

Please sign in to comment.