From d6be9116737f61d3e4dd64b33a3a49b3f6b5b32d Mon Sep 17 00:00:00 2001
From: Thomas Sileghem
Date: Mon, 12 Jun 2017 14:30:56 +0100
Subject: [PATCH] chore(eslint): upgrade to eslint@4
---
.travis.yml | 6 ++++++
package.json | 6 ++++--
src/rules/no-amd.js | 2 +-
src/rules/no-commonjs.js | 2 +-
src/rules/no-named-default.js | 2 +-
tests/src/rules/default.js | 3 +--
tests/src/rules/named.js | 1 -
7 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 22918d3647..785789a418 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,9 +7,15 @@ os:
- linux
- osx
+env:
+ - ESLINT_VERSION=2
+ - ESLINT_VERSION=3
+ - ESLINT_VERSION=4
+
install:
- npm -g install npm@3
- npm install
+ - npm install eslint@$ESLINT_VERSION --ignore-scripts || true
# install all resolver deps
- "for resolver in ./resolvers/*; do cd $resolver && npm install && cd ../..; done"
diff --git a/package.json b/package.json
index c60e9b2ad3..eb088eb886 100644
--- a/package.json
+++ b/package.json
@@ -71,16 +71,18 @@
"rimraf": "2.5.2",
"sinon": "^2.3.2",
"typescript": "^2.0.3",
- "typescript-eslint-parser": "^2.1.0"
+ "typescript-eslint-parser": "^2.1.0",
+ "webpack": "^2.6.1"
},
"peerDependencies": {
- "eslint": "2.x - 3.x"
+ "eslint": "2.x - 4.x"
},
"dependencies": {
"builtin-modules": "^1.1.1",
"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')],
}),