diff --git a/package.json b/package.json index c60e9b2ad3..808f8e1ec2 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "chai": "^3.4.0", "coveralls": "^2.11.4", "cross-env": "^4.0.0", - "eslint": "3.x", + "eslint": "^4.0.0", "eslint-import-resolver-node": "file:./resolvers/node", "eslint-import-resolver-webpack": "file:./resolvers/webpack", "eslint-module-utils": "file:./utils", @@ -81,6 +81,7 @@ "contains-path": "^0.1.0", "debug": "^2.2.0", "doctrine": "1.5.0", + "escope": "^3.6.0", "eslint-import-resolver-node": "^0.2.0", "eslint-module-utils": "^2.0.0", "has": "^1.0.1", diff --git a/src/rules/no-amd.js b/src/rules/no-amd.js index 6686be9355..d7f457cb7e 100644 --- a/src/rules/no-amd.js +++ b/src/rules/no-amd.js @@ -17,7 +17,7 @@ module.exports = { return { 'CallExpression': function (node) { - if (context.getScope().type !== 'module') return + if (context.getScope().type !== 'module' && context.getScope().type !== 'global') return if (node.callee.type !== 'Identifier') return if (node.callee.name !== 'require' && diff --git a/src/rules/no-commonjs.js b/src/rules/no-commonjs.js index 62a0804f26..049dc68326 100644 --- a/src/rules/no-commonjs.js +++ b/src/rules/no-commonjs.js @@ -41,7 +41,7 @@ module.exports = { }, 'CallExpression': function (call) { - if (context.getScope().type !== 'module') return + if (context.getScope().type !== 'module' && context.getScope().type !== 'global') return if (call.callee.type !== 'Identifier') return if (call.callee.name !== 'require') return diff --git a/src/rules/no-named-default.js b/src/rules/no-named-default.js index 3185157f30..0625c1f1ea 100644 --- a/src/rules/no-named-default.js +++ b/src/rules/no-named-default.js @@ -10,7 +10,7 @@ module.exports = { if (im.type === 'ImportSpecifier' && im.imported.name === 'default') { context.report({ node: im.local, - message: `Use default import syntax to import \'${im.local.name}\'.` }) + message: `Use default import syntax to import '${im.local.name}'.` }) } }) }, diff --git a/tests/src/rules/default.js b/tests/src/rules/default.js index 5186e56ca4..0cb93e94a1 100644 --- a/tests/src/rules/default.js +++ b/tests/src/rules/default.js @@ -58,8 +58,7 @@ ruleTester.run('default', rule, { // #94: redux export of execution result, test({ code: 'import connectedApp from "./redux"' }), - test({ code: 'import App from "./jsx/App"' - , ecmaFeatures: { jsx: true, modules: true } }), + test({ code: 'import App from "./jsx/App"'}), // from no-errors test({ diff --git a/tests/src/rules/named.js b/tests/src/rules/named.js index f1c40b4749..ab54c3d7cc 100644 --- a/tests/src/rules/named.js +++ b/tests/src/rules/named.js @@ -135,7 +135,6 @@ ruleTester.run('named', rule, { test({ code: 'import { a } from "./re-export-names"', - args: [2, 'es6-only'], errors: [error('a', './re-export-names')], }),