From 15b0283650581c100da7fc6571df58c1ceee425b Mon Sep 17 00:00:00 2001 From: Kai Cataldo Date: Wed, 13 Nov 2019 19:40:27 -0500 Subject: [PATCH 001/569] --- lerna.json | 1 + 1 file changed, 1 insertion(+) diff --git a/lerna.json b/lerna.json index aaabc787806d..d51103fbc211 100644 --- a/lerna.json +++ b/lerna.json @@ -28,6 +28,7 @@ }, "packages": [ "codemods/*", + "eslint/*", "packages/*" ], "npmClient": "yarn", From 13feb7278e5c19c7e1b8d9177447525088e34e53 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 29 Jun 2016 16:40:35 -0400 Subject: [PATCH 002/569] init --- .../babel-eslint-config-internal/.gitignore | 1 + eslint/babel-eslint-config-internal/README.md | 3 + eslint/babel-eslint-config-internal/index.js | 64 +++++++++++++++++++ .../babel-eslint-config-internal/package.json | 21 ++++++ 4 files changed, 89 insertions(+) create mode 100644 eslint/babel-eslint-config-internal/.gitignore create mode 100644 eslint/babel-eslint-config-internal/README.md create mode 100644 eslint/babel-eslint-config-internal/index.js create mode 100644 eslint/babel-eslint-config-internal/package.json diff --git a/eslint/babel-eslint-config-internal/.gitignore b/eslint/babel-eslint-config-internal/.gitignore new file mode 100644 index 000000000000..3c3629e647f5 --- /dev/null +++ b/eslint/babel-eslint-config-internal/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/eslint/babel-eslint-config-internal/README.md b/eslint/babel-eslint-config-internal/README.md new file mode 100644 index 000000000000..9978722d8b5d --- /dev/null +++ b/eslint/babel-eslint-config-internal/README.md @@ -0,0 +1,3 @@ +eslint-config-babel + +eslint config for the babel codebase (copied from eslint-config-kittens) diff --git a/eslint/babel-eslint-config-internal/index.js b/eslint/babel-eslint-config-internal/index.js new file mode 100644 index 000000000000..11a9baa56090 --- /dev/null +++ b/eslint/babel-eslint-config-internal/index.js @@ -0,0 +1,64 @@ +module.exports = { + parser: "babel-eslint", + extends: "eslint:recommended", + plugins: ["flow-vars", "babel"], + rules: { + "flow-vars/define-flow-type": 1, + "flow-vars/use-flow-type": 1, + quotes: [2, "double"], + "no-var": 2, + "keyword-spacing": 2, + strict: 0, + "no-underscore-dangle": 0, + curly: 0, + "no-multi-spaces": 0, + "key-spacing": 0, + "no-return-assign": 0, + "consistent-return": 0, + "no-shadow": 0, + "comma-dangle": 0, + "no-use-before-define": 0, + "no-empty": 0, + "new-parens": 0, + "no-cond-assign": 0, + "no-fallthrough": 0, + "new-cap": 0, + "no-loop-func": 0, + "no-unreachable": 0, + "no-labels": 0, + "no-process-exit": 0, + camelcase: 0, + "no-console": 0, + "no-constant-condition": 0, + "no-inner-declarations": 0, + "no-case-declarations": 0, + semi: [2, "always"], + + // soft indent of 2 characters + "indent": [2, 2], + + // maximum length of 110 characters + "max-len": [2, 110, 2], + + // Enforce parens around arrow function arguments + "babel/arrow-parens": [2, "always"], + // Require a space on each side of arrow operator + "arrow-spacing": [2, { before: true, after: true }], + // Prevent using => in a condition where <= is intended + "no-confusing-arrow": 2, + // prevent no space in `if (){` + "space-before-blocks": "always" + }, + + globals: { + // Flow + Iterator: true, + $Keys: true + }, + + env: { + node: true, + es6: true, + browser: true + } +}; diff --git a/eslint/babel-eslint-config-internal/package.json b/eslint/babel-eslint-config-internal/package.json new file mode 100644 index 000000000000..04c3b0b3d1d3 --- /dev/null +++ b/eslint/babel-eslint-config-internal/package.json @@ -0,0 +1,21 @@ +{ + "name": "eslint-config-babel", + "version": "1.0.0", + "description": "eslint config for babel", + "author": "Sebastian McKenzie ", + "homepage": "https://babeljs.io/", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/babel/babel/tree/master/packages/eslint-config-babel" + }, + "main": "index.js", + "dependencies": { + "babel-eslint": "^6.0.0", + "eslint-plugin-babel": "^3.0.0", + "eslint-plugin-flow-vars": "^0.4.0" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + } +} From a48f2e209cc925de6afaac2e3b08770ee0f008e8 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 29 Jun 2016 17:33:26 -0400 Subject: [PATCH 003/569] fix bug with config, use other way of specifying severity --- eslint/babel-eslint-config-internal/index.js | 72 ++++++++++---------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/eslint/babel-eslint-config-internal/index.js b/eslint/babel-eslint-config-internal/index.js index 11a9baa56090..2643eaf35066 100644 --- a/eslint/babel-eslint-config-internal/index.js +++ b/eslint/babel-eslint-config-internal/index.js @@ -3,51 +3,51 @@ module.exports = { extends: "eslint:recommended", plugins: ["flow-vars", "babel"], rules: { - "flow-vars/define-flow-type": 1, - "flow-vars/use-flow-type": 1, - quotes: [2, "double"], - "no-var": 2, - "keyword-spacing": 2, - strict: 0, - "no-underscore-dangle": 0, - curly: 0, - "no-multi-spaces": 0, - "key-spacing": 0, - "no-return-assign": 0, - "consistent-return": 0, - "no-shadow": 0, - "comma-dangle": 0, - "no-use-before-define": 0, - "no-empty": 0, - "new-parens": 0, - "no-cond-assign": 0, - "no-fallthrough": 0, - "new-cap": 0, - "no-loop-func": 0, - "no-unreachable": 0, - "no-labels": 0, - "no-process-exit": 0, - camelcase: 0, - "no-console": 0, - "no-constant-condition": 0, - "no-inner-declarations": 0, - "no-case-declarations": 0, - semi: [2, "always"], + "flow-vars/define-flow-type": "warn", + "flow-vars/use-flow-type": "warn", + quotes: ["error", "double"], + "no-var": "error", + "keyword-spacing": "error", + strict: "off", + "no-underscore-dangle": "off", + curly: "off", + "no-multi-spaces": "off", + "key-spacing": "off", + "no-return-assign": "off", + "consistent-return": "off", + "no-shadow": "off", + "comma-dangle": "off", + "no-use-before-define": "off", + "no-empty": "off", + "new-parens": "off", + "no-cond-assign": "off", + "no-fallthrough": "off", + "new-cap": "off", + "no-loop-func": "off", + "no-unreachable": "off", + "no-labels": "off", + "no-process-exit": "off", + camelcase: "off", + "no-console": "off", + "no-constant-condition": "off", + "no-inner-declarations": "off", + "no-case-declarations": "off", + semi: ["error", "always"], // soft indent of 2 characters - "indent": [2, 2], + "indent": ["error", 2], // maximum length of 110 characters - "max-len": [2, 110, 2], + "max-len": ["error", 110, 2], // Enforce parens around arrow function arguments - "babel/arrow-parens": [2, "always"], + "babel/arrow-parens": ["error", "always"], // Require a space on each side of arrow operator - "arrow-spacing": [2, { before: true, after: true }], + "arrow-spacing": ["error", { before: true, after: true }], // Prevent using => in a condition where <= is intended - "no-confusing-arrow": 2, + "no-confusing-arrow": "error", // prevent no space in `if (){` - "space-before-blocks": "always" + "space-before-blocks": ["error", "always"] }, globals: { From 5706f0531ba70d62f64b9314e31ba176525f6a00 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 29 Jun 2016 17:33:34 -0400 Subject: [PATCH 004/569] 1.0.1 --- eslint/babel-eslint-config-internal/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-config-internal/package.json b/eslint/babel-eslint-config-internal/package.json index 04c3b0b3d1d3..41f3f6135aef 100644 --- a/eslint/babel-eslint-config-internal/package.json +++ b/eslint/babel-eslint-config-internal/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-babel", - "version": "1.0.0", + "version": "1.0.1", "description": "eslint config for babel", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", From bfa69bbdb63e44d95afdfb7586c7bfb214c83990 Mon Sep 17 00:00:00 2001 From: Bo Borgerson Date: Fri, 2 Sep 2016 15:48:46 -0700 Subject: [PATCH 005/569] Add the "space-infix-ops" rule (babel/eslint-config-babel#1) Require whitespace around infix operators. The babel code base already mostly satisfies this. Nice to keep it that way. This is used by Lerna, too. --- eslint/babel-eslint-config-internal/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eslint/babel-eslint-config-internal/index.js b/eslint/babel-eslint-config-internal/index.js index 2643eaf35066..925c8370725e 100644 --- a/eslint/babel-eslint-config-internal/index.js +++ b/eslint/babel-eslint-config-internal/index.js @@ -44,6 +44,8 @@ module.exports = { "babel/arrow-parens": ["error", "always"], // Require a space on each side of arrow operator "arrow-spacing": ["error", { before: true, after: true }], + // Require a space on each side of all infix operators + "space-infix-ops": "error", // Prevent using => in a condition where <= is intended "no-confusing-arrow": "error", // prevent no space in `if (){` From b95c7aa5568861ec6114ec6f2f4ce7e5a30fd72c Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 2 Sep 2016 18:49:34 -0400 Subject: [PATCH 006/569] 1.0.2 --- eslint/babel-eslint-config-internal/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-config-internal/package.json b/eslint/babel-eslint-config-internal/package.json index 41f3f6135aef..86bd94eb8ac2 100644 --- a/eslint/babel-eslint-config-internal/package.json +++ b/eslint/babel-eslint-config-internal/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-babel", - "version": "1.0.1", + "version": "1.0.2", "description": "eslint config for babel", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", From edcf1b59dd7022a01c18560acb3db58709e863b2 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Sat, 24 Sep 2016 08:09:47 +0200 Subject: [PATCH 007/569] Exchange flow plugin with new one (babel/eslint-config-babel#2) * Change to eslint-plugin-flowtype * Use new plugin * Make dependencies peerDependencies * Readd babel-eslint --- eslint/babel-eslint-config-internal/index.js | 4 ++-- eslint/babel-eslint-config-internal/package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eslint/babel-eslint-config-internal/index.js b/eslint/babel-eslint-config-internal/index.js index 925c8370725e..b4b144a942ac 100644 --- a/eslint/babel-eslint-config-internal/index.js +++ b/eslint/babel-eslint-config-internal/index.js @@ -3,8 +3,8 @@ module.exports = { extends: "eslint:recommended", plugins: ["flow-vars", "babel"], rules: { - "flow-vars/define-flow-type": "warn", - "flow-vars/use-flow-type": "warn", + "flowtype/define-flow-type": "warn", + "flowtype/use-flow-type": "warn", quotes: ["error", "double"], "no-var": "error", "keyword-spacing": "error", diff --git a/eslint/babel-eslint-config-internal/package.json b/eslint/babel-eslint-config-internal/package.json index 86bd94eb8ac2..3238118ea4a0 100644 --- a/eslint/babel-eslint-config-internal/package.json +++ b/eslint/babel-eslint-config-internal/package.json @@ -10,10 +10,10 @@ "url": "https://github.com/babel/babel/tree/master/packages/eslint-config-babel" }, "main": "index.js", - "dependencies": { + "peerDependencies": { "babel-eslint": "^6.0.0", "eslint-plugin-babel": "^3.0.0", - "eslint-plugin-flow-vars": "^0.4.0" + "eslint-plugin-flowtype": "^2.4.0" }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1" From c88f9033748e4176647b444e7927b22da3c91497 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 24 Sep 2016 02:10:40 -0400 Subject: [PATCH 008/569] readme [skip ci] --- eslint/babel-eslint-config-internal/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-config-internal/README.md b/eslint/babel-eslint-config-internal/README.md index 9978722d8b5d..cec3011183f8 100644 --- a/eslint/babel-eslint-config-internal/README.md +++ b/eslint/babel-eslint-config-internal/README.md @@ -1,3 +1,4 @@ -eslint-config-babel +## eslint-config-babel +--- eslint config for the babel codebase (copied from eslint-config-kittens) From 978f3392c5bc5cfdbb3683ea93d06aaed0a26b12 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Sat, 1 Oct 2016 18:12:29 +0200 Subject: [PATCH 009/569] Do not allow trailing spaces (babel/eslint-config-babel#3) --- eslint/babel-eslint-config-internal/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint/babel-eslint-config-internal/index.js b/eslint/babel-eslint-config-internal/index.js index b4b144a942ac..027e6b19ac10 100644 --- a/eslint/babel-eslint-config-internal/index.js +++ b/eslint/babel-eslint-config-internal/index.js @@ -27,6 +27,7 @@ module.exports = { "no-unreachable": "off", "no-labels": "off", "no-process-exit": "off", + "no-trailing-spaces": "error", camelcase: "off", "no-console": "off", "no-constant-condition": "off", From 0f877648277526795c5c6b2c6de3a20c835db8bd Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Sat, 1 Oct 2016 18:12:35 +0200 Subject: [PATCH 010/569] Ensure unix line endings (babel/eslint-config-babel#4) --- eslint/babel-eslint-config-internal/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint/babel-eslint-config-internal/index.js b/eslint/babel-eslint-config-internal/index.js index 027e6b19ac10..14ebfaac2753 100644 --- a/eslint/babel-eslint-config-internal/index.js +++ b/eslint/babel-eslint-config-internal/index.js @@ -6,6 +6,7 @@ module.exports = { "flowtype/define-flow-type": "warn", "flowtype/use-flow-type": "warn", quotes: ["error", "double"], + "linebreak-style": ["error", "unix"], "no-var": "error", "keyword-spacing": "error", strict: "off", From c3bc500240b3df6b8281bc7e9ced08a084ce9676 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 5 Oct 2016 16:32:19 -0400 Subject: [PATCH 011/569] update info/links --- eslint/babel-eslint-config-internal/README.md | 2 +- eslint/babel-eslint-config-internal/package.json | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eslint/babel-eslint-config-internal/README.md b/eslint/babel-eslint-config-internal/README.md index cec3011183f8..5f87298ead30 100644 --- a/eslint/babel-eslint-config-internal/README.md +++ b/eslint/babel-eslint-config-internal/README.md @@ -1,4 +1,4 @@ ## eslint-config-babel --- -eslint config for the babel codebase (copied from eslint-config-kittens) +ESLint config for the Babel codebase (originally taken from `eslint-config-kittens`) diff --git a/eslint/babel-eslint-config-internal/package.json b/eslint/babel-eslint-config-internal/package.json index 3238118ea4a0..3114be188482 100644 --- a/eslint/babel-eslint-config-internal/package.json +++ b/eslint/babel-eslint-config-internal/package.json @@ -1,17 +1,17 @@ { "name": "eslint-config-babel", "version": "1.0.2", - "description": "eslint config for babel", + "description": "ESLint config for babel", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/babel/babel/tree/master/packages/eslint-config-babel" + "url": "https://github.com/babel/eslint-config-babel" }, "main": "index.js", "peerDependencies": { - "babel-eslint": "^6.0.0", + "babel-eslint": "^7.0.0", "eslint-plugin-babel": "^3.0.0", "eslint-plugin-flowtype": "^2.4.0" }, From b2b1416fbcf7dad0e920d1c05e49b192f225f7b1 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 5 Oct 2016 16:32:27 -0400 Subject: [PATCH 012/569] 2.0.0 --- eslint/babel-eslint-config-internal/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-config-internal/package.json b/eslint/babel-eslint-config-internal/package.json index 3114be188482..41d33b1f8bb9 100644 --- a/eslint/babel-eslint-config-internal/package.json +++ b/eslint/babel-eslint-config-internal/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-babel", - "version": "1.0.2", + "version": "2.0.0", "description": "ESLint config for babel", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", From 1536dfda0a2b9b5f123b34789998c654d2df8ec2 Mon Sep 17 00:00:00 2001 From: Dan Harper Date: Wed, 5 Oct 2016 21:35:44 +0100 Subject: [PATCH 013/569] flowtype plugin (babel/eslint-config-babel#6) --- eslint/babel-eslint-config-internal/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-config-internal/index.js b/eslint/babel-eslint-config-internal/index.js index 14ebfaac2753..0320f320e25d 100644 --- a/eslint/babel-eslint-config-internal/index.js +++ b/eslint/babel-eslint-config-internal/index.js @@ -1,7 +1,7 @@ module.exports = { parser: "babel-eslint", extends: "eslint:recommended", - plugins: ["flow-vars", "babel"], + plugins: ["flowtype", "babel"], rules: { "flowtype/define-flow-type": "warn", "flowtype/use-flow-type": "warn", From 92794894132a28b87dbd79eba4ba568f5f0885e1 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 5 Oct 2016 16:36:03 -0400 Subject: [PATCH 014/569] 2.0.1 --- eslint/babel-eslint-config-internal/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-config-internal/package.json b/eslint/babel-eslint-config-internal/package.json index 41d33b1f8bb9..3db87c4829f3 100644 --- a/eslint/babel-eslint-config-internal/package.json +++ b/eslint/babel-eslint-config-internal/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-babel", - "version": "2.0.0", + "version": "2.0.1", "description": "ESLint config for babel", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", From 4819beb14937134fdfc1cad730b0d8bd78a6de9f Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 17 Nov 2016 18:03:01 -0500 Subject: [PATCH 015/569] use builtin (babel/eslint-config-babel#8) * use built-in * Update package.json --- eslint/babel-eslint-config-internal/index.js | 2 +- eslint/babel-eslint-config-internal/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-config-internal/index.js b/eslint/babel-eslint-config-internal/index.js index 0320f320e25d..cfa4f4ab0a3f 100644 --- a/eslint/babel-eslint-config-internal/index.js +++ b/eslint/babel-eslint-config-internal/index.js @@ -43,7 +43,7 @@ module.exports = { "max-len": ["error", 110, 2], // Enforce parens around arrow function arguments - "babel/arrow-parens": ["error", "always"], + "arrow-parens": ["error", "always"], // Require a space on each side of arrow operator "arrow-spacing": ["error", { before: true, after: true }], // Require a space on each side of all infix operators diff --git a/eslint/babel-eslint-config-internal/package.json b/eslint/babel-eslint-config-internal/package.json index 3db87c4829f3..bd9ce77d53d4 100644 --- a/eslint/babel-eslint-config-internal/package.json +++ b/eslint/babel-eslint-config-internal/package.json @@ -12,7 +12,7 @@ "main": "index.js", "peerDependencies": { "babel-eslint": "^7.0.0", - "eslint-plugin-babel": "^3.0.0", + "eslint-plugin-babel": "^4.0.0", "eslint-plugin-flowtype": "^2.4.0" }, "scripts": { From 1f4e239217655e84b831383f83099f7e9f791408 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 17 Nov 2016 18:03:35 -0500 Subject: [PATCH 016/569] 3.0.0 --- eslint/babel-eslint-config-internal/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-config-internal/package.json b/eslint/babel-eslint-config-internal/package.json index bd9ce77d53d4..b2adea3fae7d 100644 --- a/eslint/babel-eslint-config-internal/package.json +++ b/eslint/babel-eslint-config-internal/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-babel", - "version": "2.0.1", + "version": "3.0.0", "description": "ESLint config for babel", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", From 6117b83b55f3ee6cc025f4484bc842db9f77edfd Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sun, 8 Jan 2017 22:19:01 -0500 Subject: [PATCH 017/569] Merge pull request babel/eslint-config-babel#9 from kaicataldo/prefer-const Enable prefer-const --- eslint/babel-eslint-config-internal/index.js | 75 +++++++++----------- 1 file changed, 32 insertions(+), 43 deletions(-) diff --git a/eslint/babel-eslint-config-internal/index.js b/eslint/babel-eslint-config-internal/index.js index cfa4f4ab0a3f..14cb43a3a684 100644 --- a/eslint/babel-eslint-config-internal/index.js +++ b/eslint/babel-eslint-config-internal/index.js @@ -1,65 +1,54 @@ module.exports = { parser: "babel-eslint", extends: "eslint:recommended", - plugins: ["flowtype", "babel"], + plugins: ["flowtype"], rules: { - "flowtype/define-flow-type": "warn", - "flowtype/use-flow-type": "warn", - quotes: ["error", "double"], - "linebreak-style": ["error", "unix"], - "no-var": "error", - "keyword-spacing": "error", - strict: "off", - "no-underscore-dangle": "off", + "arrow-parens": ["error", "always"], + "arrow-spacing": ["error", { before: true, after: true }], + camelcase: "off", + "comma-dangle": "off", + "consistent-return": "off", curly: "off", - "no-multi-spaces": "off", + "indent": ["error", 2], + "linebreak-style": ["error", "unix"], "key-spacing": "off", - "no-return-assign": "off", - "consistent-return": "off", - "no-shadow": "off", - "comma-dangle": "off", - "no-use-before-define": "off", - "no-empty": "off", + "keyword-spacing": "error", + "max-len": ["error", 110, 2], + "new-cap": "off", "new-parens": "off", + "no-case-declarations": "off", "no-cond-assign": "off", + "no-confusing-arrow": "error", + "no-console": "off", + "no-constant-condition": "off", + "no-empty": "off", "no-fallthrough": "off", - "new-cap": "off", - "no-loop-func": "off", - "no-unreachable": "off", + "no-inner-declarations": "off", + "no-multi-spaces": "off", "no-labels": "off", + "no-loop-func": "off", "no-process-exit": "off", + "no-return-assign": "off", + "no-shadow": "off", "no-trailing-spaces": "error", - camelcase: "off", - "no-console": "off", - "no-constant-condition": "off", - "no-inner-declarations": "off", - "no-case-declarations": "off", - semi: ["error", "always"], - - // soft indent of 2 characters - "indent": ["error", 2], - - // maximum length of 110 characters - "max-len": ["error", 110, 2], - - // Enforce parens around arrow function arguments - "arrow-parens": ["error", "always"], - // Require a space on each side of arrow operator - "arrow-spacing": ["error", { before: true, after: true }], - // Require a space on each side of all infix operators + "no-underscore-dangle": "off", + "no-unreachable": "off", + "no-use-before-define": "off", + "no-var": "error", + "prefer-const": "error", + quotes: ["error", "double"], + "space-before-blocks": ["error", "always"], "space-infix-ops": "error", - // Prevent using => in a condition where <= is intended - "no-confusing-arrow": "error", - // prevent no space in `if (){` - "space-before-blocks": ["error", "always"] + semi: ["error", "always"], + strict: "off" + "flowtype/define-flow-type": "warn", + "flowtype/use-flow-type": "warn", }, - globals: { // Flow Iterator: true, $Keys: true }, - env: { node: true, es6: true, From 42ad818e3f1f3dc7170d805e74791d28b1c02f1a Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sun, 8 Jan 2017 22:19:51 -0500 Subject: [PATCH 018/569] 4.0.0 --- eslint/babel-eslint-config-internal/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-config-internal/package.json b/eslint/babel-eslint-config-internal/package.json index b2adea3fae7d..87e89b8675e2 100644 --- a/eslint/babel-eslint-config-internal/package.json +++ b/eslint/babel-eslint-config-internal/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-babel", - "version": "3.0.0", + "version": "4.0.0", "description": "ESLint config for babel", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", From ff304c3890d5ca72abdab5fad179bbb0942d4958 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 10 Jan 2017 12:26:45 -0500 Subject: [PATCH 019/569] fix --- eslint/babel-eslint-config-internal/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-config-internal/index.js b/eslint/babel-eslint-config-internal/index.js index 14cb43a3a684..aca31ea0e5e5 100644 --- a/eslint/babel-eslint-config-internal/index.js +++ b/eslint/babel-eslint-config-internal/index.js @@ -40,7 +40,7 @@ module.exports = { "space-before-blocks": ["error", "always"], "space-infix-ops": "error", semi: ["error", "always"], - strict: "off" + strict: "off", "flowtype/define-flow-type": "warn", "flowtype/use-flow-type": "warn", }, From d9b467403a6e5261827dd86a10949bc71a0bf892 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 10 Jan 2017 12:27:01 -0500 Subject: [PATCH 020/569] 4.0.1 --- eslint/babel-eslint-config-internal/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-config-internal/package.json b/eslint/babel-eslint-config-internal/package.json index 87e89b8675e2..427f3596cbc7 100644 --- a/eslint/babel-eslint-config-internal/package.json +++ b/eslint/babel-eslint-config-internal/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-babel", - "version": "4.0.0", + "version": "4.0.1", "description": "ESLint config for babel", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", From 292003444db721936e18cd29b361ac91b9ad2807 Mon Sep 17 00:00:00 2001 From: Kai Cataldo Date: Sat, 14 Jan 2017 07:51:07 -0500 Subject: [PATCH 021/569] peerDeps: remove eslint-plugin-babel (babel/eslint-config-babel#13) --- eslint/babel-eslint-config-internal/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/eslint/babel-eslint-config-internal/package.json b/eslint/babel-eslint-config-internal/package.json index 427f3596cbc7..8c10582435e4 100644 --- a/eslint/babel-eslint-config-internal/package.json +++ b/eslint/babel-eslint-config-internal/package.json @@ -12,7 +12,6 @@ "main": "index.js", "peerDependencies": { "babel-eslint": "^7.0.0", - "eslint-plugin-babel": "^4.0.0", "eslint-plugin-flowtype": "^2.4.0" }, "scripts": { From d4a1e97249cfd18153b03b5909079566510b50fb Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Sat, 14 Jan 2017 13:51:22 +0100 Subject: [PATCH 022/569] Add comma-spacing rule (babel/eslint-config-babel#11) --- eslint/babel-eslint-config-internal/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint/babel-eslint-config-internal/index.js b/eslint/babel-eslint-config-internal/index.js index aca31ea0e5e5..2dd105c78d75 100644 --- a/eslint/babel-eslint-config-internal/index.js +++ b/eslint/babel-eslint-config-internal/index.js @@ -7,6 +7,7 @@ module.exports = { "arrow-spacing": ["error", { before: true, after: true }], camelcase: "off", "comma-dangle": "off", + "comma-spacing": "error", "consistent-return": "off", curly: "off", "indent": ["error", 2], From af4dcb616dbd7f830f29a6122156ce6f0d1f9c8f Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Sat, 14 Jan 2017 13:51:41 +0100 Subject: [PATCH 023/569] better indent switch, iife, multiline functions (babel/eslint-config-babel#10) --- eslint/babel-eslint-config-internal/index.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-config-internal/index.js b/eslint/babel-eslint-config-internal/index.js index 2dd105c78d75..9d2573fadaac 100644 --- a/eslint/babel-eslint-config-internal/index.js +++ b/eslint/babel-eslint-config-internal/index.js @@ -10,7 +10,21 @@ module.exports = { "comma-spacing": "error", "consistent-return": "off", curly: "off", - "indent": ["error", 2], + indent: ["error", 2, { + SwitchCase: 1, + outerIIFEBody: 1, + FunctionDeclaration: { + parameters: 1, + body: 1, + }, + FunctionExpression: { + parameters: 1, + body: 1, + }, + CallExpression: { + parameters: 1, + } + }], "linebreak-style": ["error", "unix"], "key-spacing": "off", "keyword-spacing": "error", From cada67daeb8eea8a52c4a12c584801d79d8f47d8 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 14 Jan 2017 07:54:17 -0500 Subject: [PATCH 024/569] 5.0.0 --- eslint/babel-eslint-config-internal/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-config-internal/package.json b/eslint/babel-eslint-config-internal/package.json index 8c10582435e4..096bf6f28121 100644 --- a/eslint/babel-eslint-config-internal/package.json +++ b/eslint/babel-eslint-config-internal/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-babel", - "version": "4.0.1", + "version": "5.0.0", "description": "ESLint config for babel", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", From 3bbc507a3f9a84afd5c5ca5a9403382be12e7b8f Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Sat, 14 Jan 2017 22:00:42 +0100 Subject: [PATCH 025/569] Add object-curly-spacing rule (babel/eslint-config-babel#14) Fixes babel/eslint-config-babel#12 --- eslint/babel-eslint-config-internal/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint/babel-eslint-config-internal/index.js b/eslint/babel-eslint-config-internal/index.js index 9d2573fadaac..409967ea660e 100644 --- a/eslint/babel-eslint-config-internal/index.js +++ b/eslint/babel-eslint-config-internal/index.js @@ -50,6 +50,7 @@ module.exports = { "no-unreachable": "off", "no-use-before-define": "off", "no-var": "error", + "object-curly-spacing": ["error", "always"], "prefer-const": "error", quotes: ["error", "double"], "space-before-blocks": ["error", "always"], From 50122b70781ad6c111715f6ced47963f7c7d6278 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 14 Jan 2017 16:01:07 -0500 Subject: [PATCH 026/569] 6.0.0 --- eslint/babel-eslint-config-internal/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-config-internal/package.json b/eslint/babel-eslint-config-internal/package.json index 096bf6f28121..61455462bcaa 100644 --- a/eslint/babel-eslint-config-internal/package.json +++ b/eslint/babel-eslint-config-internal/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-babel", - "version": "5.0.0", + "version": "6.0.0", "description": "ESLint config for babel", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", From 773c3405143741b1bb51fe8e250616c3b41677b8 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Mon, 20 Feb 2017 16:59:50 +0100 Subject: [PATCH 027/569] Add func-call-spacing rule (babel/eslint-config-babel#15) --- eslint/babel-eslint-config-internal/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint/babel-eslint-config-internal/index.js b/eslint/babel-eslint-config-internal/index.js index 409967ea660e..71f03ee39dac 100644 --- a/eslint/babel-eslint-config-internal/index.js +++ b/eslint/babel-eslint-config-internal/index.js @@ -10,6 +10,7 @@ module.exports = { "comma-spacing": "error", "consistent-return": "off", curly: "off", + "func-call-spacing": "error", indent: ["error", 2, { SwitchCase: 1, outerIIFEBody: 1, From 1ce807d5de5bc72d35d135d3163ea5bf7ad46e26 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Mon, 20 Feb 2017 17:14:45 +0100 Subject: [PATCH 028/569] Enable key-spacing and no-multi-spaces (babel/eslint-config-babel#18) Fixes babel/eslint-config-babel#16 --- eslint/babel-eslint-config-internal/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-config-internal/index.js b/eslint/babel-eslint-config-internal/index.js index 71f03ee39dac..f014d6bc53d1 100644 --- a/eslint/babel-eslint-config-internal/index.js +++ b/eslint/babel-eslint-config-internal/index.js @@ -27,7 +27,7 @@ module.exports = { } }], "linebreak-style": ["error", "unix"], - "key-spacing": "off", + "key-spacing": "error", "keyword-spacing": "error", "max-len": ["error", 110, 2], "new-cap": "off", @@ -40,7 +40,7 @@ module.exports = { "no-empty": "off", "no-fallthrough": "off", "no-inner-declarations": "off", - "no-multi-spaces": "off", + "no-multi-spaces": "error", "no-labels": "off", "no-loop-func": "off", "no-process-exit": "off", From 8a527d1ef53ef8116d955305ec889f9ee7ab750a Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Mon, 20 Feb 2017 17:45:06 +0100 Subject: [PATCH 029/569] Enable comma-dangle (babel/eslint-config-babel#19) --- eslint/babel-eslint-config-internal/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-config-internal/index.js b/eslint/babel-eslint-config-internal/index.js index f014d6bc53d1..4a827248f7f5 100644 --- a/eslint/babel-eslint-config-internal/index.js +++ b/eslint/babel-eslint-config-internal/index.js @@ -6,7 +6,7 @@ module.exports = { "arrow-parens": ["error", "always"], "arrow-spacing": ["error", { before: true, after: true }], camelcase: "off", - "comma-dangle": "off", + "comma-dangle": ["error", "always-multiline"], "comma-spacing": "error", "consistent-return": "off", curly: "off", From a2f678151d32f0d106e10394b081b6dace9eb291 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Sat, 17 Jun 2017 13:35:03 -0500 Subject: [PATCH 030/569] Breaking: Drop style rules (babel/eslint-config-babel#22) * Drop style rules * es tweaks * fix * Update index.js --- eslint/babel-eslint-config-internal/index.js | 35 +++----------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/eslint/babel-eslint-config-internal/index.js b/eslint/babel-eslint-config-internal/index.js index 4a827248f7f5..a249588d2713 100644 --- a/eslint/babel-eslint-config-internal/index.js +++ b/eslint/babel-eslint-config-internal/index.js @@ -2,36 +2,17 @@ module.exports = { parser: "babel-eslint", extends: "eslint:recommended", plugins: ["flowtype"], + parserOptions: { + ecmaVersion: 2017, + sourceType: "module" + }, rules: { - "arrow-parens": ["error", "always"], - "arrow-spacing": ["error", { before: true, after: true }], camelcase: "off", - "comma-dangle": ["error", "always-multiline"], - "comma-spacing": "error", "consistent-return": "off", curly: "off", - "func-call-spacing": "error", - indent: ["error", 2, { - SwitchCase: 1, - outerIIFEBody: 1, - FunctionDeclaration: { - parameters: 1, - body: 1, - }, - FunctionExpression: { - parameters: 1, - body: 1, - }, - CallExpression: { - parameters: 1, - } - }], "linebreak-style": ["error", "unix"], - "key-spacing": "error", - "keyword-spacing": "error", "max-len": ["error", 110, 2], "new-cap": "off", - "new-parens": "off", "no-case-declarations": "off", "no-cond-assign": "off", "no-confusing-arrow": "error", @@ -40,23 +21,16 @@ module.exports = { "no-empty": "off", "no-fallthrough": "off", "no-inner-declarations": "off", - "no-multi-spaces": "error", "no-labels": "off", "no-loop-func": "off", "no-process-exit": "off", "no-return-assign": "off", "no-shadow": "off", - "no-trailing-spaces": "error", "no-underscore-dangle": "off", "no-unreachable": "off", "no-use-before-define": "off", "no-var": "error", - "object-curly-spacing": ["error", "always"], "prefer-const": "error", - quotes: ["error", "double"], - "space-before-blocks": ["error", "always"], - "space-infix-ops": "error", - semi: ["error", "always"], strict: "off", "flowtype/define-flow-type": "warn", "flowtype/use-flow-type": "warn", @@ -68,7 +42,6 @@ module.exports = { }, env: { node: true, - es6: true, browser: true } }; From 4b35717b04762dca7f385428a2be6f1aa5db930b Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 17 Jun 2017 14:35:27 -0400 Subject: [PATCH 031/569] 7.0.0 --- eslint/babel-eslint-config-internal/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-config-internal/package.json b/eslint/babel-eslint-config-internal/package.json index 61455462bcaa..9e2bce43432a 100644 --- a/eslint/babel-eslint-config-internal/package.json +++ b/eslint/babel-eslint-config-internal/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-babel", - "version": "6.0.0", + "version": "7.0.0", "description": "ESLint config for babel", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", From 288a74e55f1b6f3cab17df142d2597514b61f9c2 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Sat, 17 Jun 2017 13:53:32 -0500 Subject: [PATCH 032/569] Re-add es6 env option (babel/eslint-config-babel#24) --- eslint/babel-eslint-config-internal/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint/babel-eslint-config-internal/index.js b/eslint/babel-eslint-config-internal/index.js index a249588d2713..5c5fb5632770 100644 --- a/eslint/babel-eslint-config-internal/index.js +++ b/eslint/babel-eslint-config-internal/index.js @@ -42,6 +42,7 @@ module.exports = { }, env: { node: true, + es6: true, browser: true } }; From 794e8b12eb77a2a59e0397b927fd6607d5b46fd1 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 17 Jun 2017 14:53:43 -0400 Subject: [PATCH 033/569] 7.0.1 --- eslint/babel-eslint-config-internal/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-config-internal/package.json b/eslint/babel-eslint-config-internal/package.json index 9e2bce43432a..3e64bbe049bf 100644 --- a/eslint/babel-eslint-config-internal/package.json +++ b/eslint/babel-eslint-config-internal/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-babel", - "version": "7.0.0", + "version": "7.0.1", "description": "ESLint config for babel", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", From 85d858984ba1f57fbfed0825259e21b1cb18befe Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Mon, 7 Aug 2017 18:58:40 -0500 Subject: [PATCH 034/569] Update babel-eslint peer dep (babel/eslint-config-babel#25) --- eslint/babel-eslint-config-internal/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-config-internal/package.json b/eslint/babel-eslint-config-internal/package.json index 3e64bbe049bf..070ad2a32b99 100644 --- a/eslint/babel-eslint-config-internal/package.json +++ b/eslint/babel-eslint-config-internal/package.json @@ -11,7 +11,7 @@ }, "main": "index.js", "peerDependencies": { - "babel-eslint": "^7.0.0", + "babel-eslint": "^7.0.0 || ^8.0.0-alpha", "eslint-plugin-flowtype": "^2.4.0" }, "scripts": { From a47d722c076210ff776ceca99fdfebbb8e01c506 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 7 Aug 2017 19:59:01 -0400 Subject: [PATCH 035/569] 7.0.2 --- eslint/babel-eslint-config-internal/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-config-internal/package.json b/eslint/babel-eslint-config-internal/package.json index 070ad2a32b99..7e5b554e8aee 100644 --- a/eslint/babel-eslint-config-internal/package.json +++ b/eslint/babel-eslint-config-internal/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-babel", - "version": "7.0.1", + "version": "7.0.2", "description": "ESLint config for babel", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", From 74d47288c0ad140c5e1f5a42c9829c859b6608f6 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Tue, 11 Sep 2018 10:28:24 -0500 Subject: [PATCH 036/569] Merge pull request babel/eslint-config-babel#28 from babel/b --- eslint/babel-eslint-config-internal/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-config-internal/package.json b/eslint/babel-eslint-config-internal/package.json index 7e5b554e8aee..e3bfd4bcbffa 100644 --- a/eslint/babel-eslint-config-internal/package.json +++ b/eslint/babel-eslint-config-internal/package.json @@ -11,7 +11,7 @@ }, "main": "index.js", "peerDependencies": { - "babel-eslint": "^7.0.0 || ^8.0.0-alpha", + "babel-eslint": "^7.0.0 || ^8.0.0 || ^9.0.0", "eslint-plugin-flowtype": "^2.4.0" }, "scripts": { From 7499b0cab0f80a28cfebf7c31dbfc6eadd1d43e5 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Tue, 11 Sep 2018 10:28:37 -0500 Subject: [PATCH 037/569] Merge pull request babel/eslint-config-babel#20 from babel/existentialism-patch-1 --- eslint/babel-eslint-config-internal/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eslint/babel-eslint-config-internal/index.js b/eslint/babel-eslint-config-internal/index.js index 5c5fb5632770..82d4013ef665 100644 --- a/eslint/babel-eslint-config-internal/index.js +++ b/eslint/babel-eslint-config-internal/index.js @@ -7,13 +7,13 @@ module.exports = { sourceType: "module" }, rules: { - camelcase: "off", + "camelcase": "off", "consistent-return": "off", - curly: "off", + "curly": ["error", "multi-line"], "linebreak-style": ["error", "unix"], "max-len": ["error", 110, 2], "new-cap": "off", - "no-case-declarations": "off", + "no-case-declarations": "error", "no-cond-assign": "off", "no-confusing-arrow": "error", "no-console": "off", @@ -31,7 +31,7 @@ module.exports = { "no-use-before-define": "off", "no-var": "error", "prefer-const": "error", - strict: "off", + "strict": "off", "flowtype/define-flow-type": "warn", "flowtype/use-flow-type": "warn", }, From e13c2f535c155fc9a0a22fbd1b1f2f50e53b9793 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Tue, 11 Sep 2018 11:20:13 -0500 Subject: [PATCH 038/569] 8.0.0 --- eslint/babel-eslint-config-internal/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-config-internal/package.json b/eslint/babel-eslint-config-internal/package.json index e3bfd4bcbffa..9b9eb2dfd31a 100644 --- a/eslint/babel-eslint-config-internal/package.json +++ b/eslint/babel-eslint-config-internal/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-babel", - "version": "7.0.2", + "version": "8.0.0", "description": "ESLint config for babel", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", From a3230ce73076c4ff18fef1c90f86652036c31bc4 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Tue, 25 Sep 2018 16:24:38 -0500 Subject: [PATCH 039/569] Merge pull request babel/eslint-config-babel#29 from babel/babel-eslint --- eslint/babel-eslint-config-internal/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-config-internal/package.json b/eslint/babel-eslint-config-internal/package.json index 9b9eb2dfd31a..42f4712bdaf4 100644 --- a/eslint/babel-eslint-config-internal/package.json +++ b/eslint/babel-eslint-config-internal/package.json @@ -11,7 +11,7 @@ }, "main": "index.js", "peerDependencies": { - "babel-eslint": "^7.0.0 || ^8.0.0 || ^9.0.0", + "babel-eslint": "^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0", "eslint-plugin-flowtype": "^2.4.0" }, "scripts": { From ad2ca8dd4b70e378e2402b5ded7d8d3b7db34e0b Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Wed, 21 Nov 2018 09:09:28 -0600 Subject: [PATCH 040/569] Merge tag 'v8.0.1' 8.0.1 --- eslint/babel-eslint-config-internal/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-config-internal/package.json b/eslint/babel-eslint-config-internal/package.json index 42f4712bdaf4..1eced636406f 100644 --- a/eslint/babel-eslint-config-internal/package.json +++ b/eslint/babel-eslint-config-internal/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-babel", - "version": "8.0.0", + "version": "8.0.1", "description": "ESLint config for babel", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", From 0076d85f5da04a085c8b2b7ccd0fbdf161cf6355 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Wed, 21 Nov 2018 09:04:12 -0600 Subject: [PATCH 041/569] Relax eslint-plugin-flowtype peerDep --- eslint/babel-eslint-config-internal/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-config-internal/package.json b/eslint/babel-eslint-config-internal/package.json index 1eced636406f..75a85890be89 100644 --- a/eslint/babel-eslint-config-internal/package.json +++ b/eslint/babel-eslint-config-internal/package.json @@ -12,7 +12,7 @@ "main": "index.js", "peerDependencies": { "babel-eslint": "^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0", - "eslint-plugin-flowtype": "^2.4.0" + "eslint-plugin-flowtype": "^2 || ^3" }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1" From 7c39f9477f3a4675cdaa7634e91451d2333b6a0f Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Wed, 21 Nov 2018 09:10:50 -0600 Subject: [PATCH 042/569] 8.0.2 --- eslint/babel-eslint-config-internal/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-config-internal/package.json b/eslint/babel-eslint-config-internal/package.json index 75a85890be89..0f55c9aa817f 100644 --- a/eslint/babel-eslint-config-internal/package.json +++ b/eslint/babel-eslint-config-internal/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-babel", - "version": "8.0.1", + "version": "8.0.2", "description": "ESLint config for babel", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", From 3a5d6ee4337490591533283e64aca823cb2359ab Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Sun, 10 Feb 2019 14:17:27 -0800 Subject: [PATCH 043/569] Update peer dependencies and allow babel-eslint 11 --- eslint/babel-eslint-config-internal/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-config-internal/package.json b/eslint/babel-eslint-config-internal/package.json index 0f55c9aa817f..6bc1fd7f704b 100644 --- a/eslint/babel-eslint-config-internal/package.json +++ b/eslint/babel-eslint-config-internal/package.json @@ -11,8 +11,8 @@ }, "main": "index.js", "peerDependencies": { - "babel-eslint": "^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0", - "eslint-plugin-flowtype": "^2 || ^3" + "babel-eslint": "^10.0.0 || ^11.0.0-0", + "eslint-plugin-flowtype": "^3.0.0" }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1" From b0fcf28267e064233736a682ba7913ec46067684 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Sun, 10 Feb 2019 14:19:02 -0800 Subject: [PATCH 044/569] 9.0.0 --- eslint/babel-eslint-config-internal/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-config-internal/package.json b/eslint/babel-eslint-config-internal/package.json index 6bc1fd7f704b..a46867e3c69f 100644 --- a/eslint/babel-eslint-config-internal/package.json +++ b/eslint/babel-eslint-config-internal/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-babel", - "version": "8.0.2", + "version": "9.0.0", "description": "ESLint config for babel", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", From 5d5c7c6ae1fe165de1a887b3586b71c7bb7dd881 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Fri, 27 Feb 2015 21:44:06 +1100 Subject: [PATCH 045/569] first commit --- eslint/babel-eslint-parser/.gitignore | 1 + eslint/babel-eslint-parser/LICENSE | 22 ++++++ eslint/babel-eslint-parser/README.md | 34 ++++++++ .../babel-eslint-parser/acorn-to-esprima.js | 50 ++++++++++++ eslint/babel-eslint-parser/index.js | 77 +++++++++++++++++++ eslint/babel-eslint-parser/package.json | 20 +++++ 6 files changed, 204 insertions(+) create mode 100644 eslint/babel-eslint-parser/.gitignore create mode 100644 eslint/babel-eslint-parser/LICENSE create mode 100644 eslint/babel-eslint-parser/README.md create mode 100644 eslint/babel-eslint-parser/acorn-to-esprima.js create mode 100644 eslint/babel-eslint-parser/index.js create mode 100644 eslint/babel-eslint-parser/package.json diff --git a/eslint/babel-eslint-parser/.gitignore b/eslint/babel-eslint-parser/.gitignore new file mode 100644 index 000000000000..3c3629e647f5 --- /dev/null +++ b/eslint/babel-eslint-parser/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/eslint/babel-eslint-parser/LICENSE b/eslint/babel-eslint-parser/LICENSE new file mode 100644 index 000000000000..dac23744b010 --- /dev/null +++ b/eslint/babel-eslint-parser/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2014-2015 Sebastian McKenzie + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md new file mode 100644 index 000000000000..c6a433f04f2d --- /dev/null +++ b/eslint/babel-eslint-parser/README.md @@ -0,0 +1,34 @@ +# babel-eslint + +**babel-eslint** allows you to lint **ALL** valid Babel code with the fantastic +[eslint](https://github.com/eslint/eslint). + +**NOTE:** Please note that this is experimental and may have numerous bugs. It is however +successfuly linting the [babel core](https://github.com/babel/babel/blob/master/.eslintrc). + +## Usage + +### Install + +```sh +$ npm install eslint babel-eslint +``` + +### Setup + +**.eslintrc** + +```json +{ + "parser": "babel-eslint", + "rules": { + "strict": 0 + } +} +``` + +### Run + +```sh +$ eslint your-files-here +``` diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js new file mode 100644 index 000000000000..6040a3d65432 --- /dev/null +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -0,0 +1,50 @@ +var tokTypes = require("babel").acorn.tokTypes; +var traverse = require("babel").traverse; +var t = require("babel").types; + +exports.toToken = function (token) { + var type = token.type; + + if (type === tokTypes.name) { + token.type = "Identifier"; + } else if (type === tokTypes.semi || type === tokTypes.comma || type === tokTypes.parenL || type === tokTypes.parenR || type === tokTypes.braceL || type === tokTypes.braceR) { + token.type = "Punctuator"; + token.value = type.type; + } + + return token; +}; + +exports.toAST = function (ast) { + traverse(ast, astTransformVisitor); +}; + +var astTransformVisitor = { + noScope: true, + enter: function (node) { + if (t.isImportBatchSpecifier(node)) { + node.type = "ImportNamespaceSpecifier"; + node.id = node.name; + delete node.name; + } else if (t.isFunction(node)) { + node.defaults = []; + + node.params = node.params.map(function (param) { + if (t.isAssignmentPattern(param)) { + node.defaults.push(param.right); + return param.left; + } else { + node.defaults.push(null); + return param; + } + }); + + // rest + if (t.isRestElement(node.params[node.params.length - 1])) { + node.rest = node.params.pop(); + } + } else if (t.isClassProperty(node)) { + this.remove(); + } + } +}; diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js new file mode 100644 index 000000000000..ee476e9bfecc --- /dev/null +++ b/eslint/babel-eslint-parser/index.js @@ -0,0 +1,77 @@ +var acornToEsprima = require("./acorn-to-esprima"); +var traverse = require("babel").traverse; +var extend = require("lodash/object/extend"); +var Module = require("module"); +var acorn = require("babel").acorn; +var path = require("path"); +var t = require("babel").types; + +var hasPatched = false; + +function createModule(filename) { + var mod = new Module(filename); + mod.filename = filename; + mod.paths = Module._nodeModulePaths(path.dirname(filename)); + return mod; +} + +function monkeypatch() { + if (hasPatched) return; + hasPatched = true; + + var eslintLoc; + try { + eslintLoc = require.resolve("eslint"); + } catch (err) { + throw new ReferenceError("couldn't resolve eslint"); + } + + // get modules relative to what eslint will load + var eslintMod = createModule(eslintLoc); + var escopeLoc = Module._resolveFilename("escope", eslintMod); + var escopeMod = createModule(escopeLoc); + + // monkeypatch estraverse + var estraverse = escopeMod.require("estraverse"); + extend(estraverse.VisitorKeys, t.VISITOR_KEYS); + + // monkeypatch escope + var escope = require(escopeLoc); + var analyze = escope.analyze; + escope.analyze = function (ast, opts) { + opts.ecmaVersion = 6; + opts.sourceType = "module"; + return analyze.call(this, ast, opts) + }; +} + +exports.parse = function (code) { + try { + monkeypatch(); + } catch (err) { + console.error(err.stack); + process.exit(1); + } + + var opts = {}; + opts.ecmaVersion = 7; + opts.playground = true; + opts.locations = true; + opts.ranges = true; + + var comments = opts.onComment = []; + var tokens = opts.onToken = []; + + var ast = acorn.parse(code, opts); + + // convert tokens + ast.tokens = tokens.map(acornToEsprima.toToken); + + // add comments + ast.comments = comments; + + // transform esprima and acorn divergent nodes + acornToEsprima.toAST(ast); + + return ast; +}; diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json new file mode 100644 index 000000000000..be6c731f536d --- /dev/null +++ b/eslint/babel-eslint-parser/package.json @@ -0,0 +1,20 @@ +{ + "name": "babel-eslint", + "version": "1.0.3", + "description": "", + "main": "index.js", + "repository": { + "type": "git", + "url": "https://github.com/babel/babel-eslint.git" + }, + "dependencies": { + "babel": "^4.6.0", + "lodash": "^3.3.1" + }, + "author": "Sebastian McKenzie ", + "license": "MIT", + "bugs": { + "url": "https://github.com/babel/babel-eslint/issues" + }, + "homepage": "https://github.com/babel/babel-eslint" +} From d70e358a948834ef653b0077281139247689d97c Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Fri, 27 Feb 2015 21:49:54 +1100 Subject: [PATCH 046/569] clean up readme --- eslint/babel-eslint-parser/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index c6a433f04f2d..dd638879244f 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -1,7 +1,7 @@ # babel-eslint **babel-eslint** allows you to lint **ALL** valid Babel code with the fantastic -[eslint](https://github.com/eslint/eslint). +[ESLint](https://github.com/eslint/eslint). **NOTE:** Please note that this is experimental and may have numerous bugs. It is however successfuly linting the [babel core](https://github.com/babel/babel/blob/master/.eslintrc). @@ -27,6 +27,8 @@ $ npm install eslint babel-eslint } ``` +Check out the [ESLint docs](http://eslint.org/docs/rules/) for all possible rules. + ### Run ```sh From 5c226d0451b1249661f4fb9b05ec786349eb4429 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Fri, 27 Feb 2015 21:57:03 +1100 Subject: [PATCH 047/569] add more comments to acorn-to-esprima source --- eslint/babel-eslint-parser/acorn-to-esprima.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index 6040a3d65432..e149e9020b05 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -23,12 +23,13 @@ var astTransformVisitor = { noScope: true, enter: function (node) { if (t.isImportBatchSpecifier(node)) { + // ImportBatchSpecifier => ImportNamespaceSpecifier node.type = "ImportNamespaceSpecifier"; node.id = node.name; delete node.name; } else if (t.isFunction(node)) { + // defaults node.defaults = []; - node.params = node.params.map(function (param) { if (t.isAssignmentPattern(param)) { node.defaults.push(param.right); @@ -44,6 +45,7 @@ var astTransformVisitor = { node.rest = node.params.pop(); } } else if (t.isClassProperty(node)) { + // eslint doesn't like these this.remove(); } } From 041c7e246f461af8b9f2ea1d0f51d4b1c202782c Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Fri, 27 Feb 2015 22:40:56 +1100 Subject: [PATCH 048/569] add support for spread property --- eslint/babel-eslint-parser/acorn-to-esprima.js | 6 ++++++ eslint/babel-eslint-parser/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index e149e9020b05..2069819a224e 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -44,6 +44,12 @@ var astTransformVisitor = { if (t.isRestElement(node.params[node.params.length - 1])) { node.rest = node.params.pop(); } + } else if (t.isSpreadProperty(node)) { + node.type = "Property"; + node.kind = "init"; + node.computed = false; + node.key = node.value = node.argument; + delete node.argument; } else if (t.isClassProperty(node)) { // eslint doesn't like these this.remove(); diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index be6c731f536d..b33f4a4a4583 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "1.0.3", + "version": "1.0.4", "description": "", "main": "index.js", "repository": { From 65a6fce75ce6f38ebb592fc254c25fc024a4bf26 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Fri, 27 Feb 2015 23:06:47 +1100 Subject: [PATCH 049/569] turn ArrowFunctionExpression into a FunctionExpression - fixes babel/babel-eslint#1 --- eslint/babel-eslint-parser/acorn-to-esprima.js | 2 ++ eslint/babel-eslint-parser/package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index 2069819a224e..b82cf6aeea1e 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -53,6 +53,8 @@ var astTransformVisitor = { } else if (t.isClassProperty(node)) { // eslint doesn't like these this.remove(); + } else if (t.isArrowFunctionExpression(node)) { + node.type = "FunctionExpression"; } } }; diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index b33f4a4a4583..5f44d601af25 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "1.0.4", + "version": "1.0.5", "description": "", "main": "index.js", "repository": { From be9da7ef08f09c1ee63fb059ba6aefb9dfdf55f8 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Fri, 27 Feb 2015 23:23:15 +1100 Subject: [PATCH 050/569] output esprima compatible error messages - fixes babel/babel-eslint#3 --- eslint/babel-eslint-parser/index.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index ee476e9bfecc..41aa98b1748a 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -62,7 +62,20 @@ exports.parse = function (code) { var comments = opts.onComment = []; var tokens = opts.onToken = []; - var ast = acorn.parse(code, opts); + var ast; + try { + ast = acorn.parse(code, opts); + } catch (err) { + if (err instanceof SyntaxError) { + err.lineNumber = err.loc.line; + err.column = err.loc.column; + + // remove trailing "(LINE:COLUMN)" acorn message and add in esprima syntax error message start + err.message = "Line X: " + err.message.replace(/ \((\d+):(\d+)\)$/, ""); + } + + throw err; + } // convert tokens ast.tokens = tokens.map(acornToEsprima.toToken); From 932d799e28ec2d1c1ea61b037d8bdcb8367fbd1d Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Fri, 27 Feb 2015 23:40:59 +1100 Subject: [PATCH 051/569] pop off last token which will be an EOF, currently not used anywhere by espree and it runs into issues with some rules - fixes babel/babel-eslint#2 --- eslint/babel-eslint-parser/index.js | 5 +++++ eslint/babel-eslint-parser/package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 41aa98b1748a..ed25b643066f 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -77,6 +77,11 @@ exports.parse = function (code) { throw err; } + // remove EOF token, eslint doesn't use this for anything and it interferes with some rules + // see https://github.com/babel/babel-eslint/issues/2 for more info + // todo: find a more elegant way to do this + tokens.pop(); + // convert tokens ast.tokens = tokens.map(acornToEsprima.toToken); diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 5f44d601af25..92646e6374e3 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "1.0.5", + "version": "1.0.6", "description": "", "main": "index.js", "repository": { From a14e1e8fd159637816eb6a4b7e143819b07903e7 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 28 Feb 2015 11:28:22 +1100 Subject: [PATCH 052/569] clean up toAst method and properly transform rest elements away - fixes babel/babel-eslint#7 --- .../babel-eslint-parser/acorn-to-esprima.js | 37 +++++++++++-------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index b82cf6aeea1e..29b2b003fe68 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -22,38 +22,43 @@ exports.toAST = function (ast) { var astTransformVisitor = { noScope: true, enter: function (node) { + if (t.isSpreadProperty(node)) { + node.type = "Property"; + node.kind = "init"; + node.computed = false; + node.key = node.value = node.argument; + delete node.argument; + } + + if (t.isClassProperty(node)) { + // eslint doesn't like these + this.remove(); + } + if (t.isImportBatchSpecifier(node)) { // ImportBatchSpecifier => ImportNamespaceSpecifier node.type = "ImportNamespaceSpecifier"; node.id = node.name; delete node.name; - } else if (t.isFunction(node)) { - // defaults + } + + // functions + + if (t.isFunction(node)) { node.defaults = []; node.params = node.params.map(function (param) { if (t.isAssignmentPattern(param)) { node.defaults.push(param.right); return param.left; } else { + if (t.isRestElement(param)) param = param.argument; node.defaults.push(null); return param; } }); + } - // rest - if (t.isRestElement(node.params[node.params.length - 1])) { - node.rest = node.params.pop(); - } - } else if (t.isSpreadProperty(node)) { - node.type = "Property"; - node.kind = "init"; - node.computed = false; - node.key = node.value = node.argument; - delete node.argument; - } else if (t.isClassProperty(node)) { - // eslint doesn't like these - this.remove(); - } else if (t.isArrowFunctionExpression(node)) { + if (t.isArrowFunctionExpression(node)) { node.type = "FunctionExpression"; } } From 1d1d7a5145a8a5e4da129b6637ac8a35c43edb8f Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 28 Feb 2015 11:31:54 +1100 Subject: [PATCH 053/569] transform JSX identifiers and member expressions - fixes babel/babel-eslint#5 --- eslint/babel-eslint-parser/acorn-to-esprima.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index 29b2b003fe68..a2ebdf0e3e47 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -42,6 +42,20 @@ var astTransformVisitor = { delete node.name; } + // JSX + + if (t.isJSXIdentifier(node)) { + if (node.name === "this" && t.isReferenced(node, parent)) { + return t.thisExpression(); + } else { + node.type = "Identifier"; + } + } + + if (t.isJSXMemberExpression(node)) { + node.type = "MemberExpression"; + } + // functions if (t.isFunction(node)) { From 9117398452dbd5c84e4e932fd3bd0405c8afc73a Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 28 Feb 2015 11:50:44 +1100 Subject: [PATCH 054/569] bump version --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 92646e6374e3..ffa31ab3ce51 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "1.0.6", + "version": "1.0.7", "description": "", "main": "index.js", "repository": { From 1ca488c3ec7750c44317fb95d69974f1b6787798 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 28 Feb 2015 11:58:56 +1100 Subject: [PATCH 055/569] turn class declarations into variable declarations - fixes babel/babel-eslint#8 --- eslint/babel-eslint-parser/acorn-to-esprima.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index a2ebdf0e3e47..70d07423c59f 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -30,11 +30,6 @@ var astTransformVisitor = { delete node.argument; } - if (t.isClassProperty(node)) { - // eslint doesn't like these - this.remove(); - } - if (t.isImportBatchSpecifier(node)) { // ImportBatchSpecifier => ImportNamespaceSpecifier node.type = "ImportNamespaceSpecifier"; @@ -42,6 +37,19 @@ var astTransformVisitor = { delete node.name; } + // classes + + if (t.isClassDeclaration(node)) { + return t.variableDeclaration("let", [ + t.variableDeclarator(node.id, node) + ]); + } + + if (t.isClassProperty(node)) { + // eslint doesn't like these + this.remove(); + } + // JSX if (t.isJSXIdentifier(node)) { From 5b2df4ce30fb1f8110323465ced47ec3d5e862f7 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 28 Feb 2015 11:59:26 +1100 Subject: [PATCH 056/569] bump version --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index ffa31ab3ce51..085ac9eace97 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "1.0.7", + "version": "1.0.8", "description": "", "main": "index.js", "repository": { From 24aa904d997c1f6e37a7b137c84e7793d1f85082 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 28 Feb 2015 12:03:01 +1100 Subject: [PATCH 057/569] add how does it work section to readme --- eslint/babel-eslint-parser/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index dd638879244f..889de538a323 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -34,3 +34,10 @@ Check out the [ESLint docs](http://eslint.org/docs/rules/) for all possible rule ```sh $ eslint your-files-here ``` + +## How does it work? + +ESLint allows custom parsers. This is great but some of the syntax nodes that Babel supports +aren't supported by ESLint. When using this plugin, ESLint is monkeypatched and your code is +transformed into code that ESLint can understand. All location info such as line numbers, +columns is also retained so you can track down errors with ease. From bde03060a51e15712bf200ab51cc0d54ef3e4cba Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 28 Feb 2015 12:07:21 +1100 Subject: [PATCH 058/569] remove ClassDeclaration transformation --- eslint/babel-eslint-parser/acorn-to-esprima.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index 70d07423c59f..0241427e34d5 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -38,12 +38,6 @@ var astTransformVisitor = { } // classes - - if (t.isClassDeclaration(node)) { - return t.variableDeclaration("let", [ - t.variableDeclarator(node.id, node) - ]); - } if (t.isClassProperty(node)) { // eslint doesn't like these @@ -54,7 +48,7 @@ var astTransformVisitor = { if (t.isJSXIdentifier(node)) { if (node.name === "this" && t.isReferenced(node, parent)) { - return t.thisExpression(); + return t.inherits(t.thisExpression(), node); } else { node.type = "Identifier"; } From e891659b21f22adf557adcbd009c93b937f5610f Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 28 Feb 2015 12:07:33 +1100 Subject: [PATCH 059/569] bump version --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 085ac9eace97..7215681e8122 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "1.0.8", + "version": "1.0.9", "description": "", "main": "index.js", "repository": { From 1cc579cb5d4bd7adf7647c860b2bbb2deecec031 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 28 Feb 2015 12:09:20 +1100 Subject: [PATCH 060/569] move up explantory paragraph --- eslint/babel-eslint-parser/README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index 889de538a323..960e1e75129a 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -6,6 +6,13 @@ **NOTE:** Please note that this is experimental and may have numerous bugs. It is however successfuly linting the [babel core](https://github.com/babel/babel/blob/master/.eslintrc). +## How does it work? + +ESLint allows custom parsers. This is great but some of the syntax nodes that Babel supports +aren't supported by ESLint. When using this plugin, ESLint is monkeypatched and your code is +transformed into code that ESLint can understand. All location info such as line numbers, +columns is also retained so you can track down errors with ease. + ## Usage ### Install @@ -34,10 +41,3 @@ Check out the [ESLint docs](http://eslint.org/docs/rules/) for all possible rule ```sh $ eslint your-files-here ``` - -## How does it work? - -ESLint allows custom parsers. This is great but some of the syntax nodes that Babel supports -aren't supported by ESLint. When using this plugin, ESLint is monkeypatched and your code is -transformed into code that ESLint can understand. All location info such as line numbers, -columns is also retained so you can track down errors with ease. From 0f1910891d4eadc922c9190d7ecf87b118eace87 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 28 Feb 2015 16:33:21 +1100 Subject: [PATCH 061/569] explode all rest elements - fixes babel/babel-eslint#11 --- eslint/babel-eslint-parser/acorn-to-esprima.js | 5 ++++- eslint/babel-eslint-parser/package.json | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index 0241427e34d5..5ca5b634419e 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -30,6 +30,10 @@ var astTransformVisitor = { delete node.argument; } + if (t.isRestElement(node)) { + return node.argument; + } + if (t.isImportBatchSpecifier(node)) { // ImportBatchSpecifier => ImportNamespaceSpecifier node.type = "ImportNamespaceSpecifier"; @@ -67,7 +71,6 @@ var astTransformVisitor = { node.defaults.push(param.right); return param.left; } else { - if (t.isRestElement(param)) param = param.argument; node.defaults.push(null); return param; } diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 7215681e8122..809d016735aa 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "1.0.9", + "version": "1.0.10", "description": "", "main": "index.js", "repository": { From e4cee14aa67cafaf5a4b0878a8eae54b9243dbb5 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 28 Feb 2015 17:07:11 +1100 Subject: [PATCH 062/569] better XJSIdentifier -> Identifier logic - fixes babel/babel-eslint#12 --- eslint/babel-eslint-parser/acorn-to-esprima.js | 8 +++++++- eslint/babel-eslint-parser/package.json | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index 5ca5b634419e..6ee3f568a753 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -19,6 +19,10 @@ exports.toAST = function (ast) { traverse(ast, astTransformVisitor); }; +function isCompatTag(tagName) { + return tagName && /^[a-z]|\-/.test(tagName); +} + var astTransformVisitor = { noScope: true, enter: function (node) { @@ -53,8 +57,10 @@ var astTransformVisitor = { if (t.isJSXIdentifier(node)) { if (node.name === "this" && t.isReferenced(node, parent)) { return t.inherits(t.thisExpression(), node); - } else { + } else if (!t.isJSXAttribute(parent) && !isCompatTag(node.name)) { node.type = "Identifier"; + } else { + // just ignore this node as it'd be something like
or an attribute name } } diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 809d016735aa..497418afa9c2 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "1.0.10", + "version": "1.0.11", "description": "", "main": "index.js", "repository": { From e08a0fab998f8f751f8c58f97b0680868508ef44 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 28 Feb 2015 17:07:28 +1100 Subject: [PATCH 063/569] Merge branch 'master' of github.com:babel/babel-eslint --- eslint/babel-eslint-parser/index.js | 6 +++--- eslint/babel-eslint-parser/package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index ed25b643066f..ca364bad9c54 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -1,6 +1,6 @@ var acornToEsprima = require("./acorn-to-esprima"); var traverse = require("babel").traverse; -var extend = require("lodash/object/extend"); +var assign = require("lodash.assign"); var Module = require("module"); var acorn = require("babel").acorn; var path = require("path"); @@ -33,7 +33,7 @@ function monkeypatch() { // monkeypatch estraverse var estraverse = escopeMod.require("estraverse"); - extend(estraverse.VisitorKeys, t.VISITOR_KEYS); + assign(estraverse.VisitorKeys, t.VISITOR_KEYS); // monkeypatch escope var escope = require(escopeLoc); @@ -73,7 +73,7 @@ exports.parse = function (code) { // remove trailing "(LINE:COLUMN)" acorn message and add in esprima syntax error message start err.message = "Line X: " + err.message.replace(/ \((\d+):(\d+)\)$/, ""); } - + throw err; } diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 497418afa9c2..e34ea6c96748 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -9,7 +9,7 @@ }, "dependencies": { "babel": "^4.6.0", - "lodash": "^3.3.1" + "lodash.assign": "^3.0.0" }, "author": "Sebastian McKenzie ", "license": "MIT", From 02f4f5e88561216f8371568d33e11853acb29c70 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 28 Feb 2015 17:37:12 +1100 Subject: [PATCH 064/569] turn super references into a this expression - fixes babel/babel-eslint#10 --- eslint/babel-eslint-parser/acorn-to-esprima.js | 6 +++++- eslint/babel-eslint-parser/package.json | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index 6ee3f568a753..3ff4ebe66a06 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -25,7 +25,7 @@ function isCompatTag(tagName) { var astTransformVisitor = { noScope: true, - enter: function (node) { + enter: function (node, parent) { if (t.isSpreadProperty(node)) { node.type = "Property"; node.kind = "init"; @@ -46,6 +46,10 @@ var astTransformVisitor = { } // classes + + if (t.isReferencedIdentifier(node, parent, { name: "super" })) { + return t.inherits(t.thisExpression(), node); + } if (t.isClassProperty(node)) { // eslint doesn't like these diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index e34ea6c96748..dbfdc9135768 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "1.0.11", + "version": "1.0.12", "description": "", "main": "index.js", "repository": { From 955dd1e12647108db8b67219cc738e6390323e46 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 2 Mar 2015 12:04:59 +1100 Subject: [PATCH 065/569] turn async functions into generators - fixes babel/babel-eslint#22 --- eslint/babel-eslint-parser/acorn-to-esprima.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index 3ff4ebe66a06..a7df3060d2df 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -45,6 +45,15 @@ var astTransformVisitor = { delete node.name; } + if (t.isFunction(node) && node.async) { + node.generator = true; + node.async - false; + } + + if (t.isAwaitExpression(node)) { + node.type = "YieldExpression"; + } + // classes if (t.isReferencedIdentifier(node, parent, { name: "super" })) { From 9a77a7dbaadebbf1d6f6f176f64870f1fe3148ff Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 2 Mar 2015 12:25:08 +1100 Subject: [PATCH 066/569] ensure function expression body is a block statement - fixes babel/babel-eslint#20 --- eslint/babel-eslint-parser/acorn-to-esprima.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index a7df3060d2df..b8e8540a9eca 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -45,11 +45,6 @@ var astTransformVisitor = { delete node.name; } - if (t.isFunction(node) && node.async) { - node.generator = true; - node.async - false; - } - if (t.isAwaitExpression(node)) { node.type = "YieldExpression"; } @@ -98,6 +93,16 @@ var astTransformVisitor = { if (t.isArrowFunctionExpression(node)) { node.type = "FunctionExpression"; + if (node.body.type !== "BlockStatement") { + node.body = t.inherits(t.blockStatement([ + node.body + ]), node); + } + } + + if (t.isFunction(node) && node.async) { + node.generator = true; + node.async - false; } } }; From 71a5782ab73c2935b479f957781e46cffa82e780 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 2 Mar 2015 12:31:08 +1100 Subject: [PATCH 067/569] make spread properties computed - fixes babel/babel-eslint#16 --- eslint/babel-eslint-parser/acorn-to-esprima.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index b8e8540a9eca..ad39a897a477 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -29,7 +29,7 @@ var astTransformVisitor = { if (t.isSpreadProperty(node)) { node.type = "Property"; node.kind = "init"; - node.computed = false; + node.computed = true; node.key = node.value = node.argument; delete node.argument; } From a31835836d3a337b85ddd34cf4260973e0e62d4f Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 4 Mar 2015 22:29:49 +1100 Subject: [PATCH 068/569] bump version --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index dbfdc9135768..e0a103db37fa 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "1.0.12", + "version": "1.0.13", "description": "", "main": "index.js", "repository": { From 6556b06f231b1bac297dba5f6aefe1bf324dba4a Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 9 Mar 2015 02:45:56 +1100 Subject: [PATCH 069/569] Merge branch 'master' of github.com:babel/babel-eslint --- .../babel-eslint-parser/acorn-to-esprima.js | 42 ++--- eslint/babel-eslint-parser/index.js | 13 +- eslint/babel-eslint-parser/package.json | 10 +- .../babel-eslint-parser/test/babel-eslint.js | 90 +++++++++++ .../test/non-regression.js | 145 ++++++++++++++++++ 5 files changed, 279 insertions(+), 21 deletions(-) create mode 100644 eslint/babel-eslint-parser/test/babel-eslint.js create mode 100644 eslint/babel-eslint-parser/test/non-regression.js diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index ad39a897a477..66e1993c8618 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -7,9 +7,24 @@ exports.toToken = function (token) { if (type === tokTypes.name) { token.type = "Identifier"; - } else if (type === tokTypes.semi || type === tokTypes.comma || type === tokTypes.parenL || type === tokTypes.parenR || type === tokTypes.braceL || type === tokTypes.braceR) { + } else if (type === tokTypes.semi || type === tokTypes.comma || type === tokTypes.parenL || type === tokTypes.parenR || type === tokTypes.braceL || type === tokTypes.braceR || type === tokTypes.slash || type === tokTypes.dot || type.isAssign) { token.type = "Punctuator"; - token.value = type.type; + if (!token.value) { + token.value = type.type; + } + } else if (type === tokTypes.jsxTagStart) { + token.type = "Punctuator"; + token.value = "<"; + } else if (type === tokTypes.jsxTagEnd) { + token.type = "Punctuator"; + token.value = ">"; + } else if (type === tokTypes.jsxName) { + token.type = "JSXIdentifier"; + } else if (type.keyword) { + token.type = "Keyword"; + } else if (type === tokTypes.num) { + token.type = "Numeric"; + token.value = String(token.value); } return token; @@ -50,7 +65,12 @@ var astTransformVisitor = { } // classes - + + if (t.isClassDeclaration(node) || t.isClassExpression(node)) { + node.name = node.id; + delete node.id; + } + if (t.isReferencedIdentifier(node, parent, { name: "super" })) { return t.inherits(t.thisExpression(), node); } @@ -60,22 +80,6 @@ var astTransformVisitor = { this.remove(); } - // JSX - - if (t.isJSXIdentifier(node)) { - if (node.name === "this" && t.isReferenced(node, parent)) { - return t.inherits(t.thisExpression(), node); - } else if (!t.isJSXAttribute(parent) && !isCompatTag(node.name)) { - node.type = "Identifier"; - } else { - // just ignore this node as it'd be something like
or an attribute name - } - } - - if (t.isJSXMemberExpression(node)) { - node.type = "MemberExpression"; - } - // functions if (t.isFunction(node)) { diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index ca364bad9c54..3def57ec38d3 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -21,7 +21,7 @@ function monkeypatch() { var eslintLoc; try { - eslintLoc = require.resolve("eslint"); + eslintLoc = Module._resolveFilename("eslint", module.parent); } catch (err) { throw new ReferenceError("couldn't resolve eslint"); } @@ -43,6 +43,17 @@ function monkeypatch() { opts.sourceType = "module"; return analyze.call(this, ast, opts) }; + + var eslint = require(eslintLoc); + var getScope = eslint.linter.getScope; + eslint.linter.getScope = function () { + var scope = getScope.apply(this, arguments); + if (scope.type === "global" && !scope.__patchedWithModuleVariables) { + scope.__patchedWithModuleVariables = true; + scope.variables.push.apply(scope.variables, scope.childScopes[0].variables); + } + return scope; + }; } exports.parse = function (code) { diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index e0a103db37fa..c064dadd4883 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -16,5 +16,13 @@ "bugs": { "url": "https://github.com/babel/babel-eslint/issues" }, - "homepage": "https://github.com/babel/babel-eslint" + "homepage": "https://github.com/babel/babel-eslint", + "devDependencies": { + "eslint": "^0.15.1", + "espree": "^1.10.0", + "mocha": "^2.1.0" + }, + "scripts": { + "test": "mocha" + } } diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js new file mode 100644 index 000000000000..f8365c1844d0 --- /dev/null +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -0,0 +1,90 @@ +var util = require("util"); +var espree = require("espree"); +var babelEslint = require(".."); + + +function assertSameAST(a, b, path) { + if (!path) { + path = []; + } + + function error(text) { + throw new Error("At " + path.join(".") + ": " + text + ":\n" + util.inspect(a) + "\n" + util.inspect(b)); + } + + var typeA = a === null ? "null" : typeof a; + var typeB = b === null ? "null" : typeof b; + if (typeA !== typeB) { + error("have not the same type (" + typeA + " !== " + typeB + ")"); + } else if (typeA === "object") { + var keysA = Object.keys(a); + var keysB = Object.keys(b); + keysA.sort(); + keysB.sort(); + while (true) { + var keyA = keysA.shift(); + + // Exception: ignore "end" and "start" outside "loc" properties + if ((keyA === "end" || keyA === "start") && path[path.length - 1] !== "loc") continue; + // Exception: ignore root "comments" property + if (keyA === "comments" && path.length === 0) continue; + + var keyB = keysB.shift(); + + if (keyA === undefined && keyB === undefined) break; + if (keyA === undefined || keyA > keyB) error("first does not have key \"" + keyB + "\""); + if (keyB === undefined || keyA < keyB) error("second does not have key \"" + keyA + "\""); + path.push(keyA); + assertSameAST(a[keyA], b[keyB], path); + path.pop(); + } + } else if (a !== b) { + error("are different (" + JSON.stringify(a) + " !== " + JSON.stringify(b) + ")"); + } +} + +function parseAndAssertSame(code) { + var esAST = espree.parse(code, { + ecmaFeatures: { + classes: true, + jsx: true + }, + tokens: true, + loc: true, + range: true + }); + var acornAST = babelEslint.parse(code); + assertSameAST(acornAST, esAST); +} + +describe("acorn-to-esprima", function () { + + it("simple expression", function () { + parseAndAssertSame("a = 1"); + }); + + it("class declaration", function () { + parseAndAssertSame("class Foo {}"); + }); + + it("class expression", function () { + parseAndAssertSame("var a = class Foo {}"); + }); + + it("jsx expression", function () { + parseAndAssertSame(""); + }); + + it("jsx expression with 'this' as identifier", function () { + parseAndAssertSame(""); + }); + + it("jsx expression with a dynamic attribute", function () { + parseAndAssertSame(""); + }); + + it("jsx expression with a member expression as identifier", function () { + parseAndAssertSame(""); + }); + +}); diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js new file mode 100644 index 000000000000..68f5113109c8 --- /dev/null +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -0,0 +1,145 @@ +/*eslint-env mocha*/ +"use strict"; +var eslint = require("eslint"); + +function verifyAndAssertMessages(code, rules, expectedMessages) { + var messages = eslint.linter.verify( + code, + { + parser: require.resolve(".."), + rules: rules, + env: { + node: true + } + } + ); + + if (messages.length !== expectedMessages.length) { + throw new Error("Expected " + expectedMessages.length + " message(s), got " + messages.length); + } + + messages.forEach(function (message, i) { + var formatedMessage = message.line + ":" + message.column + " " + message.message + (message.ruleId ? " " + message.ruleId : ""); + if (formatedMessage !== expectedMessages[i]) { + throw new Error("Message " + i + " does not match:\nExpected: " + expectedMessages[i] + "\nActual: " + formatedMessage); + } + }); +} + +describe("verify", function () { + + it("arrow function support (issue #1)", function () { + verifyAndAssertMessages( + "describe('stuff', () => {});", + {}, + [] + ); + }); + + it("EOL validation (issue #2)", function () { + verifyAndAssertMessages( + "module.exports = \"something\";", + { "eol-last": 1, "semi": 1 }, + [ "1:1 Newline required at end of file but not found. eol-last" ] + ); + }); + + it("Readable error messages (issue #3)", function () { + verifyAndAssertMessages( + "{ , res }", + {}, + [ "1:2 Unexpected token" ] + ); + }); + + it("Unused vars in JSX (issue #5)", function () { + verifyAndAssertMessages( + "var App = require('./App');\n" + + "module.exports = ;", + { "no-unused-vars": 1 }, + [] + ); + }); + + it("Modules support (issue #5)", function () { + verifyAndAssertMessages( + "import Foo from 'foo';\n" + + "export default Foo;", + { }, + [] + ); + }); + + it("Rest parameters (issue #7)", function () { + verifyAndAssertMessages( + "function foo(...args) { return args; }", + { "no-undef": 1 }, + [] + ); + }); + + it("Exported classes should be used (issue #8)", function () { + verifyAndAssertMessages( + "class Foo {} module.exports = Foo;", + { "no-unused-vars": 1 }, + [] + ); + }); + + it("super keyword in class (issue #10)", function () { + verifyAndAssertMessages( + "class Foo { constructor() { super() } }", + { "no-undef": 1 }, + [] + ); + }); + + it("Rest parameter in destructuring assignment (issue #11)", function () { + verifyAndAssertMessages( + "const [a, ...rest] = ['1', '2', '3']; module.exports = rest;", + { "no-undef": 1 }, + [] + ); + }); + + it("JSX attribute names marked as variables (issue #12)", function () { + verifyAndAssertMessages( + "module.exports =
", + { "no-undef": 1 }, + [] + ); + }); + + it("Variables in JSX should be used (issues #15, #17, #21, #29)", function () { + verifyAndAssertMessages( + "import App from './App'; export default ();", + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("Multiple destructured assignment with compound properties (issue #16)", function () { + verifyAndAssertMessages( + "module.exports = { ...a.a, ...a.b };", + { "no-dupe-keys": 1 }, + [] + ); + }); + + it("Arrow function with non-block bodies (issue #20)", function () { + verifyAndAssertMessages( + "\"use strict\"; () => 1", + { "strict": 1 }, + [] + ); + }); + + it("await keyword (issue #22)", function () { + verifyAndAssertMessages( + "async function foo() { await bar(); }", + { "no-unused-expressions": 1 }, + [] + ); + }); + +}); From 78ca83eb6fe66cb63e2c0abb45cc7da204d746de Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 9 Mar 2015 02:46:17 +1100 Subject: [PATCH 070/569] 1.0.14 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index c064dadd4883..c3033c171779 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "1.0.13", + "version": "1.0.14", "description": "", "main": "index.js", "repository": { From 47e3808aa4fb947826b9a1125d4661a1c1c010b1 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Tue, 10 Mar 2015 18:18:35 +1100 Subject: [PATCH 071/569] update to eslint 0.16, remove certain mangling --- .../babel-eslint-parser/acorn-to-esprima.js | 27 ------------------- eslint/babel-eslint-parser/package.json | 5 +++- 2 files changed, 4 insertions(+), 28 deletions(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index 66e1993c8618..da698ddb6602 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -66,11 +66,6 @@ var astTransformVisitor = { // classes - if (t.isClassDeclaration(node) || t.isClassExpression(node)) { - node.name = node.id; - delete node.id; - } - if (t.isReferencedIdentifier(node, parent, { name: "super" })) { return t.inherits(t.thisExpression(), node); } @@ -82,28 +77,6 @@ var astTransformVisitor = { // functions - if (t.isFunction(node)) { - node.defaults = []; - node.params = node.params.map(function (param) { - if (t.isAssignmentPattern(param)) { - node.defaults.push(param.right); - return param.left; - } else { - node.defaults.push(null); - return param; - } - }); - } - - if (t.isArrowFunctionExpression(node)) { - node.type = "FunctionExpression"; - if (node.body.type !== "BlockStatement") { - node.body = t.inherits(t.blockStatement([ - node.body - ]), node); - } - } - if (t.isFunction(node) && node.async) { node.generator = true; node.async - false; diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index c3033c171779..e5f789bc2cc4 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -11,6 +11,9 @@ "babel": "^4.6.0", "lodash.assign": "^3.0.0" }, + "scripts": { + "test": "mocha" + }, "author": "Sebastian McKenzie ", "license": "MIT", "bugs": { @@ -18,7 +21,7 @@ }, "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { - "eslint": "^0.15.1", + "eslint": "^0.16.0", "espree": "^1.10.0", "mocha": "^2.1.0" }, From 64b63e44bf298b4d5bbc625e480eb2b6759298a6 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 11 Mar 2015 00:13:34 +1100 Subject: [PATCH 072/569] update to babel-core and eslint 0.16 --- .../babel-eslint-parser/acorn-to-esprima.js | 99 ++++++++++++++++--- eslint/babel-eslint-parser/index.js | 17 +--- eslint/babel-eslint-parser/package.json | 2 +- .../babel-eslint-parser/test/babel-eslint.js | 78 +++++++++++---- 4 files changed, 148 insertions(+), 48 deletions(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index da698ddb6602..f6e5817440f8 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -1,17 +1,22 @@ -var tokTypes = require("babel").acorn.tokTypes; -var traverse = require("babel").traverse; -var t = require("babel").types; +var tokTypes = require("babel-core").acorn.tokTypes; +var traverse = require("babel-core").traverse; +var t = require("babel-core").types; exports.toToken = function (token) { var type = token.type; if (type === tokTypes.name) { token.type = "Identifier"; - } else if (type === tokTypes.semi || type === tokTypes.comma || type === tokTypes.parenL || type === tokTypes.parenR || type === tokTypes.braceL || type === tokTypes.braceR || type === tokTypes.slash || type === tokTypes.dot || type.isAssign) { + } else if (type === tokTypes.semi || type === tokTypes.comma || + type === tokTypes.parenL || type === tokTypes.parenR || + type === tokTypes.braceL || type === tokTypes.braceR || + type === tokTypes.slash || type === tokTypes.dot || + type === tokTypes.bracketL || type === tokTypes.bracketR || + type === tokTypes.ellipsis || type === tokTypes.arrow || + type === tokTypes.star || + type.isAssign) { token.type = "Punctuator"; - if (!token.value) { - token.value = type.type; - } + if (!token.value) token.value = type.type; } else if (type === tokTypes.jsxTagStart) { token.type = "Punctuator"; token.value = "<"; @@ -25,6 +30,9 @@ exports.toToken = function (token) { } else if (type === tokTypes.num) { token.type = "Numeric"; token.value = String(token.value); + } else if (type === tokTypes.string) { + token.type = "String"; + token.value = JSON.stringify(token.value); } return token; @@ -40,7 +48,7 @@ function isCompatTag(tagName) { var astTransformVisitor = { noScope: true, - enter: function (node, parent) { + exit: function (node, parent) { if (t.isSpreadProperty(node)) { node.type = "Property"; node.kind = "init"; @@ -53,17 +61,58 @@ var astTransformVisitor = { return node.argument; } + // modules + + if (t.isImportDeclaration(node)) { + delete node.isType; + } + + if (t.isExportDeclaration(node)) { + if (node.default) { + delete node.specifiers; + delete node.source; + node.type = "ExportDefaultDeclaration"; + if (node.declaration.type === "FunctionExpression") { + node.declaration.type = "FunctionDeclaration"; + } else if (node.declaration.type === "ClassExpression") { + node.declaration.type = "ClassDeclaration"; + } + } else if (t.isExportBatchSpecifier(node.specifiers[0])) { + node.type = "ExportAllDeclaration"; + delete node.specifiers; + delete node.declaration; + } else { + node.type = "ExportNamedDeclaration"; + } + delete node.default; + } + + if (t.isExportSpecifier(node)) { + node.local = node.id; + node.exported = node.name || node.id; + delete node.id; + delete node.name; + } + + if (t.isImportSpecifier(node)) { + node.local = node.id || node.name; + if (node.default) { + node.type = "ImportDefaultSpecifier"; + } else { + node.imported = node.name || node.id; + } + delete node.id; + delete node.name; + delete node.default; + } + if (t.isImportBatchSpecifier(node)) { // ImportBatchSpecifier => ImportNamespaceSpecifier node.type = "ImportNamespaceSpecifier"; - node.id = node.name; + node.local = node.name; delete node.name; } - if (t.isAwaitExpression(node)) { - node.type = "YieldExpression"; - } - // classes if (t.isReferencedIdentifier(node, parent, { name: "super" })) { @@ -76,10 +125,28 @@ var astTransformVisitor = { } // functions + + if (t.isFunction(node)) { + node.defaults = []; + node.params = node.params.map(function (param) { + if (t.isAssignmentPattern(param)) { + node.defaults.push(param.right); + return param.left; + } else { + node.defaults.push(null); + return param; + } + }); - if (t.isFunction(node) && node.async) { - node.generator = true; - node.async - false; + node.rest = null; + if (node.async) node.generator = true; + delete node.async; + } + + if (t.isAwaitExpression(node)) { + node.type = "YieldExpression"; + node.delegate = node.all; + delete node.all; } } }; diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 3def57ec38d3..6a40a1364363 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -1,10 +1,10 @@ var acornToEsprima = require("./acorn-to-esprima"); -var traverse = require("babel").traverse; +var traverse = require("babel-core").traverse; var assign = require("lodash.assign"); var Module = require("module"); -var acorn = require("babel").acorn; +var acorn = require("babel-core").acorn; var path = require("path"); -var t = require("babel").types; +var t = require("babel-core").types; var hasPatched = false; @@ -43,17 +43,6 @@ function monkeypatch() { opts.sourceType = "module"; return analyze.call(this, ast, opts) }; - - var eslint = require(eslintLoc); - var getScope = eslint.linter.getScope; - eslint.linter.getScope = function () { - var scope = getScope.apply(this, arguments); - if (scope.type === "global" && !scope.__patchedWithModuleVariables) { - scope.__patchedWithModuleVariables = true; - scope.variables.push.apply(scope.variables, scope.childScopes[0].variables); - } - return scope; - }; } exports.parse = function (code) { diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index e5f789bc2cc4..521d9cb7dad2 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -8,7 +8,7 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "babel": "^4.6.0", + "babel-core": "^4.6.0", "lodash.assign": "^3.0.0" }, "scripts": { diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index f8365c1844d0..ae9b5c520534 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -1,7 +1,6 @@ -var util = require("util"); -var espree = require("espree"); var babelEslint = require(".."); - +var espree = require("espree"); +var util = require("util"); function assertSameAST(a, b, path) { if (!path) { @@ -23,17 +22,19 @@ function assertSameAST(a, b, path) { keysB.sort(); while (true) { var keyA = keysA.shift(); + if (keyA && keyA[0] === "_") continue; // Exception: ignore "end" and "start" outside "loc" properties if ((keyA === "end" || keyA === "start") && path[path.length - 1] !== "loc") continue; + // Exception: ignore root "comments" property if (keyA === "comments" && path.length === 0) continue; var keyB = keysB.shift(); if (keyA === undefined && keyB === undefined) break; - if (keyA === undefined || keyA > keyB) error("first does not have key \"" + keyB + "\""); - if (keyB === undefined || keyA < keyB) error("second does not have key \"" + keyA + "\""); + if (keyA === undefined || keyA > keyB) error('first does not have key "' + keyB + '"'); + if (keyB === undefined || keyA < keyB) error('second does not have key "' + keyA + '"'); path.push(keyA); assertSameAST(a[keyA], b[keyB], path); path.pop(); @@ -44,21 +45,21 @@ function assertSameAST(a, b, path) { } function parseAndAssertSame(code) { - var esAST = espree.parse(code, { - ecmaFeatures: { - classes: true, - jsx: true - }, - tokens: true, - loc: true, - range: true - }); - var acornAST = babelEslint.parse(code); - assertSameAST(acornAST, esAST); + var esAST = espree.parse(code, { + ecmaFeatures: { + modules: true, + classes: true, + jsx: true + }, + tokens: true, + loc: true, + range: true + }); + var acornAST = babelEslint.parse(code); + assertSameAST(acornAST, esAST); } describe("acorn-to-esprima", function () { - it("simple expression", function () { parseAndAssertSame("a = 1"); }); @@ -87,4 +88,47 @@ describe("acorn-to-esprima", function () { parseAndAssertSame(""); }); + it("default import", function () { + parseAndAssertSame('import foo from "foo";'); + }); + + it("import specifier", function () { + parseAndAssertSame('import { foo } from "foo";'); + }); + + it("import specifier with name", function () { + parseAndAssertSame('import { foo as bar } from "foo";'); + }); + + it("import bare", function () { + parseAndAssertSame('import "foo";'); + }); + + it("export default class declaration", function () { + parseAndAssertSame("export default class Foo {}"); + }); + + it("export default class expression", function () { + parseAndAssertSame("export default class {};"); + }); + + it("export default function declaration", function () { + parseAndAssertSame("export default function Foo() {}"); + }); + + it("export default function expression", function () { + parseAndAssertSame("export default function () {};"); + }); + + it("export all", function () { + parseAndAssertSame('export * from "foo";'); + }); + + it("export named", function () { + parseAndAssertSame("export { foo };"); + }); + + it("export named alias", function () { + parseAndAssertSame("export { foo as bar };"); + }); }); From 24eef217567160d465a72c20bbedb928a68df68f Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 11 Mar 2015 00:15:07 +1100 Subject: [PATCH 073/569] convert playground assignment operators - fixes babel/babel-eslint#40 --- eslint/babel-eslint-parser/acorn-to-esprima.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index f6e5817440f8..0633cbf5d08c 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -61,6 +61,14 @@ var astTransformVisitor = { return node.argument; } + // playground + + if (t.isAssignmentExpression(node)) { + if (node.operator === "||=" || node.operator === "?=") { + node.operator = "+="; + } + } + // modules if (t.isImportDeclaration(node)) { From 762597197480c8876fe381e9ae5ad749dbfb6619 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 11 Mar 2015 00:17:22 +1100 Subject: [PATCH 074/569] Merge branch 'master' of github.com:babel/babel-eslint --- eslint/babel-eslint-parser/.travis.yml | 7 +++++++ eslint/babel-eslint-parser/README.md | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 eslint/babel-eslint-parser/.travis.yml diff --git a/eslint/babel-eslint-parser/.travis.yml b/eslint/babel-eslint-parser/.travis.yml new file mode 100644 index 000000000000..8ac23aee56e0 --- /dev/null +++ b/eslint/babel-eslint-parser/.travis.yml @@ -0,0 +1,7 @@ +--- +git: + depth: 1 +language: node_js +node_js: + - '0.12' + - 'io.js' diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index 960e1e75129a..09130684ff83 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -1,4 +1,4 @@ -# babel-eslint +# babel-eslint [![Build Status][travis-image]][travis-url] **babel-eslint** allows you to lint **ALL** valid Babel code with the fantastic [ESLint](https://github.com/eslint/eslint). @@ -41,3 +41,6 @@ Check out the [ESLint docs](http://eslint.org/docs/rules/) for all possible rule ```sh $ eslint your-files-here ``` + +[travis-url]: https://travis-ci.org/babel/babel-eslint +[travis-image]: https://travis-ci.org/babel/babel-eslint.svg?branch=master From 6762396aec7c851d70d4aed1f49dc40e4b57f1a1 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 11 Mar 2015 00:35:00 +1100 Subject: [PATCH 075/569] fix module conversion --- eslint/babel-eslint-parser/acorn-to-esprima.js | 4 ++-- eslint/babel-eslint-parser/test/babel-eslint.js | 4 ++-- eslint/babel-eslint-parser/test/non-regression.js | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index 0633cbf5d08c..dd6c680c568f 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -103,11 +103,11 @@ var astTransformVisitor = { } if (t.isImportSpecifier(node)) { - node.local = node.id || node.name; + node.local = node.name || node.id; if (node.default) { node.type = "ImportDefaultSpecifier"; } else { - node.imported = node.name || node.id; + node.imported = node.id; } delete node.id; delete node.name; diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index ae9b5c520534..1dc2008fb78b 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -109,7 +109,7 @@ describe("acorn-to-esprima", function () { }); it("export default class expression", function () { - parseAndAssertSame("export default class {};"); + parseAndAssertSame("export default class {}"); }); it("export default function declaration", function () { @@ -117,7 +117,7 @@ describe("acorn-to-esprima", function () { }); it("export default function expression", function () { - parseAndAssertSame("export default function () {};"); + parseAndAssertSame("export default function () {}"); }); it("export all", function () { diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 68f5113109c8..5cff7f9fdc61 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -9,7 +9,7 @@ function verifyAndAssertMessages(code, rules, expectedMessages) { parser: require.resolve(".."), rules: rules, env: { - node: true + node: true } } ); @@ -27,7 +27,6 @@ function verifyAndAssertMessages(code, rules, expectedMessages) { } describe("verify", function () { - it("arrow function support (issue #1)", function () { verifyAndAssertMessages( "describe('stuff', () => {});", @@ -141,5 +140,4 @@ describe("verify", function () { [] ); }); - }); From 3fced333e8aba071e46e6a049b1a7e1df5358d99 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 11 Mar 2015 00:40:00 +1100 Subject: [PATCH 076/569] bump to 2.0.0 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 521d9cb7dad2..cbb0853c7414 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "1.0.14", + "version": "2.0.0", "description": "", "main": "index.js", "repository": { From cbe8c84ec157088e1eb97a1e6b310b64da94f6c9 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 11 Mar 2015 00:40:11 +1100 Subject: [PATCH 077/569] add messages to non regression test output --- eslint/babel-eslint-parser/test/non-regression.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 5cff7f9fdc61..505870d69454 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -15,7 +15,7 @@ function verifyAndAssertMessages(code, rules, expectedMessages) { ); if (messages.length !== expectedMessages.length) { - throw new Error("Expected " + expectedMessages.length + " message(s), got " + messages.length); + throw new Error("Expected " + expectedMessages.length + " message(s), got " + messages.length + " " + JSON.stringify(messages)); } messages.forEach(function (message, i) { From fcb367666d5f51ee6a451a61f0c64772323aa382 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 11 Mar 2015 01:15:15 +1100 Subject: [PATCH 078/569] add class usage non regression test --- eslint/babel-eslint-parser/test/non-regression.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 505870d69454..7eacdc794e41 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -140,4 +140,12 @@ describe("verify", function () { [] ); }); + + it("class usage", function () { + verifyAndAssertMessages( + "class Lol {} module.exports = Lol;", + { "no-unused-vars": 1 }, + [] + ); + }); }); From 665f0d600235c1be60cfce56d9419a5d5b0c69f2 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 11 Mar 2015 01:15:32 +1100 Subject: [PATCH 079/569] upgrade babel-core to 4.7.8 --- eslint/babel-eslint-parser/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index cbb0853c7414..0bef841dfaad 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "2.0.0", + "version": "2.0.1", "description": "", "main": "index.js", "repository": { @@ -8,7 +8,7 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "babel-core": "^4.6.0", + "babel-core": "^4.7.8", "lodash.assign": "^3.0.0" }, "scripts": { From 0d0cc6bb83e7d32bd0e05e85fc9242301b71e052 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 11 Mar 2015 21:35:12 +1100 Subject: [PATCH 080/569] Merge pull request babel/babel-eslint#44 from Globegitter/patch-1 Added global flag to install command --- eslint/babel-eslint-parser/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index 09130684ff83..45c7852b1e33 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -18,7 +18,7 @@ columns is also retained so you can track down errors with ease. ### Install ```sh -$ npm install eslint babel-eslint +$ npm install -g eslint babel-eslint ``` ### Setup From ce91f1869b0781a2fc1be80e8e1c99d0b02f9ad0 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 16 Mar 2015 12:42:57 +1100 Subject: [PATCH 081/569] Merge pull request babel/babel-eslint#50 from UltCombo/fix-48 acorn-to-esprima: fix ExportNamedDeclaration, closes babel/babel-eslint#48 --- eslint/babel-eslint-parser/acorn-to-esprima.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index dd6c680c568f..a441043b5ebd 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -85,7 +85,7 @@ var astTransformVisitor = { } else if (node.declaration.type === "ClassExpression") { node.declaration.type = "ClassDeclaration"; } - } else if (t.isExportBatchSpecifier(node.specifiers[0])) { + } else if (node.specifiers && t.isExportBatchSpecifier(node.specifiers[0])) { node.type = "ExportAllDeclaration"; delete node.specifiers; delete node.declaration; @@ -94,7 +94,7 @@ var astTransformVisitor = { } delete node.default; } - + if (t.isExportSpecifier(node)) { node.local = node.id; node.exported = node.name || node.id; @@ -133,7 +133,7 @@ var astTransformVisitor = { } // functions - + if (t.isFunction(node)) { node.defaults = []; node.params = node.params.map(function (param) { From b9ae556f9f938cfdac5896860c8b5cb2f28ce351 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 16 Mar 2015 12:49:38 +1100 Subject: [PATCH 082/569] add sourceType property --- eslint/babel-eslint-parser/acorn-to-esprima.js | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index a441043b5ebd..ca6516526d55 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -39,6 +39,7 @@ exports.toToken = function (token) { }; exports.toAST = function (ast) { + ast.sourceType = "module"; traverse(ast, astTransformVisitor); }; From ded2e420b15c430dcc21b1665f2022c6c431d1fb Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 16 Mar 2015 12:49:43 +1100 Subject: [PATCH 083/569] bump version --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 0bef841dfaad..527e51ba44dc 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "2.0.1", + "version": "2.0.2", "description": "", "main": "index.js", "repository": { From 4a531aaba41875b39ee5ee1d8c131d6fa8f5667d Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 8 Apr 2015 22:07:21 -0700 Subject: [PATCH 084/569] port to babel 5.0.0 --- .../babel-eslint-parser/acorn-to-esprima.js | 96 ++++--------------- eslint/babel-eslint-parser/index.js | 25 ++++- eslint/babel-eslint-parser/package.json | 6 +- .../test/non-regression.js | 9 -- 4 files changed, 42 insertions(+), 94 deletions(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index ca6516526d55..5375a3b11845 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -1,36 +1,36 @@ -var tokTypes = require("babel-core").acorn.tokTypes; var traverse = require("babel-core").traverse; +var tt = require("babel-core").acorn.tokTypes; var t = require("babel-core").types; exports.toToken = function (token) { var type = token.type; - if (type === tokTypes.name) { + if (type === tt.name) { token.type = "Identifier"; - } else if (type === tokTypes.semi || type === tokTypes.comma || - type === tokTypes.parenL || type === tokTypes.parenR || - type === tokTypes.braceL || type === tokTypes.braceR || - type === tokTypes.slash || type === tokTypes.dot || - type === tokTypes.bracketL || type === tokTypes.bracketR || - type === tokTypes.ellipsis || type === tokTypes.arrow || - type === tokTypes.star || + } else if (type === tt.semi || type === tt.comma || + type === tt.parenL || type === tt.parenR || + type === tt.braceL || type === tt.braceR || + type === tt.slash || type === tt.dot || + type === tt.bracketL || type === tt.bracketR || + type === tt.ellipsis || type === tt.arrow || + type === tt.star || type.isAssign) { token.type = "Punctuator"; - if (!token.value) token.value = type.type; - } else if (type === tokTypes.jsxTagStart) { + if (!token.value) token.value = type.label; + } else if (type === tt.jsxTagStart) { token.type = "Punctuator"; token.value = "<"; - } else if (type === tokTypes.jsxTagEnd) { + } else if (type === tt.jsxTagEnd) { token.type = "Punctuator"; token.value = ">"; - } else if (type === tokTypes.jsxName) { + } else if (type === tt.jsxName) { token.type = "JSXIdentifier"; } else if (type.keyword) { token.type = "Keyword"; - } else if (type === tokTypes.num) { + } else if (type === tt.num) { token.type = "Numeric"; token.value = String(token.value); - } else if (type === tokTypes.string) { + } else if (type === tt.string) { token.type = "String"; token.value = JSON.stringify(token.value); } @@ -62,14 +62,6 @@ var astTransformVisitor = { return node.argument; } - // playground - - if (t.isAssignmentExpression(node)) { - if (node.operator === "||=" || node.operator === "?=") { - node.operator = "+="; - } - } - // modules if (t.isImportDeclaration(node)) { @@ -77,49 +69,11 @@ var astTransformVisitor = { } if (t.isExportDeclaration(node)) { - if (node.default) { - delete node.specifiers; - delete node.source; - node.type = "ExportDefaultDeclaration"; - if (node.declaration.type === "FunctionExpression") { - node.declaration.type = "FunctionDeclaration"; - } else if (node.declaration.type === "ClassExpression") { - node.declaration.type = "ClassDeclaration"; - } - } else if (node.specifiers && t.isExportBatchSpecifier(node.specifiers[0])) { - node.type = "ExportAllDeclaration"; - delete node.specifiers; - delete node.declaration; - } else { - node.type = "ExportNamedDeclaration"; + if (t.isClassExpression(node.declaration)) { + node.declaration.type = "ClassDeclaration"; + } else if (t.isFunctionExpression(node.declaration)) { + node.declaration.type = "FunctionDeclaration"; } - delete node.default; - } - - if (t.isExportSpecifier(node)) { - node.local = node.id; - node.exported = node.name || node.id; - delete node.id; - delete node.name; - } - - if (t.isImportSpecifier(node)) { - node.local = node.name || node.id; - if (node.default) { - node.type = "ImportDefaultSpecifier"; - } else { - node.imported = node.id; - } - delete node.id; - delete node.name; - delete node.default; - } - - if (t.isImportBatchSpecifier(node)) { - // ImportBatchSpecifier => ImportNamespaceSpecifier - node.type = "ImportNamespaceSpecifier"; - node.local = node.name; - delete node.name; } // classes @@ -136,18 +90,6 @@ var astTransformVisitor = { // functions if (t.isFunction(node)) { - node.defaults = []; - node.params = node.params.map(function (param) { - if (t.isAssignmentPattern(param)) { - node.defaults.push(param.right); - return param.left; - } else { - node.defaults.push(null); - return param; - } - }); - - node.rest = null; if (node.async) node.generator = true; delete node.async; } diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 6a40a1364363..7b056e70ace8 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -53,11 +53,26 @@ exports.parse = function (code) { process.exit(1); } - var opts = {}; - opts.ecmaVersion = 7; - opts.playground = true; - opts.locations = true; - opts.ranges = true; + var opts = { + ecmaVersion: 7, + locations: true, + ranges: true, + sourceType: "module", + plugins: { + jsx: true, + flow: true + }, + features: { + "es7.asyncFunctions": true, + "es7.classProperties": true, + "es7.comprehensions": true, + "es7.decorators": true, + "es7.doExpressions": true, + "es7.exponentiationOperator": true, + "es7.exportExtensions": true, + "es7.objectRestSpread": true + } + }; var comments = opts.onComment = []; var tokens = opts.onToken = []; diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 527e51ba44dc..c3356a36bfb7 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -8,7 +8,7 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "babel-core": "^4.7.8", + "babel-core": "^5.0.0-beta4", "lodash.assign": "^3.0.0" }, "scripts": { @@ -21,8 +21,8 @@ }, "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { - "eslint": "^0.16.0", - "espree": "^1.10.0", + "eslint": "^0.18.0", + "espree": "^2.0.0", "mocha": "^2.1.0" }, "scripts": { diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 7eacdc794e41..400ab62c7ef2 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -51,15 +51,6 @@ describe("verify", function () { ); }); - it("Unused vars in JSX (issue #5)", function () { - verifyAndAssertMessages( - "var App = require('./App');\n" + - "module.exports = ;", - { "no-unused-vars": 1 }, - [] - ); - }); - it("Modules support (issue #5)", function () { verifyAndAssertMessages( "import Foo from 'foo';\n" + From 729cedc9259c54af3815bef428014d2f21051fda Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 8 Apr 2015 22:07:28 -0700 Subject: [PATCH 085/569] Merge branch 'master' of github.com:babel/babel-eslint --- eslint/babel-eslint-parser/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 7b056e70ace8..35a77b5d8fdb 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -41,7 +41,13 @@ function monkeypatch() { escope.analyze = function (ast, opts) { opts.ecmaVersion = 6; opts.sourceType = "module"; - return analyze.call(this, ast, opts) + // Don't visit TypeAlias when analyzing scope, but retain them for other + // eslint rules. + var TypeAliasKeys = estraverse.VisitorKeys.TypeAlias; + estraverse.VisitorKeys.TypeAlias = []; + var results = analyze.call(this, ast, opts); + estraverse.VisitorKeys.TypeAlias = TypeAliasKeys; + return results; }; } From d301c8e099f44773f0246fb55eef4ae40828da04 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 13 Apr 2015 17:12:08 -0700 Subject: [PATCH 086/569] upgrade to babel 5.1.8 --- .../babel-eslint-parser/acorn-to-esprima.js | 5 ----- eslint/babel-eslint-parser/index.js | 20 ++----------------- eslint/babel-eslint-parser/package.json | 4 ++-- .../test/non-regression.js | 8 -------- 4 files changed, 4 insertions(+), 33 deletions(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index 5375a3b11845..1206826b462c 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -82,11 +82,6 @@ var astTransformVisitor = { return t.inherits(t.thisExpression(), node); } - if (t.isClassProperty(node)) { - // eslint doesn't like these - this.remove(); - } - // functions if (t.isFunction(node)) { diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 35a77b5d8fdb..dcef0c5b1c07 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -2,7 +2,7 @@ var acornToEsprima = require("./acorn-to-esprima"); var traverse = require("babel-core").traverse; var assign = require("lodash.assign"); var Module = require("module"); -var acorn = require("babel-core").acorn; +var parse = require("babel-core").parse; var path = require("path"); var t = require("babel-core").types; @@ -60,24 +60,8 @@ exports.parse = function (code) { } var opts = { - ecmaVersion: 7, locations: true, ranges: true, - sourceType: "module", - plugins: { - jsx: true, - flow: true - }, - features: { - "es7.asyncFunctions": true, - "es7.classProperties": true, - "es7.comprehensions": true, - "es7.decorators": true, - "es7.doExpressions": true, - "es7.exponentiationOperator": true, - "es7.exportExtensions": true, - "es7.objectRestSpread": true - } }; var comments = opts.onComment = []; @@ -85,7 +69,7 @@ exports.parse = function (code) { var ast; try { - ast = acorn.parse(code, opts); + ast = parse(code, opts); } catch (err) { if (err instanceof SyntaxError) { err.lineNumber = err.loc.line; diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index c3356a36bfb7..aa4ec3e947b6 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "2.0.2", + "version": "3.0.0", "description": "", "main": "index.js", "repository": { @@ -8,7 +8,7 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "babel-core": "^5.0.0-beta4", + "babel-core": "^5.1.8", "lodash.assign": "^3.0.0" }, "scripts": { diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 400ab62c7ef2..3a676d0e006d 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -100,14 +100,6 @@ describe("verify", function () { ); }); - it("Variables in JSX should be used (issues #15, #17, #21, #29)", function () { - verifyAndAssertMessages( - "import App from './App'; export default ();", - { "no-unused-vars": 1, "no-undef": 1 }, - [] - ); - }); - it("Multiple destructured assignment with compound properties (issue #16)", function () { verifyAndAssertMessages( "module.exports = { ...a.a, ...a.b };", From 47c167309202b619c65aa243ac9842c6ce094f6f Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 13 Apr 2015 18:05:58 -0700 Subject: [PATCH 087/569] remove flow types and class property keys --- eslint/babel-eslint-parser/acorn-to-esprima.js | 8 ++++++++ eslint/babel-eslint-parser/package.json | 2 +- eslint/babel-eslint-parser/test/non-regression.js | 8 ++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index 1206826b462c..d69365076536 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -58,6 +58,10 @@ var astTransformVisitor = { delete node.argument; } + if (t.isFlow(node)) { + return this.remove(); + } + if (t.isRestElement(node)) { return node.argument; } @@ -82,6 +86,10 @@ var astTransformVisitor = { return t.inherits(t.thisExpression(), node); } + if (t.isClassProperty(node)) { + delete node.key; + } + // functions if (t.isFunction(node)) { diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index aa4ec3e947b6..1c1ae9041a8c 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.0.0", + "version": "3.0.1", "description": "", "main": "index.js", "repository": { diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 3a676d0e006d..3e4b3d9bf305 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -131,4 +131,12 @@ describe("verify", function () { [] ); }); + + it("class properties", function () { + verifyAndAssertMessages( + "class Lol { foo = 'bar'; }", + { "no-undef": 1 }, + [] + ); + }); }); From 46f65bcf494eddc0b9f967eb021b1f242047f380 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 6 May 2015 17:19:30 +0100 Subject: [PATCH 088/569] Merge pull request babel/babel-eslint#76 from Cellule/attach_comments Attach comments to ast using estraverse --- eslint/babel-eslint-parser/index.js | 49 ++++++++++- .../babel-eslint-parser/test/babel-eslint.js | 85 ++++++++++++------- 2 files changed, 103 insertions(+), 31 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index dcef0c5b1c07..f8aef5b7f552 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -6,6 +6,7 @@ var parse = require("babel-core").parse; var path = require("path"); var t = require("babel-core").types; +var estraverse; var hasPatched = false; function createModule(filename) { @@ -32,7 +33,7 @@ function monkeypatch() { var escopeMod = createModule(escopeLoc); // monkeypatch estraverse - var estraverse = escopeMod.require("estraverse"); + estraverse = escopeMod.require("estraverse"); assign(estraverse.VisitorKeys, t.VISITOR_KEYS); // monkeypatch escope @@ -51,6 +52,51 @@ function monkeypatch() { }; } +exports.attachComments = function(ast, comments, tokens) { + estraverse.attachComments(ast, comments, tokens); + + if (comments.length) { + var firstComment = comments[0]; + var lastComment = comments[comments.length - 1]; + // fixup program start + if (!tokens.length) { + // if no tokens, the program starts at the end of the last comment + ast.range[0] = lastComment.range[1]; + ast.loc.start.line = lastComment.loc.end.line; + ast.loc.start.column = lastComment.loc.end.column; + } else if (firstComment.start < tokens[0].range[0]) { + // if there are comments before the first token, the program starts at the first token + var token = tokens[0]; + ast.range[0] = token.range[0]; + ast.loc.start.line = token.loc.start.line; + ast.loc.start.column = token.loc.start.column; + + // estraverse do not put leading comments on first node when the comment + // appear before the first token + if (ast.body.length) { + var node = ast.body[0]; + node.leadingComments = []; + var firstTokenStart = token.range[0]; + var len = comments.length; + for(var i = 0; i < len && comments[i].start < firstTokenStart; i++ ) { + node.leadingComments.push(comments[i]); + } + } + } + // fixup program end + if (tokens.length) { + var lastToken = tokens[tokens.length - 1]; + if (lastComment.end > lastToken.range[1]) { + // If there is a comment after the last token, the program ends at the + // last token and not the comment + ast.range[1] = lastToken.range[1]; + ast.loc.end.line = lastToken.loc.end.line; + ast.loc.end.column = lastToken.loc.end.column; + } + } + } +}; + exports.parse = function (code) { try { monkeypatch(); @@ -92,6 +138,7 @@ exports.parse = function (code) { // add comments ast.comments = comments; + exports.attachComments(ast, comments, tokens); // transform esprima and acorn divergent nodes acornToEsprima.toAST(ast); diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 1dc2008fb78b..7c7c45c5b223 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -2,45 +2,32 @@ var babelEslint = require(".."); var espree = require("espree"); var util = require("util"); -function assertSameAST(a, b, path) { +// Checks if the source ast implements the target ast. Ignores extra keys on source ast +function assertImplementsAST(target, source, path) { if (!path) { path = []; } function error(text) { - throw new Error("At " + path.join(".") + ": " + text + ":\n" + util.inspect(a) + "\n" + util.inspect(b)); + var err = new Error("At " + path.join(".") + ": " + text + ":"); + err.depth = path.length + 1; + throw err; } - var typeA = a === null ? "null" : typeof a; - var typeB = b === null ? "null" : typeof b; + var typeA = target === null ? "null" : typeof target; + var typeB = source === null ? "null" : typeof source; if (typeA !== typeB) { - error("have not the same type (" + typeA + " !== " + typeB + ")"); + error("have different types (" + typeA + " !== " + typeB + ")"); } else if (typeA === "object") { - var keysA = Object.keys(a); - var keysB = Object.keys(b); - keysA.sort(); - keysB.sort(); - while (true) { - var keyA = keysA.shift(); - if (keyA && keyA[0] === "_") continue; - - // Exception: ignore "end" and "start" outside "loc" properties - if ((keyA === "end" || keyA === "start") && path[path.length - 1] !== "loc") continue; - - // Exception: ignore root "comments" property - if (keyA === "comments" && path.length === 0) continue; - - var keyB = keysB.shift(); - - if (keyA === undefined && keyB === undefined) break; - if (keyA === undefined || keyA > keyB) error('first does not have key "' + keyB + '"'); - if (keyB === undefined || keyA < keyB) error('second does not have key "' + keyA + '"'); - path.push(keyA); - assertSameAST(a[keyA], b[keyB], path); + var keysTarget = Object.keys(target); + for(var i in keysTarget) { + var key = keysTarget[i]; + path.push(key); + assertImplementsAST(target[key], source[key], path); path.pop(); } - } else if (a !== b) { - error("are different (" + JSON.stringify(a) + " !== " + JSON.stringify(b) + ")"); + } else if (target !== source) { + error("are different (" + JSON.stringify(target) + " !== " + JSON.stringify(source) + ")"); } } @@ -53,10 +40,21 @@ function parseAndAssertSame(code) { }, tokens: true, loc: true, - range: true + range: true, + comment: true, + attachComment: true }); var acornAST = babelEslint.parse(code); - assertSameAST(acornAST, esAST); + try { + assertImplementsAST(esAST, acornAST); + } catch(err) { + err.message += + "\nespree:\n" + + util.inspect(esAST, {depth: err.depth}) + + "\nbabel-eslint:\n" + + util.inspect(acornAST, {depth: err.depth}); + throw err; + } } describe("acorn-to-esprima", function () { @@ -131,4 +129,31 @@ describe("acorn-to-esprima", function () { it("export named alias", function () { parseAndAssertSame("export { foo as bar };"); }); + + it("empty program with line comment", function () { + parseAndAssertSame("// single comment"); + }); + + it("empty program with block comment", function () { + parseAndAssertSame(" /* multiline\n * comment\n*/"); + }); + + it("line comments", function () { + parseAndAssertSame([ + " // single comment", + "var foo = 15; // comment next to statement", + "// second comment after statement" + ].join("\n")); + }); + + it("block comments", function () { + parseAndAssertSame([ + " /* single comment */ ", + "var foo = 15; /* comment next to statement */", + "/*", + " * multiline", + " * comment", + " */" + ].join("\n")); + }); }); From e571aec2ff61c01165a492d7da14317e30b9c23a Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 6 May 2015 17:19:48 +0100 Subject: [PATCH 089/569] 3.1.0 --- eslint/babel-eslint-parser/package.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 1c1ae9041a8c..b33bd2be5f00 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.0.1", + "version": "3.1.0", "description": "", "main": "index.js", "repository": { @@ -24,8 +24,5 @@ "eslint": "^0.18.0", "espree": "^2.0.0", "mocha": "^2.1.0" - }, - "scripts": { - "test": "mocha" } } From 77c5b0f3b75ea4284ec9079e0c2882bd8694d8cf Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Thu, 7 May 2015 13:48:32 +0100 Subject: [PATCH 090/569] Merge pull request babel/babel-eslint#86 from hzoo/patchestraverse-fb also patch estraverse-fb - fixes babel/babel-eslint#73 --- eslint/babel-eslint-parser/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index f8aef5b7f552..c5426b672d19 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -36,6 +36,10 @@ function monkeypatch() { estraverse = escopeMod.require("estraverse"); assign(estraverse.VisitorKeys, t.VISITOR_KEYS); + // monkeypatch estraverse-fb + var estraverseFb = eslintMod.require("estraverse-fb"); + assign(estraverseFb.VisitorKeys, t.VISITOR_KEYS); + // monkeypatch escope var escope = require(escopeLoc); var analyze = escope.analyze; From 0f13e5708bc48db7fadf2d27827027aa0d47a3a5 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Thu, 7 May 2015 13:49:05 +0100 Subject: [PATCH 091/569] 3.1.1 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index b33bd2be5f00..24b899ba03c4 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.1.0", + "version": "3.1.1", "description": "", "main": "index.js", "repository": { From 758e8d40e5487e7967b77d88210616779ce11879 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 11 May 2015 08:15:41 +0100 Subject: [PATCH 092/569] Merge pull request babel/babel-eslint#90 from hzoo/morePunctuatorTypes change more tokentypes to be punctuator - fixes babel/babel-eslint#59 --- eslint/babel-eslint-parser/acorn-to-esprima.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index d69365076536..393290dcc77e 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -13,7 +13,16 @@ exports.toToken = function (token) { type === tt.slash || type === tt.dot || type === tt.bracketL || type === tt.bracketR || type === tt.ellipsis || type === tt.arrow || - type === tt.star || + type === tt.star || type === tt.incDec || + type === tt.colon || type === tt.question || + type === tt.template || type === tt.backQuote || + type === tt.dollarBraceL || type === tt.at || + type === tt.logicalOR || type === tt.logicalAND || + type === tt.bitwiseOR || type === tt.bitwiseXOR || + type === tt.bitwiseAND || type === tt.equality || + type === tt.relational || type === tt.bitShift || + type === tt.plusMin || type === tt.modulo || + type === tt.exponent || type === tt.prefix || type.isAssign) { token.type = "Punctuator"; if (!token.value) token.value = type.label; From 527287aa29ff0389ce2056ea36b665709c52b145 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 13 May 2015 00:27:19 +0100 Subject: [PATCH 093/569] Merge pull request babel/babel-eslint#93 from hzoo/tokenTypes add tokenTypes: Null, Boolean, RegularExpression --- eslint/babel-eslint-parser/acorn-to-esprima.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index 393290dcc77e..756b82e974b5 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -34,6 +34,10 @@ exports.toToken = function (token) { token.value = ">"; } else if (type === tt.jsxName) { token.type = "JSXIdentifier"; + } else if (type.keyword === "null") { + token.type = "Null"; + } else if (type.keyword === "false" || token.keyword === "true") { + token.type = "Boolean"; } else if (type.keyword) { token.type = "Keyword"; } else if (type === tt.num) { @@ -42,6 +46,8 @@ exports.toToken = function (token) { } else if (type === tt.string) { token.type = "String"; token.value = JSON.stringify(token.value); + } else if (type === tt.regexp) { + token.type = "RegularExpression"; } return token; From d84fc559f2bd7bd8845445ffffcfa35569a0eac4 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Thu, 14 May 2015 21:38:56 +0100 Subject: [PATCH 094/569] Merge pull request babel/babel-eslint#94 from hzoo/support-templates support template strings - Fixes babel/babel-eslint#31 --- .../babel-eslint-parser/acorn-to-esprima.js | 91 +++++++++++++++++++ eslint/babel-eslint-parser/index.js | 6 +- .../babel-eslint-parser/test/babel-eslint.js | 53 ++++++++++- .../test/non-regression.js | 10 ++ 4 files changed, 154 insertions(+), 6 deletions(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index 756b82e974b5..b562711bcc66 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -58,10 +58,82 @@ exports.toAST = function (ast) { traverse(ast, astTransformVisitor); }; +exports.toTokens = function (tokens) { + // transform tokens to type "Template" + convertTemplateType(tokens); + + return tokens.map(exports.toToken); +}; + function isCompatTag(tagName) { return tagName && /^[a-z]|\-/.test(tagName); } +function convertTemplateType(tokens) { + var startingToken = 0; + var currentToken = 0; + var numBraces = 0; + + function isTemplateStarter(token) { + return tokens[token].type === tt.backQuote || + tokens[token].type === tt.braceR; + } + + function isTemplateEnder(token) { + return tokens[token].type === tt.dollarBraceL || + tokens[token].type === tt.backQuote; + } + + function createTemplateValue(start, end) { + var value = ""; + while (start <= end) { + if (tokens[start].value) { + value += tokens[start].value; + } else if (tokens[start].type !== tt.template) { + value += tokens[start].type.label; + } + start++; + } + return value; + } + + function replaceWithTemplateType(start, end) { + var templateToken = { + type: 'Template', + value: createTemplateValue(start, end), + range: [tokens[start].start, tokens[end].end], + loc: { + start: tokens[start].loc.start, + end: tokens[end].loc.end + } + } + tokens.splice(start, end - start + 1, templateToken); + } + + function checkNumBraces(token) { + if (tokens[token].type === tt.braceL) { + numBraces++; + } else if (tokens[token].type === tt.braceR) { + numBraces--; + } + } + + while (startingToken < tokens.length) { + if (isTemplateStarter(startingToken) && numBraces === 0) { + currentToken = startingToken + 1; + while (currentToken < tokens.length - 1 && !isTemplateEnder(currentToken)) { + checkNumBraces(currentToken); + currentToken++; + } + replaceWithTemplateType(startingToken, currentToken); + startingToken++; + } else { + checkNumBraces(startingToken); + startingToken++; + } + } +} + var astTransformVisitor = { noScope: true, exit: function (node, parent) { @@ -117,5 +189,24 @@ var astTransformVisitor = { node.delegate = node.all; delete node.all; } + + // template strings + + if (t.isTemplateLiteral(node)) { + node.quasis.forEach(function (q) { + q.range[0] -= 1; + if (q.tail) { + q.range[1] += 1; + } else { + q.range[1] += 2; + } + q.loc.start.column -= 1; + if (q.tail) { + q.loc.end.column += 1; + } else { + q.loc.end.column += 2; + } + }); + } } }; diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index c5426b672d19..2002b68fd971 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -56,7 +56,7 @@ function monkeypatch() { }; } -exports.attachComments = function(ast, comments, tokens) { +exports.attachComments = function (ast, comments, tokens) { estraverse.attachComments(ast, comments, tokens); if (comments.length) { @@ -82,7 +82,7 @@ exports.attachComments = function(ast, comments, tokens) { node.leadingComments = []; var firstTokenStart = token.range[0]; var len = comments.length; - for(var i = 0; i < len && comments[i].start < firstTokenStart; i++ ) { + for (var i = 0; i < len && comments[i].start < firstTokenStart; i++) { node.leadingComments.push(comments[i]); } } @@ -138,7 +138,7 @@ exports.parse = function (code) { tokens.pop(); // convert tokens - ast.tokens = tokens.map(acornToEsprima.toToken); + ast.tokens = acornToEsprima.toTokens(tokens); // add comments ast.comments = comments; diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 7c7c45c5b223..123745f516ab 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -20,7 +20,7 @@ function assertImplementsAST(target, source, path) { error("have different types (" + typeA + " !== " + typeB + ")"); } else if (typeA === "object") { var keysTarget = Object.keys(target); - for(var i in keysTarget) { + for (var i in keysTarget) { var key = keysTarget[i]; path.push(key); assertImplementsAST(target[key], source[key], path); @@ -34,6 +34,7 @@ function assertImplementsAST(target, source, path) { function parseAndAssertSame(code) { var esAST = espree.parse(code, { ecmaFeatures: { + templateStrings: true, modules: true, classes: true, jsx: true @@ -50,14 +51,60 @@ function parseAndAssertSame(code) { } catch(err) { err.message += "\nespree:\n" + - util.inspect(esAST, {depth: err.depth}) + + util.inspect(esAST, {depth: err.depth, colors: true}) + "\nbabel-eslint:\n" + - util.inspect(acornAST, {depth: err.depth}); + util.inspect(acornAST, {depth: err.depth, colors: true}); throw err; } } describe("acorn-to-esprima", function () { + describe("templates", function () { + it("empty template string", function () { + parseAndAssertSame("``"); + }); + + it("template string", function () { + parseAndAssertSame("`test`"); + }); + + it("template string using $", function () { + parseAndAssertSame("`$`"); + }); + + it("template string with expression", function () { + parseAndAssertSame("`${a}`"); + }); + + it("template string with multiple expressions", function () { + parseAndAssertSame("`${a}${b}${c}`"); + }); + + it("template string with expression and strings", function () { + parseAndAssertSame("`a${a}a`"); + }); + + it("template string with binary expression", function () { + parseAndAssertSame("`a${a + b}a`"); + }); + + it("tagged template", function () { + parseAndAssertSame("jsx``"); + }); + + it("tagged template with expression", function () { + parseAndAssertSame("jsx``"); + }); + + it("tagged template with new operator", function () { + parseAndAssertSame("new raw`42`"); + }); + + it("template with nested function/object", function () { + parseAndAssertSame("`outer${{x: {y: 10}}}bar${`nested${function(){return 1;}}endnest`}end`"); + }); + }); + it("simple expression", function () { parseAndAssertSame("a = 1"); }); diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 3e4b3d9bf305..1ce55b05771d 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -139,4 +139,14 @@ describe("verify", function () { [] ); }); + + it("template strings #31", function () { + verifyAndAssertMessages( + "console.log(`${a}, b`);", + { "comma-spacing": 1 }, + [] + ); + }); + + }); From 9731e496c844b6e761068b2645b9a2948e6abb82 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Thu, 14 May 2015 21:39:13 +0100 Subject: [PATCH 095/569] 3.1.2 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 24b899ba03c4..5b760611fcdd 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.1.1", + "version": "3.1.2", "description": "", "main": "index.js", "repository": { From 730f2528dc3fb4867541e3e74fa403e178604c58 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 15 May 2015 14:42:28 -0400 Subject: [PATCH 096/569] Merge pull request babel/babel-eslint#97 from hzoo/fix-templates fix template type issues --- .../babel-eslint-parser/acorn-to-esprima.js | 54 ++++++++++++++----- .../babel-eslint-parser/test/babel-eslint.js | 37 +++++++++++++ .../test/non-regression.js | 2 - 3 files changed, 77 insertions(+), 16 deletions(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index b562711bcc66..ea6222e3eeaa 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -36,7 +36,7 @@ exports.toToken = function (token) { token.type = "JSXIdentifier"; } else if (type.keyword === "null") { token.type = "Null"; - } else if (type.keyword === "false" || token.keyword === "true") { + } else if (type.keyword === "false" || type.keyword === "true") { token.type = "Boolean"; } else if (type.keyword) { token.type = "Keyword"; @@ -48,6 +48,11 @@ exports.toToken = function (token) { token.value = JSON.stringify(token.value); } else if (type === tt.regexp) { token.type = "RegularExpression"; + token.regex = { + pattern: token.value.pattern, + flags: token.value.flags + }; + token.value = String(token.value.value); } return token; @@ -70,20 +75,26 @@ function isCompatTag(tagName) { } function convertTemplateType(tokens) { - var startingToken = 0; - var currentToken = 0; - var numBraces = 0; + var startingToken = 0; + var currentToken = 0; + var numBraces = 0; + var hasTemplateEnded = true; + + function isBackQuote(token) { + return tokens[token].type === tt.backQuote; + } function isTemplateStarter(token) { - return tokens[token].type === tt.backQuote || + return isBackQuote(token) || tokens[token].type === tt.braceR; } function isTemplateEnder(token) { - return tokens[token].type === tt.dollarBraceL || - tokens[token].type === tt.backQuote; + return isBackQuote(token) || + tokens[token].type === tt.dollarBraceL; } + // append the values between start and end function createTemplateValue(start, end) { var value = ""; while (start <= end) { @@ -97,6 +108,7 @@ function convertTemplateType(tokens) { return value; } + // create Template token function replaceWithTemplateType(start, end) { var templateToken = { type: 'Template', @@ -107,10 +119,12 @@ function convertTemplateType(tokens) { end: tokens[end].loc.end } } + + // put new token in place of old tokens tokens.splice(start, end - start + 1, templateToken); } - function checkNumBraces(token) { + function trackNumBraces(token) { if (tokens[token].type === tt.braceL) { numBraces++; } else if (tokens[token].type === tt.braceR) { @@ -119,18 +133,30 @@ function convertTemplateType(tokens) { } while (startingToken < tokens.length) { + // template start: check if ` or } if (isTemplateStarter(startingToken) && numBraces === 0) { currentToken = startingToken + 1; - while (currentToken < tokens.length - 1 && !isTemplateEnder(currentToken)) { - checkNumBraces(currentToken); + + // check if token after template start is "template" + if (currentToken >= tokens.length - 1 || tokens[currentToken].type !== tt.template) { + break; + } + + // template end: find ` or ${ + while (!isTemplateEnder(currentToken)) { + if (currentToken >= tokens.length - 1) { + break; + } currentToken++; } + + hasTemplateEnded = isBackQuote(currentToken); + // template start and end found: create new token replaceWithTemplateType(startingToken, currentToken); - startingToken++; - } else { - checkNumBraces(startingToken); - startingToken++; + } else if (!hasTemplateEnded) { + trackNumBraces(startingToken); } + startingToken++; } } diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 123745f516ab..4c0d062d7e49 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -33,7 +33,12 @@ function assertImplementsAST(target, source, path) { function parseAndAssertSame(code) { var esAST = espree.parse(code, { + env: { + "es6": true, + "node": true + }, ecmaFeatures: { + blockBindings: true, templateStrings: true, modules: true, classes: true, @@ -103,6 +108,22 @@ describe("acorn-to-esprima", function () { it("template with nested function/object", function () { parseAndAssertSame("`outer${{x: {y: 10}}}bar${`nested${function(){return 1;}}endnest`}end`"); }); + + it("template with braces inside and outside of template string #96", function () { + parseAndAssertSame("if (a) { var target = `{}a:${webpackPort}{}}}}`; } else { app.use(); }"); + }); + + it("template also with braces #96", function () { + parseAndAssertSame( + "export default function f1() {" + + "function f2(foo) {" + + "const bar = 3;" + + "return `${foo} ${bar}`;" + + "}" + + "return f2;" + + "}" + ); + }); }); it("simple expression", function () { @@ -203,4 +224,20 @@ describe("acorn-to-esprima", function () { " */" ].join("\n")); }); + + it("null", function () { + parseAndAssertSame("null"); + }); + + it("boolean", function () { + parseAndAssertSame("if (true) {} else if (false) {}"); + }); + + it("regexp", function () { + parseAndAssertSame("/affix-top|affix-bottom|affix|[a-z]/"); + }); + + it("regexp in a template string", function () { + parseAndAssertSame("`${/\\d/.exec(\"1\")[0]}`"); + }); }); diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 1ce55b05771d..d16b71a6249f 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -147,6 +147,4 @@ describe("verify", function () { [] ); }); - - }); From 5ba504f809571e69ee3ed7c1ab6e53c1709234e8 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Fri, 15 May 2015 20:55:56 +0100 Subject: [PATCH 097/569] 3.1.3 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 5b760611fcdd..d097b68a6237 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.1.2", + "version": "3.1.3", "description": "", "main": "index.js", "repository": { From b699e4f2aa2685ff7c0a45540da6ac0ecb3b04cf Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 16 May 2015 23:17:03 +0100 Subject: [PATCH 098/569] add support for type cast expressions - fixes babel/babel-eslint#102 --- eslint/babel-eslint-parser/acorn-to-esprima.js | 4 ++++ eslint/babel-eslint-parser/test/non-regression.js | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index ea6222e3eeaa..d43e96494e4e 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -171,6 +171,10 @@ var astTransformVisitor = { delete node.argument; } + if (t.isTypeCastExpression(node)) { + return node.expression; + } + if (t.isFlow(node)) { return this.remove(); } diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index d16b71a6249f..99d34fb2ea57 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -124,6 +124,14 @@ describe("verify", function () { ); }); + it("type cast expression", function () { + verifyAndAssertMessages( + "for (let a of (a: Array)) {}", + {}, + [] + ); + }); + it("class usage", function () { verifyAndAssertMessages( "class Lol {} module.exports = Lol;", From 54adf244ddf65ecc2c208c0f18aff6604dcf3f79 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 16 May 2015 23:17:12 +0100 Subject: [PATCH 099/569] 3.1.4 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index d097b68a6237..b9d69b54f6f5 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.1.3", + "version": "3.1.4", "description": "", "main": "index.js", "repository": { From 82f3fe41475bc380d75b0e1223eef1f6411ddfbc Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 16 May 2015 23:22:53 -0400 Subject: [PATCH 100/569] Merge pull request babel/babel-eslint#101 from hzoo/more-jsx add JSXText type, more tests --- eslint/babel-eslint-parser/acorn-to-esprima.js | 2 ++ eslint/babel-eslint-parser/test/babel-eslint.js | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index d43e96494e4e..13451af130dd 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -34,6 +34,8 @@ exports.toToken = function (token) { token.value = ">"; } else if (type === tt.jsxName) { token.type = "JSXIdentifier"; + } else if (type === tt.jsxText) { + token.type = "JSXText"; } else if (type.keyword === "null") { token.type = "Null"; } else if (type.keyword === "false" || type.keyword === "true") { diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 4c0d062d7e49..40a9fc84e015 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -154,6 +154,22 @@ describe("acorn-to-esprima", function () { parseAndAssertSame(""); }); + it("jsx expression with spread", function () { + parseAndAssertSame("var myDivElement =
;"); + }); + + it("empty jsx text", function () { + parseAndAssertSame(""); + }); + + it("jsx text with content", function () { + parseAndAssertSame("Hello, world!"); + }); + + it("nested jsx", function () { + parseAndAssertSame("
\n

Wat

\n
"); + }); + it("default import", function () { parseAndAssertSame('import foo from "foo";'); }); From 47a771a7b121587b73c3efeebb22b184a2ae0ce3 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 16 May 2015 23:23:28 -0400 Subject: [PATCH 101/569] Merge pull request babel/babel-eslint#100 from babel/es7.functionBind add ES7 function bind (::) as Punctuator --- eslint/babel-eslint-parser/acorn-to-esprima.js | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index 13451af130dd..995ca2ae5d56 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -23,6 +23,7 @@ exports.toToken = function (token) { type === tt.relational || type === tt.bitShift || type === tt.plusMin || type === tt.modulo || type === tt.exponent || type === tt.prefix || + type === tt.doubleColon || type.isAssign) { token.type = "Punctuator"; if (!token.value) token.value = type.label; From 7fa06fa56692eeca0fbd1e93d6b01c861770ee92 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 16 May 2015 23:26:48 -0400 Subject: [PATCH 102/569] add test for babel/babel-eslint#66 --- eslint/babel-eslint-parser/test/non-regression.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 99d34fb2ea57..ba62ccf05014 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -124,7 +124,15 @@ describe("verify", function () { ); }); - it("type cast expression", function () { + it("flow type", function () { + verifyAndAssertMessages( + "type SomeNewType = any;", + {}, + [] + ); + }); + + it("type cast expression #102", function () { verifyAndAssertMessages( "for (let a of (a: Array)) {}", {}, From a5f9a8fea0375f5f77945ff3f1ee8843b3067daf Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sun, 17 May 2015 17:13:40 -0400 Subject: [PATCH 103/569] 3.1.5 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index b9d69b54f6f5..8279cb2a7fa8 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.1.4", + "version": "3.1.5", "description": "", "main": "index.js", "repository": { From 80114dda35af218830e642318dcc872c4aeb5b0b Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 20 May 2015 18:14:18 -0400 Subject: [PATCH 104/569] Merge pull request babel/babel-eslint#107 from hzoo/update-eslint eslint@0.21.2 --- eslint/babel-eslint-parser/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 8279cb2a7fa8..f697dae86ab9 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -9,6 +9,7 @@ }, "dependencies": { "babel-core": "^5.1.8", + "eslint": "^0.21.2", "lodash.assign": "^3.0.0" }, "scripts": { From 0e50a0b6e001826c30c01a87e61118c475fc5184 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 20 May 2015 19:03:56 -0400 Subject: [PATCH 105/569] Merge pull request babel/babel-eslint#105 from hzoo/visit-decorators patch escope to visit decorators - fixes babel/babel-eslint#72 --- eslint/babel-eslint-parser/index.js | 35 +++++++ .../test/non-regression.js | 94 ++++++++++++++++++- 2 files changed, 128 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 2002b68fd971..613d1fc72d0b 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -54,6 +54,41 @@ function monkeypatch() { estraverse.VisitorKeys.TypeAlias = TypeAliasKeys; return results; }; + + // monkeypatch escope/referencer + var referencerLoc; + try { + var referencerLoc = Module._resolveFilename("./referencer", escopeMod); + } catch (err) { + throw new ReferenceError("couldn't resolve escope/referencer"); + } + var referencer = require(referencerLoc); + + // if there are decotators, then visit each + function visitDecorators(node) { + if (!node.decorators) { + return; + } + for (var i = 0; i < node.decorators.length; i++) { + if (node.decorators[i].expression) { + this.visit(node.decorators[i]); + } + } + } + + // monkeypatch referencer methods to visit decorators + var visitClass = referencer.prototype.visitClass; + referencer.prototype.visitClass = function (node) { + // visit decorators that are in: Class Declaration + visitDecorators.call(this, node); + visitClass.call(this, node); + } + var visitProperty = referencer.prototype.visitProperty; + referencer.prototype.visitProperty = function (node) { + // visit decorators that are in: Visit Property / MethodDefinition + visitDecorators.call(this, node); + visitProperty.call(this, node); + } } exports.attachComments = function (ast, comments, tokens) { diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index ba62ccf05014..3cb0222a5be1 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -55,7 +55,7 @@ describe("verify", function () { verifyAndAssertMessages( "import Foo from 'foo';\n" + "export default Foo;", - { }, + {}, [] ); }); @@ -163,4 +163,96 @@ describe("verify", function () { [] ); }); + + describe("decorators #72", function () { + it("class declaration", function () { + verifyAndAssertMessages( + [ + "import classDeclaration from 'decorator';", + "import decoratorParameter from 'decorator';", + "@classDeclaration(decoratorParameter)", + "@classDeclaration", + "class TextareaAutosize {}" + ].join("\n"), + { "no-unused-vars": 1 }, + [] + ); + }); + + it("method definition", function () { + verifyAndAssertMessages( + [ + "import classMethodDeclarationA from 'decorator';", + "import decoratorParameter from 'decorator';", + "class TextareaAutosize {", + "@classMethodDeclarationA(decoratorParameter)", + "@classMethodDeclarationA", + "methodDeclaration(e) {", + "e();", + "}", + "}" + ].join("\n"), + { "no-unused-vars": 1 }, + [] + ); + }); + + it("method definition get/set", function () { + verifyAndAssertMessages( + [ + "import classMethodDeclarationA from 'decorator';", + "import decoratorParameter from 'decorator';", + "class TextareaAutosize {", + "@classMethodDeclarationA(decoratorParameter)", + "@classMethodDeclarationA", + "get bar() { }", + "@classMethodDeclarationA(decoratorParameter)", + "@classMethodDeclarationA", + "set bar() { }", + "}" + ].join("\n"), + { "no-unused-vars": 1 }, + [] + ); + }); + + it("object property", function () { + verifyAndAssertMessages( + [ + "import classMethodDeclarationA from 'decorator';", + "import decoratorParameter from 'decorator';", + "var obj = {", + "@classMethodDeclarationA(decoratorParameter)", + "@classMethodDeclarationA", + "methodDeclaration(e) {", + "e();", + "}", + "};", + "obj;" + ].join("\n"), + { "no-unused-vars": 1 }, + [] + ); + }); + + it("object property get/set", function () { + verifyAndAssertMessages( + [ + "import classMethodDeclarationA from 'decorator';", + "import decoratorParameter from 'decorator';", + "var obj = {", + "@classMethodDeclarationA(decoratorParameter)", + "@classMethodDeclarationA", + "get bar() { },", + "@classMethodDeclarationA(decoratorParameter)", + "@classMethodDeclarationA", + "set bar() { }", + "};", + "obj;" + ].join("\n"), + { "no-unused-vars": 1 }, + [] + ); + }); + }); }); From 1230588b988d57d28dec29df220b1842f8c4abe6 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 20 May 2015 19:06:06 -0400 Subject: [PATCH 106/569] 3.1.6 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index f697dae86ab9..83bd276269e7 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.1.5", + "version": "3.1.6", "description": "", "main": "index.js", "repository": { From 48c23ad8ef2850a1e546de99720a25361930e776 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 21 May 2015 06:51:17 -0400 Subject: [PATCH 107/569] remove from dependency (update devDependency --- eslint/babel-eslint-parser/package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 83bd276269e7..59882e43f93b 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -9,7 +9,6 @@ }, "dependencies": { "babel-core": "^5.1.8", - "eslint": "^0.21.2", "lodash.assign": "^3.0.0" }, "scripts": { @@ -22,7 +21,7 @@ }, "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { - "eslint": "^0.18.0", + "eslint": "^0.21.2", "espree": "^2.0.0", "mocha": "^2.1.0" } From 573020678aaa323216ff7df3a50a7b4fba633eeb Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 21 May 2015 06:51:52 -0400 Subject: [PATCH 108/569] 3.1.7 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 59882e43f93b..c99b12b008fc 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.1.6", + "version": "3.1.7", "description": "", "main": "index.js", "repository": { From 9cc077638a5801bfa863d6c1d1aad9189af4abfb Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 21 May 2015 07:46:01 -0400 Subject: [PATCH 109/569] add all espree ecmaFeatures, fixes babel/babel-eslint#31 again --- .../babel-eslint-parser/acorn-to-esprima.js | 17 ++++++--- .../babel-eslint-parser/test/babel-eslint.js | 36 +++++++++++++++---- .../test/non-regression.js | 13 +++++++ 3 files changed, 56 insertions(+), 10 deletions(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index 995ca2ae5d56..8a26e10db5ef 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -80,8 +80,10 @@ function isCompatTag(tagName) { function convertTemplateType(tokens) { var startingToken = 0; var currentToken = 0; + // track use of {} var numBraces = 0; - var hasTemplateEnded = true; + // track number of nested templates + var numBackQuotes = 0; function isBackQuote(token) { return tokens[token].type === tt.backQuote; @@ -89,7 +91,8 @@ function convertTemplateType(tokens) { function isTemplateStarter(token) { return isBackQuote(token) || - tokens[token].type === tt.braceR; + // only can be a template starter when in a template already + tokens[token].type === tt.braceR && numBackQuotes > 0; } function isTemplateEnder(token) { @@ -138,6 +141,10 @@ function convertTemplateType(tokens) { while (startingToken < tokens.length) { // template start: check if ` or } if (isTemplateStarter(startingToken) && numBraces === 0) { + if (isBackQuote(startingToken)) { + numBackQuotes++; + } + currentToken = startingToken + 1; // check if token after template start is "template" @@ -153,10 +160,12 @@ function convertTemplateType(tokens) { currentToken++; } - hasTemplateEnded = isBackQuote(currentToken); + if (isBackQuote(currentToken)) { + numBackQuotes--; + } // template start and end found: create new token replaceWithTemplateType(startingToken, currentToken); - } else if (!hasTemplateEnded) { + } else if (numBackQuotes > 0) { trackNumBraces(startingToken); } startingToken++; diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 40a9fc84e015..64260de8153f 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -33,16 +33,29 @@ function assertImplementsAST(target, source, path) { function parseAndAssertSame(code) { var esAST = espree.parse(code, { - env: { - "es6": true, - "node": true - }, ecmaFeatures: { + arrowFunctions: true, blockBindings: true, + destructuring: true, + regexYFlag: true, + regexUFlag: true, templateStrings: true, - modules: true, + binaryLiterals: true, + octalLiterals: true, + unicodeCodePointEscapes: true, + defaultParams: true, + restParams: true, + forOf: true, + objectLiteralComputedProperties: true, + objectLiteralShorthandMethods: true, + objectLiteralShorthandProperties: true, + objectLiteralDuplicateProperties: true, + generators: true, + spread: true, classes: true, - jsx: true + modules: true, + jsx: true, + globalReturn: true }, tokens: true, loc: true, @@ -124,6 +137,17 @@ describe("acorn-to-esprima", function () { "}" ); }); + + it("template with destructuring #31", function () { + parseAndAssertSame([ + "module.exports = {", + "render() {", + "var {name} = this.props;", + "return Math.max(null, `Name: ${name}, Name: ${name}`);", + "}", + "};" + ].join("\n")); + }); }); it("simple expression", function () { diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 3cb0222a5be1..1b2a2a8a30b6 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -164,6 +164,19 @@ describe("verify", function () { ); }); + it("template with destructuring #31", function () { + verifyAndAssertMessages([ + "module.exports = {", + "render() {", + "var {name} = this.props;", + "return Math.max(null, `Name: ${name}, Name: ${name}`);", + "}", + "};"].join("\n"), + { "comma-spacing": 1 }, + [] + ); + }); + describe("decorators #72", function () { it("class declaration", function () { verifyAndAssertMessages( From b845304ce21aa55d9c7c670eb40de37efa0b624a Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 22 May 2015 21:04:00 -0400 Subject: [PATCH 110/569] update readme about issues/jsx --- eslint/babel-eslint-parser/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index 45c7852b1e33..808db61daf28 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -6,6 +6,8 @@ **NOTE:** Please note that this is experimental and may have numerous bugs. It is however successfuly linting the [babel core](https://github.com/babel/babel/blob/master/.eslintrc). +If there's an issue, check if it can be reproduced with the regular parser and with the latest versions of `eslint` and `babel-eslint`. For issues related to JSX, see if [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) helps! + ## How does it work? ESLint allows custom parsers. This is great but some of the syntax nodes that Babel supports From 813ede0cd5b5d93caf6419c44c5cb484dd2e420c Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 22 May 2015 21:05:00 -0400 Subject: [PATCH 111/569] 3.1.8 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index c99b12b008fc..d8366933b70a 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.1.7", + "version": "3.1.8", "description": "", "main": "index.js", "repository": { From 7f0ce79fae3424a68a0bb58f873d2388913f7e7c Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 25 May 2015 05:48:08 +0100 Subject: [PATCH 112/569] Merge pull request babel/babel-eslint#113 from babel/paths Use Path-based introspection methods rather than node-based --- .../babel-eslint-parser/acorn-to-esprima.js | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index 8a26e10db5ef..d8ac33df9237 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -175,7 +175,7 @@ function convertTemplateType(tokens) { var astTransformVisitor = { noScope: true, exit: function (node, parent) { - if (t.isSpreadProperty(node)) { + if (this.isSpreadProperty()) { node.type = "Property"; node.kind = "init"; node.computed = true; @@ -183,50 +183,51 @@ var astTransformVisitor = { delete node.argument; } - if (t.isTypeCastExpression(node)) { + if (this.isTypeCastExpression()) { return node.expression; } - if (t.isFlow(node)) { + if (this.isFlow()) { return this.remove(); } - if (t.isRestElement(node)) { + if (this.isRestElement()) { return node.argument; } // modules - if (t.isImportDeclaration(node)) { + if (this.isImportDeclaration()) { delete node.isType; } - if (t.isExportDeclaration(node)) { - if (t.isClassExpression(node.declaration)) { + if (this.isExportDeclaration(node)) { + var declar = this.get("declaration"); + if (declar.isClassExpression()) { node.declaration.type = "ClassDeclaration"; - } else if (t.isFunctionExpression(node.declaration)) { + } else if (declar.isFunctionExpression()) { node.declaration.type = "FunctionDeclaration"; } } // classes - if (t.isReferencedIdentifier(node, parent, { name: "super" })) { + if (this.isReferencedIdentifier({ name: "super" })) { return t.inherits(t.thisExpression(), node); } - if (t.isClassProperty(node)) { + if (this.isClassProperty()) { delete node.key; } // functions - if (t.isFunction(node)) { + if (this.isFunction()) { if (node.async) node.generator = true; delete node.async; } - if (t.isAwaitExpression(node)) { + if (this.isAwaitExpression()) { node.type = "YieldExpression"; node.delegate = node.all; delete node.all; @@ -234,7 +235,7 @@ var astTransformVisitor = { // template strings - if (t.isTemplateLiteral(node)) { + if (this.isTemplateLiteral()) { node.quasis.forEach(function (q) { q.range[0] -= 1; if (q.tail) { From b95ea1092ea331eb47751a61a21ce5beec0ce5ac Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 25 May 2015 05:48:21 +0100 Subject: [PATCH 113/569] 3.1.9 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index d8366933b70a..95d6c347d7ab 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.1.8", + "version": "3.1.9", "description": "", "main": "index.js", "repository": { From 866a77a8cc253c0d7a155db19e3e0959449092a0 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 1 Jun 2015 21:14:33 -0400 Subject: [PATCH 114/569] Merge pull request babel/babel-eslint#117 from hzoo/eslint-0.22.1 update to eslint@0.22.1 --- eslint/babel-eslint-parser/package.json | 2 +- eslint/babel-eslint-parser/test/non-regression.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 95d6c347d7ab..8aa2a8e07cd0 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -21,7 +21,7 @@ }, "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { - "eslint": "^0.21.2", + "eslint": "^0.22.1", "espree": "^2.0.0", "mocha": "^2.1.0" } diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 1b2a2a8a30b6..57c80ad95381 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -185,7 +185,7 @@ describe("verify", function () { "import decoratorParameter from 'decorator';", "@classDeclaration(decoratorParameter)", "@classDeclaration", - "class TextareaAutosize {}" + "export class TextareaAutosize {}" ].join("\n"), { "no-unused-vars": 1 }, [] @@ -197,7 +197,7 @@ describe("verify", function () { [ "import classMethodDeclarationA from 'decorator';", "import decoratorParameter from 'decorator';", - "class TextareaAutosize {", + "export class TextareaAutosize {", "@classMethodDeclarationA(decoratorParameter)", "@classMethodDeclarationA", "methodDeclaration(e) {", @@ -215,7 +215,7 @@ describe("verify", function () { [ "import classMethodDeclarationA from 'decorator';", "import decoratorParameter from 'decorator';", - "class TextareaAutosize {", + "export class TextareaAutosize {", "@classMethodDeclarationA(decoratorParameter)", "@classMethodDeclarationA", "get bar() { }", From a4f6edab857d386a1f1469b296755b2e389253d4 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 1 Jun 2015 21:16:02 -0400 Subject: [PATCH 115/569] Merge pull request babel/babel-eslint#109 from hzoo/i-108 visit flow types - fixes babel/babel-eslint#108 --- .../babel-eslint-parser/acorn-to-esprima.js | 33 +- eslint/babel-eslint-parser/index.js | 192 ++++- eslint/babel-eslint-parser/package.json | 3 +- .../test/non-regression.js | 763 +++++++++++++++++- 4 files changed, 959 insertions(+), 32 deletions(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index d8ac33df9237..324758fd1e76 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -117,7 +117,7 @@ function convertTemplateType(tokens) { // create Template token function replaceWithTemplateType(start, end) { var templateToken = { - type: 'Template', + type: "Template", value: createTemplateValue(start, end), range: [tokens[start].start, tokens[end].end], loc: { @@ -183,16 +183,35 @@ var astTransformVisitor = { delete node.argument; } - if (this.isTypeCastExpression()) { - return node.expression; + if (this.isRestElement()) { + return node.argument; } - if (this.isFlow()) { - return this.remove(); + // prevent "no-undef" + // for "Component" in: "let x: React.Component" + if (this.isQualifiedTypeIdentifier()) { + delete node.id; + } + // for "b" in: "var a: { b: Foo }" + if (this.isObjectTypeProperty()) { + delete node.key; + } + // for "indexer" in: "var a: {[indexer: string]: number}" + if (this.isObjectTypeIndexer()) { + delete node.id; + } + // for "param" in: "var a: { func(param: Foo): Bar };" + if (this.isFunctionTypeParam()) { + delete node.name; } - if (this.isRestElement()) { - return node.argument; + // flow + + if (this.isDeclareModule() || + this.isDeclareClass() || + this.isDeclareFunction() || + this.isDeclareVariable()) { + return this.remove(); } // modules diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 613d1fc72d0b..0977fd421ac1 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -1,6 +1,7 @@ var acornToEsprima = require("./acorn-to-esprima"); var traverse = require("babel-core").traverse; var assign = require("lodash.assign"); +var pick = require("lodash.pick"); var Module = require("module"); var parse = require("babel-core").parse; var path = require("path"); @@ -46,12 +47,7 @@ function monkeypatch() { escope.analyze = function (ast, opts) { opts.ecmaVersion = 6; opts.sourceType = "module"; - // Don't visit TypeAlias when analyzing scope, but retain them for other - // eslint rules. - var TypeAliasKeys = estraverse.VisitorKeys.TypeAlias; - estraverse.VisitorKeys.TypeAlias = []; var results = analyze.call(this, ast, opts); - estraverse.VisitorKeys.TypeAlias = TypeAliasKeys; return results; }; @@ -62,8 +58,18 @@ function monkeypatch() { } catch (err) { throw new ReferenceError("couldn't resolve escope/referencer"); } + var referencerMod = createModule(referencerLoc); var referencer = require(referencerLoc); + // reference Definition + var definitionLoc; + try { + var definitionLoc = Module._resolveFilename("./definition", referencerMod); + } catch (err) { + throw new ReferenceError("couldn't resolve escope/definition"); + } + var Definition = require(definitionLoc).Definition; + // if there are decotators, then visit each function visitDecorators(node) { if (!node.decorators) { @@ -76,18 +82,182 @@ function monkeypatch() { } } - // monkeypatch referencer methods to visit decorators + // iterate through part of t.VISITOR_KEYS + var visitorKeysMap = pick(t.VISITOR_KEYS, function(k) { + return t.FLIPPED_ALIAS_KEYS.Flow.concat([ + "ArrayPattern", + "ClassDeclaration", + "ClassExpression", + "FunctionDeclaration", + "FunctionExpression", + "Identifier", + "ObjectPattern", + "RestElement" + ]).indexOf(k) === -1; + }); + + var propertyTypes = { + // loops + callProperties: { type: "loop", values: ["value"] }, + indexers: { type: "loop", values: ["key", "value"] }, + properties: { type: "loop", values: ["value"] }, + types: { type: "loop" }, + params: { type: "loop" }, + // single property + argument: { type: "single" }, + elementType: { type: "single" }, + qualification: { type: "single" }, + rest: { type: "single" }, + returnType: { type: "single" }, + // others + typeAnnotation: { type: "typeAnnotation" }, + typeParameters: { type: "typeParameters" }, + id: { type: "id" } + }; + + function visitTypeAnnotation(node) { + // get property to check (params, id, etc...) + var visitorValues = visitorKeysMap[node.type]; + if (!visitorValues) { + return; + } + + // can have multiple properties + for (var i = 0; i < visitorValues.length; i++) { + var visitorValue = visitorValues[i]; + var propertyType = propertyTypes[visitorValue]; + var nodeProperty = node[visitorValue]; + // check if property or type is defined + if (propertyType == null || nodeProperty == null) { + continue; + } + if (propertyType.type === "loop") { + for (var j = 0; j < nodeProperty.length; j++) { + if (Array.isArray(propertyType.values)) { + for (var k = 0; k < propertyType.values.length; k++) { + checkIdentifierOrVisit.call(this, nodeProperty[j][propertyType.values[k]]); + } + } else { + checkIdentifierOrVisit.call(this, nodeProperty[j]); + } + } + } else if (propertyType.type === "single") { + checkIdentifierOrVisit.call(this, nodeProperty); + } else if (propertyType.type === "typeAnnotation") { + visitTypeAnnotation.call(this, node.typeAnnotation); + } else if (propertyType.type === "typeParameters") { + for (var j = 0; j < node.typeParameters.params.length; j++) { + checkIdentifierOrVisit.call(this, node.typeParameters.params[j]); + } + } else if (propertyType.type === "id") { + if (node.id.type === "Identifier") { + checkIdentifierOrVisit.call(this, node.id); + } else { + visitTypeAnnotation.call(this, node.id); + } + } + } + } + + function checkIdentifierOrVisit(node) { + if (node.typeAnnotation) { + visitTypeAnnotation.call(this, node.typeAnnotation); + } else if (node.type === "Identifier") { + this.visit(node); + } else { + visitTypeAnnotation.call(this, node); + } + } + + // visit decorators that are in: ClassDeclaration / ClassExpression var visitClass = referencer.prototype.visitClass; - referencer.prototype.visitClass = function (node) { - // visit decorators that are in: Class Declaration + referencer.prototype.visitClass = function(node) { visitDecorators.call(this, node); + // visit class + if (node.id) { + this.visit(node.id); + } + // visit flow type: ClassImplements + if (node.implements) { + for (var i = 0; i < node.implements.length; i++) { + checkIdentifierOrVisit.call(this, node.implements[i]); + } + } + if (node.typeParameters) { + for (var i = 0; i < node.typeParameters.params.length; i++) { + checkIdentifierOrVisit.call(this, node.typeParameters.params[i]); + } + } + if (node.superTypeParameters) { + for (var i = 0; i < node.superTypeParameters.params.length; i++) { + checkIdentifierOrVisit.call(this, node.superTypeParameters.params[i]); + } + } visitClass.call(this, node); - } + }; + // visit decorators that are in: Property / MethodDefinition var visitProperty = referencer.prototype.visitProperty; - referencer.prototype.visitProperty = function (node) { - // visit decorators that are in: Visit Property / MethodDefinition + referencer.prototype.visitProperty = function(node) { + if (node.value.type === 'TypeCastExpression') { + visitTypeAnnotation.call(this, node.value); + } visitDecorators.call(this, node); visitProperty.call(this, node); + }; + + // visit flow type in FunctionDeclaration, FunctionExpression, ArrowFunctionExpression + var visitFunction = referencer.prototype.visitFunction; + referencer.prototype.visitFunction = function(node) { + if (node.returnType) { + checkIdentifierOrVisit.call(this, node.returnType); + } + // only visit if function parameters have types + if (node.params) { + for (var i = 0; i < node.params.length; i++) { + if (node.params[i].typeAnnotation) { + checkIdentifierOrVisit.call(this, node.params[i]); + } + } + } + if (node.typeParameters) { + for (var i = 0; i < node.typeParameters.params.length; i++) { + checkIdentifierOrVisit.call(this, node.typeParameters.params[i]); + } + } + visitFunction.call(this, node); + }; + + // visit flow type in VariableDeclaration + var variableDeclaration = referencer.prototype.VariableDeclaration; + referencer.prototype.VariableDeclaration = function(node) { + if (node.declarations) { + for (var i = 0; i < node.declarations.length; i++) { + checkIdentifierOrVisit.call(this, node.declarations[i].id); + } + } + variableDeclaration.call(this, node); + }; + + referencer.prototype.TypeAlias = function(node) { + this.currentScope().__define( + node.id, + new Definition( + "Variable", + node.id, + node, + null, + null, + null + ) + ); + if (node.right) { + visitTypeAnnotation.call(this, node.right); + } + if (node.typeParameters) { + for (var i = 0; i < node.typeParameters.params.length; i++) { + checkIdentifierOrVisit.call(this, node.typeParameters.params[i]); + } + } } } diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 8aa2a8e07cd0..f1b3880106cb 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -9,7 +9,8 @@ }, "dependencies": { "babel-core": "^5.1.8", - "lodash.assign": "^3.0.0" + "lodash.assign": "^3.0.0", + "lodash.pick": "^3.1.0" }, "scripts": { "test": "mocha" diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 57c80ad95381..9b0b783d337a 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -124,20 +124,757 @@ describe("verify", function () { ); }); - it("flow type", function () { - verifyAndAssertMessages( - "type SomeNewType = any;", - {}, - [] - ); - }); + describe("flow", function () { + it("check regular function", function () { + verifyAndAssertMessages([ + "function a(b, c) { b += 1; c += 1; } a;", + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); - it("type cast expression #102", function () { - verifyAndAssertMessages( - "for (let a of (a: Array)) {}", - {}, - [] - ); + it("type alias", function () { + verifyAndAssertMessages( + "type SomeNewType = any;", + { "no-undef": 1 }, + [] + ); + }); + + it("type cast expression #102", function () { + verifyAndAssertMessages( + "for (let a of (a: Array)) {}", + {}, + [] + ); + }); + + it("multiple nullable type annotations and return #108", function () { + verifyAndAssertMessages([ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "import type Foo3 from 'foo';", + "function log(foo: ?Foo, foo2: ?Foo2): ?Foo3 {", + "console.log(foo, foo2);", + "}", + "log(1, 2);" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("type parameters", function () { + verifyAndAssertMessages([ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "function log() {}", + "log();" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("nested type annotations", function () { + verifyAndAssertMessages([ + "import type Foo from 'foo';", + "function foo(callback: () => Foo) {", + "return callback();", + "}", + "foo();" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("type in var declaration", function () { + verifyAndAssertMessages([ + "import type Foo from 'foo';", + "var x: Foo = 1;", + "x;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("object type annotation", function () { + verifyAndAssertMessages([ + "import type Foo from 'foo';", + "var a: {numVal: Foo};", + "a;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("object property types", function () { + verifyAndAssertMessages([ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "var a = {", + "circle: (null : ?{ setNativeProps(props: Foo): Foo2 })", + "};", + "a;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("namespaced types", function () { + verifyAndAssertMessages([ + "var React = require('react-native');", + "var b = {", + "openExternalExample: (null: ?React.Component)", + "};", + "var c = {", + "render(): React.Component {}", + "};", + "b;", + "c;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("ArrayTypeAnnotation", function () { + verifyAndAssertMessages([ + "import type Foo from 'foo';", + "var x: Foo[]; x;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("ClassImplements", function () { + verifyAndAssertMessages([ + "import type Foo from 'foo';", + "import type Bar from 'foo';", + "class Foo implements Bar {}" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("type alias creates declaration + usage", function () { + verifyAndAssertMessages([ + "type Foo = any;", + "var x : Foo = 1; x;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("type alias with type parameters", function () { + verifyAndAssertMessages([ + "import type Bar from 'foo';", + "import type Foo2 from 'foo';", + "import type Foo3 from 'foo';", + "type Foo = Bar", + "var x : Foo = 1; x;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("export type alias", function () { + verifyAndAssertMessages([ + "import type Foo2 from 'foo';", + "export type Foo = Foo2;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("1", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "export default function(a: Foo, b: ?Foo2, c){ a; b; c; }" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("2", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "export default function(a: () => Foo){ a; }" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("3", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "export default function(a: (_:Foo) => Foo2){ a; }" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("4", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "import type Foo3 from 'foo';", + "export default function(a: (_1:Foo, _2:Foo2) => Foo3){ a; }" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("5", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "export default function(a: (_1:Foo, ...foo:Array) => number){ a; }" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("6", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "export default function(): Foo {}" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("7", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "export default function():() => Foo {}" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("8", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "export default function():(_?:Foo) => Foo2{}" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("9", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "export default function () {}" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }) + + it("10", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "var a=function() {}; a;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("11", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "import type Foo3 from 'foo';", + "var a={*id(x: Foo2): Foo3 { x; }}; a;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("12", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "import type Foo3 from 'foo';", + "var a={async id(x: Foo2): Foo3 { x; }}; a;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("13", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "import type Foo3 from 'foo';", + "var a={123(x: Foo2): Foo3 { x; }}; a;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("14", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "class Bar {set fooProp(value:Foo):Foo2{ value; }}" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("15", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "class Foo {get fooProp():Foo{}}" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("16", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "var numVal:Foo; numVal;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("17", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "var a: {numVal: Foo;}; a;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("18", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "import type Foo3 from 'foo';", + "var a: ?{numVal: Foo; [indexer: Foo2]: Foo3}; a;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("19", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "var a: {numVal: Foo; subObj?: ?{strVal: Foo2}}; a;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("20", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "import type Foo3 from 'foo';", + "import type Foo4 from 'foo';", + "var a: { [a: Foo]: Foo2; [b: Foo3]: Foo4; }; a;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("21", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "import type Foo3 from 'foo';", + "var a: {add(x:Foo, ...y:Array): Foo3}; a;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("22", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "import type Foo3 from 'foo';", + "var a: { id(x: Foo2): Foo3; }; a;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("23", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "var a:Array = [1, 2, 3]; a;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("24", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "import Baz from 'foo';", + "class Bar extends Baz { };" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("25", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "import type Foo3 from 'foo';", + "class Bar { bar():Foo3 { return 42; }}" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("26", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "class Bar { static prop1:Foo; prop2:Foo2; }" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("27", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "var x : Foo | Foo2 = 4; x;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("28", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "var x : () => Foo | () => Foo2; x;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("29", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "var x: typeof Foo | number = Foo2; x;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("30", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + 'var {x}: {x: Foo; } = { x: "hello" }; x;' + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("31", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + 'var [x]: Array = [ "hello" ]; x;' + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("32", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "export default function({x}: { x: Foo; }) {}" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("33", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "function foo([x]: Array) { x; } foo();" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("34", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "var a: Map >; a;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("35", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "var a: ?Promise[]; a;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("36", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "var a:(...rest:Array) => Foo2; a;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("37", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "import type Foo3 from 'foo';", + "import type Foo4 from 'foo';", + "var a: (x: Foo2, ...y:Foo3[]) => Foo4; a;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("38", function () { + verifyAndAssertMessages( + [ + 'import type {foo, bar} from "baz";', + 'foo; bar;' + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("39", function () { + verifyAndAssertMessages( + [ + 'import type {foo as bar} from "baz";', + 'bar;' + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("40", function () { + verifyAndAssertMessages( + [ + 'import type from "foo";', + 'type;' + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("41", function () { + verifyAndAssertMessages( + [ + 'import type, {foo} from "bar";', + 'type; foo;' + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("42", function () { + verifyAndAssertMessages( + [ + 'import type * as namespace from "bar";', + 'namespace;' + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("43", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "var a: Foo[]; a;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("44", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "var a: ?Foo[]; a;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("45", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "var a: (?Foo)[]; a;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("46", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "var a: () => Foo[]; a;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("47", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "var a: (() => Foo)[]; a;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("48", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "var a: typeof Foo[]; a;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("49", function () { + verifyAndAssertMessages( + [ + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "import type Foo3 from 'foo';", + "var a : [Foo, Foo2,] = [123, 'duck',]; a;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); }); it("class usage", function () { From e6ba27075e33aa0fcf96edc51f509b886f02034b Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 1 Jun 2015 21:18:54 -0400 Subject: [PATCH 116/569] 3.1.10 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index f1b3880106cb..37d3f2e1b886 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.1.9", + "version": "3.1.10", "description": "", "main": "index.js", "repository": { From ade0b3b21b152c991880b0a0c109d9a162d61f96 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 3 Jun 2015 17:06:42 -0400 Subject: [PATCH 117/569] Merge pull request babel/babel-eslint#114 from hzoo/i-9 support comprehensions (no-undef) - fixes babel/babel-eslint#9 --- eslint/babel-eslint-parser/index.js | 45 ++++++++---- .../test/non-regression.js | 73 +++++++++++++++++-- 2 files changed, 96 insertions(+), 22 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 0977fd421ac1..cd28c765455c 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -173,10 +173,6 @@ function monkeypatch() { var visitClass = referencer.prototype.visitClass; referencer.prototype.visitClass = function(node) { visitDecorators.call(this, node); - // visit class - if (node.id) { - this.visit(node.id); - } // visit flow type: ClassImplements if (node.implements) { for (var i = 0; i < node.implements.length; i++) { @@ -198,7 +194,7 @@ function monkeypatch() { // visit decorators that are in: Property / MethodDefinition var visitProperty = referencer.prototype.visitProperty; referencer.prototype.visitProperty = function(node) { - if (node.value.type === 'TypeCastExpression') { + if (node.value.type === "TypeCastExpression") { visitTypeAnnotation.call(this, node.value); } visitDecorators.call(this, node); @@ -238,18 +234,21 @@ function monkeypatch() { variableDeclaration.call(this, node); }; - referencer.prototype.TypeAlias = function(node) { - this.currentScope().__define( - node.id, + function createScopeVariable (node, name) { + this.currentScope().variableScope.__define(name, new Definition( - "Variable", - node.id, - node, - null, - null, - null + "Variable", + name, + node, + null, + null, + null ) ); + } + + referencer.prototype.TypeAlias = function(node) { + createScopeVariable.call(this, node, node.id); if (node.right) { visitTypeAnnotation.call(this, node.right); } @@ -259,6 +258,24 @@ function monkeypatch() { } } } + + referencer.prototype.ComprehensionBlock = function(node) { + var left = node.left; + if (left) { + if (left.type === "Identifier") { + createScopeVariable.call(this, node, left); + } else if (left.type === "ArrayPattern") { + for (var i = 0; i < left.elements.length; i++) { + if (left.elements[i]) { + createScopeVariable.call(this, left.elements, left.elements[i]); + } + } + } + } + if (node.right) { + this.visit(node.right); + } + } } exports.attachComments = function (ast, comments, tokens) { diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 9b0b783d337a..2a837f779c2e 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -255,9 +255,8 @@ describe("verify", function () { it("ClassImplements", function () { verifyAndAssertMessages([ - "import type Foo from 'foo';", "import type Bar from 'foo';", - "class Foo implements Bar {}" + "export default class Foo implements Bar {}" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] @@ -459,7 +458,7 @@ describe("verify", function () { [ "import type Foo from 'foo';", "import type Foo2 from 'foo';", - "class Bar {set fooProp(value:Foo):Foo2{ value; }}" + "export default class Bar {set fooProp(value:Foo):Foo2{ value; }}" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] @@ -469,8 +468,8 @@ describe("verify", function () { it("15", function () { verifyAndAssertMessages( [ - "import type Foo from 'foo';", - "class Foo {get fooProp():Foo{}}" + "import type Foo2 from 'foo';", + "export default class Foo {get fooProp(): Foo2{}}" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] @@ -581,7 +580,7 @@ describe("verify", function () { "import type Foo from 'foo';", "import type Foo2 from 'foo';", "import Baz from 'foo';", - "class Bar extends Baz { };" + "export default class Bar extends Baz { };" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] @@ -594,7 +593,7 @@ describe("verify", function () { "import type Foo from 'foo';", "import type Foo2 from 'foo';", "import type Foo3 from 'foo';", - "class Bar { bar():Foo3 { return 42; }}" + "export default class Bar { bar():Foo3 { return 42; }}" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] @@ -606,7 +605,7 @@ describe("verify", function () { [ "import type Foo from 'foo';", "import type Foo2 from 'foo';", - "class Bar { static prop1:Foo; prop2:Foo2; }" + "export default class Bar { static prop1:Foo; prop2:Foo2; }" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] @@ -885,6 +884,19 @@ describe("verify", function () { ); }); + it("class definition: gaearon/redux#24", function () { + verifyAndAssertMessages([ + "export default function root(stores) {", + "return DecoratedComponent => class ReduxRootDecorator {", + "a() { DecoratedComponent; }", + "};", + "}", + ].join("\n"), + { "no-undef": 1, "no-unused-vars": 1 }, + [] + ); + }); + it("class properties", function () { verifyAndAssertMessages( "class Lol { foo = 'bar'; }", @@ -914,6 +926,51 @@ describe("verify", function () { ); }); + describe("comprehensions", function () { + it("array #9", function () { + verifyAndAssertMessages([ + "let arr = [1, 2, 3];", + "let b = [for (e of arr) String(e)];" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("array, if statement, multiple blocks", function () { + verifyAndAssertMessages([ + "let arr = [1, 2, 3];", + "let arr2 = [1, 2, 3];", + "[for (x of arr) for (y of arr2) if (x === true && y === true) x + y];" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("expression, if statement, multiple blocks", function () { + verifyAndAssertMessages([ + "let arr = [1, 2, 3];", + "let arr2 = [1, 2, 3];", + "(for (x of arr) for (y of arr2) if (x === true && y === true) x + y)" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("ArrayPattern", function () { + verifyAndAssertMessages([ + "let arr = [1, 2, 3];", + "let arr2 = [1, 2, 3];", + "[for ([,x] of arr) for ({[start.x]: x, [start.y]: y} of arr2) x]" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + }); + describe("decorators #72", function () { it("class declaration", function () { verifyAndAssertMessages( From 6a2938deaaceb730e04b6ba9526bb5e48d4396d0 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 3 Jun 2015 17:11:28 -0400 Subject: [PATCH 118/569] Merge pull request babel/babel-eslint#118 from hzoo/poly-types add flow exceptions for polymorphic types () - Ref babel/babel-eslint#109 --- eslint/babel-eslint-parser/index.js | 4 ++++ .../test/non-regression.js | 20 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index cd28c765455c..3c764c99f8e3 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -163,6 +163,10 @@ function monkeypatch() { if (node.typeAnnotation) { visitTypeAnnotation.call(this, node.typeAnnotation); } else if (node.type === "Identifier") { + // exception for polymorphic types: , , etc + if (node.name.length === 1 && node.name === node.name.toUpperCase()) { + return; + } this.visit(node); } else { visitTypeAnnotation.call(this, node); diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 2a837f779c2e..598498afab5c 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -296,6 +296,26 @@ describe("verify", function () { ); }); + it("polymorphpic types #109", function () { + verifyAndAssertMessages([ + "export default function groupByEveryN(array: Array, n: number): Array> {}" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("types definition from import", function () { + verifyAndAssertMessages([ + "import type Promise from 'bluebird';", + "type Operation = () => Promise;", + "x: Operation;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + it("1", function () { verifyAndAssertMessages( [ From 6bcdfb11cc7bc7faf144d975a5aeac352eed48ab Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 3 Jun 2015 17:13:06 -0400 Subject: [PATCH 119/569] 3.1.11 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 37d3f2e1b886..44ba9b9bd04c 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.1.10", + "version": "3.1.11", "description": "", "main": "index.js", "repository": { From b10c9b035735bab8f7fef71dbc1cb24d5886d3e1 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Fri, 5 Jun 2015 10:00:15 +0100 Subject: [PATCH 120/569] update to babel 5.5.1 --- eslint/babel-eslint-parser/acorn-to-esprima.js | 2 +- eslint/babel-eslint-parser/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index 324758fd1e76..81b79aa82f5b 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -211,7 +211,7 @@ var astTransformVisitor = { this.isDeclareClass() || this.isDeclareFunction() || this.isDeclareVariable()) { - return this.remove(); + return this.dangerouslyRemove(); } // modules diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 44ba9b9bd04c..16d0c58b44f9 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -8,7 +8,7 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "babel-core": "^5.1.8", + "babel-core": "^5.5.1", "lodash.assign": "^3.0.0", "lodash.pick": "^3.1.0" }, From 8d3a7244c311b3e1bf021d704114f4085e90e13d Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Fri, 5 Jun 2015 10:00:26 +0100 Subject: [PATCH 121/569] 3.1.12 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 16d0c58b44f9..1d757d42b9e8 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.1.11", + "version": "3.1.12", "description": "", "main": "index.js", "repository": { From 84a8d342f2d7eb3263f0c6b9e65d4cfa6cb61ff7 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 5 Jun 2015 05:24:20 -0400 Subject: [PATCH 122/569] Merge pull request babel/babel-eslint#121 from hzoo/i-120 don't visit var decl - fixes babel/babel-eslint#120 --- eslint/babel-eslint-parser/index.js | 5 ++++- eslint/babel-eslint-parser/test/non-regression.js | 10 +++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 3c764c99f8e3..074a0720a557 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -232,7 +232,10 @@ function monkeypatch() { referencer.prototype.VariableDeclaration = function(node) { if (node.declarations) { for (var i = 0; i < node.declarations.length; i++) { - checkIdentifierOrVisit.call(this, node.declarations[i].id); + var type = node.declarations[i].id.typeAnnotation; + if (type) { + checkIdentifierOrVisit.call(this, type); + } } } variableDeclaration.call(this, node); diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 598498afab5c..c21096f93002 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -950,7 +950,7 @@ describe("verify", function () { it("array #9", function () { verifyAndAssertMessages([ "let arr = [1, 2, 3];", - "let b = [for (e of arr) String(e)];" + "let b = [for (e of arr) String(e)]; b;" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] @@ -1082,4 +1082,12 @@ describe("verify", function () { ); }); }); + + it("detects minimal no-unused-vars case #120", function () { + verifyAndAssertMessages( + "var unused;", + { "no-unused-vars": 1 }, + [ "1:4 unused is defined but never used no-unused-vars" ] + ) + }); }); From c38ea387e56171ae8c9d6d4a5dbe95b5d1070ea4 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 5 Jun 2015 05:29:59 -0400 Subject: [PATCH 123/569] 3.1.13 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 1d757d42b9e8..285c1a9d8905 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.1.12", + "version": "3.1.13", "description": "", "main": "index.js", "repository": { From face6ff6af50dd3d655239c8e5c00b069c2ca744 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 6 Jun 2015 09:14:24 -0400 Subject: [PATCH 124/569] add lint config from babel, lint --- eslint/babel-eslint-parser/.eslintrc | 26 +++++++++++++++++ .../babel-eslint-parser/acorn-to-esprima.js | 8 ++---- eslint/babel-eslint-parser/index.js | 25 ++++++++--------- .../babel-eslint-parser/test/babel-eslint.js | 10 +++---- .../test/non-regression.js | 28 +++++++++---------- 5 files changed, 59 insertions(+), 38 deletions(-) create mode 100644 eslint/babel-eslint-parser/.eslintrc diff --git a/eslint/babel-eslint-parser/.eslintrc b/eslint/babel-eslint-parser/.eslintrc new file mode 100644 index 000000000000..b4c0ddaa6f79 --- /dev/null +++ b/eslint/babel-eslint-parser/.eslintrc @@ -0,0 +1,26 @@ +{ + "rules": { + "strict": 0, + "no-underscore-dangle": 0, + "curly": 0, + "no-multi-spaces": 0, + "key-spacing": 0, + "no-return-assign": 0, + "consistent-return": 0, + "no-shadow": 0, + "comma-dangle": 0, + "no-use-before-define": 0, + "no-empty": 0, + "new-parens": 0, + "no-cond-assign": 0, + "no-fallthrough": 0, + "new-cap": 0, + "no-loop-func": 0, + "no-unreachable": 0, + "no-process-exit": 0 + }, + "env": { + "node": true, + "mocha": true + } +} \ No newline at end of file diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index 81b79aa82f5b..479e4f97d505 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -73,10 +73,6 @@ exports.toTokens = function (tokens) { return tokens.map(exports.toToken); }; -function isCompatTag(tagName) { - return tagName && /^[a-z]|\-/.test(tagName); -} - function convertTemplateType(tokens) { var startingToken = 0; var currentToken = 0; @@ -124,7 +120,7 @@ function convertTemplateType(tokens) { start: tokens[start].loc.start, end: tokens[end].loc.end } - } + }; // put new token in place of old tokens tokens.splice(start, end - start + 1, templateToken); @@ -174,7 +170,7 @@ function convertTemplateType(tokens) { var astTransformVisitor = { noScope: true, - exit: function (node, parent) { + exit: function (node) { /* parent */ if (this.isSpreadProperty()) { node.type = "Property"; node.kind = "init"; diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 074a0720a557..7f0f48a961a4 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -1,5 +1,4 @@ var acornToEsprima = require("./acorn-to-esprima"); -var traverse = require("babel-core").traverse; var assign = require("lodash.assign"); var pick = require("lodash.pick"); var Module = require("module"); @@ -54,7 +53,7 @@ function monkeypatch() { // monkeypatch escope/referencer var referencerLoc; try { - var referencerLoc = Module._resolveFilename("./referencer", escopeMod); + referencerLoc = Module._resolveFilename("./referencer", escopeMod); } catch (err) { throw new ReferenceError("couldn't resolve escope/referencer"); } @@ -64,7 +63,7 @@ function monkeypatch() { // reference Definition var definitionLoc; try { - var definitionLoc = Module._resolveFilename("./definition", referencerMod); + definitionLoc = Module._resolveFilename("./definition", referencerMod); } catch (err) { throw new ReferenceError("couldn't resolve escope/definition"); } @@ -146,8 +145,8 @@ function monkeypatch() { } else if (propertyType.type === "typeAnnotation") { visitTypeAnnotation.call(this, node.typeAnnotation); } else if (propertyType.type === "typeParameters") { - for (var j = 0; j < node.typeParameters.params.length; j++) { - checkIdentifierOrVisit.call(this, node.typeParameters.params[j]); + for (var l = 0; l < node.typeParameters.params.length; l++) { + checkIdentifierOrVisit.call(this, node.typeParameters.params[l]); } } else if (propertyType.type === "id") { if (node.id.type === "Identifier") { @@ -184,13 +183,13 @@ function monkeypatch() { } } if (node.typeParameters) { - for (var i = 0; i < node.typeParameters.params.length; i++) { - checkIdentifierOrVisit.call(this, node.typeParameters.params[i]); + for (var j = 0; j < node.typeParameters.params.length; j++) { + checkIdentifierOrVisit.call(this, node.typeParameters.params[j]); } } if (node.superTypeParameters) { - for (var i = 0; i < node.superTypeParameters.params.length; i++) { - checkIdentifierOrVisit.call(this, node.superTypeParameters.params[i]); + for (var k = 0; k < node.superTypeParameters.params.length; k++) { + checkIdentifierOrVisit.call(this, node.superTypeParameters.params[k]); } } visitClass.call(this, node); @@ -220,8 +219,8 @@ function monkeypatch() { } } if (node.typeParameters) { - for (var i = 0; i < node.typeParameters.params.length; i++) { - checkIdentifierOrVisit.call(this, node.typeParameters.params[i]); + for (var j = 0; j < node.typeParameters.params.length; j++) { + checkIdentifierOrVisit.call(this, node.typeParameters.params[j]); } } visitFunction.call(this, node); @@ -264,7 +263,7 @@ function monkeypatch() { checkIdentifierOrVisit.call(this, node.typeParameters.params[i]); } } - } + }; referencer.prototype.ComprehensionBlock = function(node) { var left = node.left; @@ -282,7 +281,7 @@ function monkeypatch() { if (node.right) { this.visit(node.right); } - } + }; } exports.attachComments = function (ast, comments, tokens) { diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 64260de8153f..09e3229e5809 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -195,19 +195,19 @@ describe("acorn-to-esprima", function () { }); it("default import", function () { - parseAndAssertSame('import foo from "foo";'); + parseAndAssertSame("import foo from 'foo';"); }); it("import specifier", function () { - parseAndAssertSame('import { foo } from "foo";'); + parseAndAssertSame("import { foo } from 'foo';"); }); it("import specifier with name", function () { - parseAndAssertSame('import { foo as bar } from "foo";'); + parseAndAssertSame("import { foo as bar } from 'foo';"); }); it("import bare", function () { - parseAndAssertSame('import "foo";'); + parseAndAssertSame("import 'foo';"); }); it("export default class declaration", function () { @@ -227,7 +227,7 @@ describe("acorn-to-esprima", function () { }); it("export all", function () { - parseAndAssertSame('export * from "foo";'); + parseAndAssertSame("export * from 'foo';"); }); it("export named", function () { diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index c21096f93002..0bafac9e0196 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -420,7 +420,7 @@ describe("verify", function () { { "no-unused-vars": 1, "no-undef": 1 }, [] ); - }) + }); it("10", function () { verifyAndAssertMessages( @@ -672,7 +672,7 @@ describe("verify", function () { verifyAndAssertMessages( [ "import type Foo from 'foo';", - 'var {x}: {x: Foo; } = { x: "hello" }; x;' + "var {x}: {x: Foo; } = { x: 'hello' }; x;" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] @@ -683,7 +683,7 @@ describe("verify", function () { verifyAndAssertMessages( [ "import type Foo from 'foo';", - 'var [x]: Array = [ "hello" ]; x;' + "var [x]: Array = [ 'hello' ]; x;" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] @@ -764,8 +764,8 @@ describe("verify", function () { it("38", function () { verifyAndAssertMessages( [ - 'import type {foo, bar} from "baz";', - 'foo; bar;' + "import type {foo, bar} from 'baz';", + "foo; bar;" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] @@ -775,8 +775,8 @@ describe("verify", function () { it("39", function () { verifyAndAssertMessages( [ - 'import type {foo as bar} from "baz";', - 'bar;' + "import type {foo as bar} from 'baz';", + "bar;" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] @@ -786,8 +786,8 @@ describe("verify", function () { it("40", function () { verifyAndAssertMessages( [ - 'import type from "foo";', - 'type;' + "import type from 'foo';", + "type;" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] @@ -797,8 +797,8 @@ describe("verify", function () { it("41", function () { verifyAndAssertMessages( [ - 'import type, {foo} from "bar";', - 'type; foo;' + "import type, {foo} from 'bar';", + "type; foo;" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] @@ -808,8 +808,8 @@ describe("verify", function () { it("42", function () { verifyAndAssertMessages( [ - 'import type * as namespace from "bar";', - 'namespace;' + "import type * as namespace from 'bar';", + "namespace;" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] @@ -1088,6 +1088,6 @@ describe("verify", function () { "var unused;", { "no-unused-vars": 1 }, [ "1:4 unused is defined but never used no-unused-vars" ] - ) + ); }); }); From c15a7c6b65bc708361f0bd7f0c1fa9e714275cf5 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 6 Jun 2015 09:21:23 -0400 Subject: [PATCH 125/569] lint: fix quotes, rule --- eslint/babel-eslint-parser/.eslintrc | 3 ++- eslint/babel-eslint-parser/test/babel-eslint.js | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/eslint/babel-eslint-parser/.eslintrc b/eslint/babel-eslint-parser/.eslintrc index b4c0ddaa6f79..63b343642b89 100644 --- a/eslint/babel-eslint-parser/.eslintrc +++ b/eslint/babel-eslint-parser/.eslintrc @@ -17,7 +17,8 @@ "new-cap": 0, "no-loop-func": 0, "no-unreachable": 0, - "no-process-exit": 0 + "no-process-exit": 0, + "quotes": [1, "double", "avoid-escape"] }, "env": { "node": true, diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 09e3229e5809..64260de8153f 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -195,19 +195,19 @@ describe("acorn-to-esprima", function () { }); it("default import", function () { - parseAndAssertSame("import foo from 'foo';"); + parseAndAssertSame('import foo from "foo";'); }); it("import specifier", function () { - parseAndAssertSame("import { foo } from 'foo';"); + parseAndAssertSame('import { foo } from "foo";'); }); it("import specifier with name", function () { - parseAndAssertSame("import { foo as bar } from 'foo';"); + parseAndAssertSame('import { foo as bar } from "foo";'); }); it("import bare", function () { - parseAndAssertSame("import 'foo';"); + parseAndAssertSame('import "foo";'); }); it("export default class declaration", function () { @@ -227,7 +227,7 @@ describe("acorn-to-esprima", function () { }); it("export all", function () { - parseAndAssertSame("export * from 'foo';"); + parseAndAssertSame('export * from "foo";'); }); it("export named", function () { From adc009b832911c70c0ff84e424df19c0a77f7302 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 6 Jun 2015 16:54:05 -0400 Subject: [PATCH 126/569] Merge pull request babel/babel-eslint#122 from hzoo/i-95 visit properties in ObjectPattern - fixes babel/babel-eslint#95 --- eslint/babel-eslint-parser/index.js | 12 +++++++++--- eslint/babel-eslint-parser/test/non-regression.js | 8 ++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 7f0f48a961a4..81475eb7aa6f 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -231,9 +231,15 @@ function monkeypatch() { referencer.prototype.VariableDeclaration = function(node) { if (node.declarations) { for (var i = 0; i < node.declarations.length; i++) { - var type = node.declarations[i].id.typeAnnotation; - if (type) { - checkIdentifierOrVisit.call(this, type); + var id = node.declarations[i].id; + var typeAnnotation = id.typeAnnotation; + if (typeAnnotation) { + checkIdentifierOrVisit.call(this, typeAnnotation); + } + if (id.type === 'ObjectPattern') { + for (var j = 0; j < id.properties.length; j++) { + this.visit(id.properties[j]); + } } } } diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 0bafac9e0196..a0b149c2f2bb 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1090,4 +1090,12 @@ describe("verify", function () { [ "1:4 unused is defined but never used no-unused-vars" ] ); }); + + it("visits excluded properties left of spread #95", function () { + verifyAndAssertMessages( + "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", + { "no-undef": 1, "no-unused-vars": 1 }, + [] + ) + }); }); From 5d23153aed4a1c605515ea4e3d878b515efaa59d Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 6 Jun 2015 16:55:00 -0400 Subject: [PATCH 127/569] 3.1.14 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 285c1a9d8905..8fab55c0a118 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.1.13", + "version": "3.1.14", "description": "", "main": "index.js", "repository": { From 4ba3178d8e7092955af5801809247e1095f0838b Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 8 Jun 2015 09:37:55 -0400 Subject: [PATCH 128/569] Merge pull request babel/babel-eslint#116 from hzoo/eslint-tests Add eslint submodule to run eslint tests - Ref babel/babel-eslint#62 --- eslint/babel-eslint-parser/.gitignore | 1 + eslint/babel-eslint-parser/.gitmodules | 3 +++ eslint/babel-eslint-parser/.npmignore | 1 + eslint/babel-eslint-parser/eslint | 1 + eslint/babel-eslint-parser/eslint-tester.js | 6 ++++++ eslint/babel-eslint-parser/package.json | 5 ++++- 6 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 eslint/babel-eslint-parser/.gitmodules create mode 100644 eslint/babel-eslint-parser/.npmignore create mode 160000 eslint/babel-eslint-parser/eslint create mode 100644 eslint/babel-eslint-parser/eslint-tester.js diff --git a/eslint/babel-eslint-parser/.gitignore b/eslint/babel-eslint-parser/.gitignore index 3c3629e647f5..93f136199161 100644 --- a/eslint/babel-eslint-parser/.gitignore +++ b/eslint/babel-eslint-parser/.gitignore @@ -1 +1,2 @@ node_modules +npm-debug.log diff --git a/eslint/babel-eslint-parser/.gitmodules b/eslint/babel-eslint-parser/.gitmodules new file mode 100644 index 000000000000..e922d16a4493 --- /dev/null +++ b/eslint/babel-eslint-parser/.gitmodules @@ -0,0 +1,3 @@ +[submodule "eslint"] + path = eslint + url = https://github.com/eslint/eslint diff --git a/eslint/babel-eslint-parser/.npmignore b/eslint/babel-eslint-parser/.npmignore new file mode 100644 index 000000000000..9096200b7c1f --- /dev/null +++ b/eslint/babel-eslint-parser/.npmignore @@ -0,0 +1 @@ +eslint diff --git a/eslint/babel-eslint-parser/eslint b/eslint/babel-eslint-parser/eslint new file mode 160000 index 000000000000..b89d293dcff7 --- /dev/null +++ b/eslint/babel-eslint-parser/eslint @@ -0,0 +1 @@ +Subproject commit b89d293dcff77b52eb39902e1e2453fc6678850a diff --git a/eslint/babel-eslint-parser/eslint-tester.js b/eslint/babel-eslint-parser/eslint-tester.js new file mode 100644 index 000000000000..52924fa93983 --- /dev/null +++ b/eslint/babel-eslint-parser/eslint-tester.js @@ -0,0 +1,6 @@ +var ESLintTester = require("./eslint/node_modules/eslint-tester"); + +console.log("Use babel-eslint for test suite"); +ESLintTester.setDefaultConfig({ + parser: "../../index" +}); diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 8fab55c0a118..c33550c811a8 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -13,6 +13,8 @@ "lodash.pick": "^3.1.0" }, "scripts": { + "bootstrap": "git submodule update --init && cd eslint && npm install", + "eslint": "cd eslint && mocha -c tests/lib/rules/**/*.js -r ../eslint-tester.js", "test": "mocha" }, "author": "Sebastian McKenzie ", @@ -22,7 +24,8 @@ }, "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { - "eslint": "^0.22.1", + "eslint": "^0.21.2", + "eslint-tester": "^0.7.0", "espree": "^2.0.0", "mocha": "^2.1.0" } From d83aa7f6ce186a7ae88206111edc518f0d093004 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 8 Jun 2015 09:41:12 -0400 Subject: [PATCH 129/569] clarify known eslint issues, add to link slack channel for questions --- eslint/babel-eslint-parser/README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index 808db61daf28..ec6b7d00f2a7 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -6,7 +6,13 @@ **NOTE:** Please note that this is experimental and may have numerous bugs. It is however successfuly linting the [babel core](https://github.com/babel/babel/blob/master/.eslintrc). -If there's an issue, check if it can be reproduced with the regular parser and with the latest versions of `eslint` and `babel-eslint`. For issues related to JSX, see if [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) helps! +If there is an issue, first check if it can be reproduced with the regular parser and with the latest versions of `eslint` and `babel-eslint`. + +For questions and support please visit the `#linting` [babel slack channel](https://babel-slack.herokuapp.com)! + +## Known Issues +> For issues related to JSX (especially `no-unused-vars`), see if [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) helps! +- `generator-star` with async/await functions [#78](https://github.com/babel/babel-eslint/issues/78) ## How does it work? From 1c25c8eed39fe6783273f130111abb2c67c78b40 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 9 Jun 2015 15:00:38 -0400 Subject: [PATCH 130/569] Merge pull request babel/babel-eslint#126 from leebyron/fix-flow-type Fixes flow type scoping issues - fixes babel/babel-eslint#123 --- eslint/babel-eslint-parser/index.js | 52 ++++++---- .../test/non-regression.js | 97 +++++++++++++------ 2 files changed, 101 insertions(+), 48 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 81475eb7aa6f..e78025c0f912 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -162,37 +162,49 @@ function monkeypatch() { if (node.typeAnnotation) { visitTypeAnnotation.call(this, node.typeAnnotation); } else if (node.type === "Identifier") { - // exception for polymorphic types: , , etc - if (node.name.length === 1 && node.name === node.name.toUpperCase()) { - return; - } this.visit(node); } else { visitTypeAnnotation.call(this, node); } } + function nestTypeParamScope(manager, node) { + var parentScope = manager.__currentScope; + var scope = new escope.Scope(manager, "type-parameters", parentScope, node, false); + manager.__nestScope(scope); + for (var j = 0; j < node.typeParameters.params.length; j++) { + var name = node.typeParameters.params[j]; + scope.__define(name, new Definition("TypeParameter", name, name)); + } + scope.__define = function() { + return parentScope.__define.apply(parentScope, arguments); + } + return scope; + } + // visit decorators that are in: ClassDeclaration / ClassExpression var visitClass = referencer.prototype.visitClass; referencer.prototype.visitClass = function(node) { visitDecorators.call(this, node); + var typeParamScope; + if (node.typeParameters) { + typeParamScope = nestTypeParamScope(this.scopeManager, node); + } // visit flow type: ClassImplements if (node.implements) { for (var i = 0; i < node.implements.length; i++) { checkIdentifierOrVisit.call(this, node.implements[i]); } } - if (node.typeParameters) { - for (var j = 0; j < node.typeParameters.params.length; j++) { - checkIdentifierOrVisit.call(this, node.typeParameters.params[j]); - } - } if (node.superTypeParameters) { for (var k = 0; k < node.superTypeParameters.params.length; k++) { checkIdentifierOrVisit.call(this, node.superTypeParameters.params[k]); } } visitClass.call(this, node); + if (typeParamScope) { + this.close(node); + } }; // visit decorators that are in: Property / MethodDefinition var visitProperty = referencer.prototype.visitProperty; @@ -207,6 +219,10 @@ function monkeypatch() { // visit flow type in FunctionDeclaration, FunctionExpression, ArrowFunctionExpression var visitFunction = referencer.prototype.visitFunction; referencer.prototype.visitFunction = function(node) { + var typeParamScope; + if (node.typeParameters) { + typeParamScope = nestTypeParamScope(this.scopeManager, node); + } if (node.returnType) { checkIdentifierOrVisit.call(this, node.returnType); } @@ -218,12 +234,10 @@ function monkeypatch() { } } } - if (node.typeParameters) { - for (var j = 0; j < node.typeParameters.params.length; j++) { - checkIdentifierOrVisit.call(this, node.typeParameters.params[j]); - } - } visitFunction.call(this, node); + if (typeParamScope) { + this.close(node); + } }; // visit flow type in VariableDeclaration @@ -261,13 +275,15 @@ function monkeypatch() { referencer.prototype.TypeAlias = function(node) { createScopeVariable.call(this, node, node.id); + var typeParamScope; + if (node.typeParameters) { + typeParamScope = nestTypeParamScope(this.scopeManager, node); + } if (node.right) { visitTypeAnnotation.call(this, node.right); } - if (node.typeParameters) { - for (var i = 0; i < node.typeParameters.params.length; i++) { - checkIdentifierOrVisit.call(this, node.typeParameters.params[i]); - } + if (typeParamScope) { + this.close(node); } }; diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index a0b149c2f2bb..de0bfbf66b90 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -169,8 +169,8 @@ describe("verify", function () { verifyAndAssertMessages([ "import type Foo from 'foo';", "import type Foo2 from 'foo';", - "function log() {}", - "log();" + "function log(a: T1, b: T2) { return a + b; }", + "log(1, 2);" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] @@ -276,9 +276,8 @@ describe("verify", function () { it("type alias with type parameters", function () { verifyAndAssertMessages([ "import type Bar from 'foo';", - "import type Foo2 from 'foo';", "import type Foo3 from 'foo';", - "type Foo = Bar", + "type Foo = Bar", "var x : Foo = 1; x;" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, @@ -316,6 +315,62 @@ describe("verify", function () { ); }); + it("polymorphpic/generic types for class #123", function () { + verifyAndAssertMessages([ + "class Box {", + "value: T;", + "}", + "var box = new Box();", + "console.log(box.value);" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("polymorphpic/generic types for function #123", function () { + verifyAndAssertMessages([ + "export function identity(value) {", + "var a: T = value; a;", + "}" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("polymorphpic/generic types for type alias #123", function () { + verifyAndAssertMessages([ + "import Bar from './Bar';", + "type Foo = Bar; var x: Foo = 1; x++" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("polymorphpic/generic types - outside of fn scope #123", function () { + verifyAndAssertMessages([ + "export function foo(value) {", + "};", + "var b: T = 1; b;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [ '1:20 T is defined but never used no-unused-vars', + '3:7 "T" is not defined. no-undef' ] + ); + }); + + it("polymorphpic/generic types - extending unknown #123", function () { + verifyAndAssertMessages([ + "import Bar from 'bar';", + "export class Foo extends Bar {}", + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [ '2:29 "T" is not defined. no-undef' ] + ); + }); + it("1", function () { verifyAndAssertMessages( [ @@ -413,9 +468,7 @@ describe("verify", function () { it("9", function () { verifyAndAssertMessages( [ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "export default function () {}" + "export default function (a: T1, b: T2) {}" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] @@ -425,9 +478,7 @@ describe("verify", function () { it("10", function () { verifyAndAssertMessages( [ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "var a=function() {}; a;" + "var a=function(a: T1, b: T2) {return a + b;}; a;" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] @@ -437,10 +488,7 @@ describe("verify", function () { it("11", function () { verifyAndAssertMessages( [ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "import type Foo3 from 'foo';", - "var a={*id(x: Foo2): Foo3 { x; }}; a;" + "var a={*id(x: T): T { x; }}; a;" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] @@ -450,10 +498,7 @@ describe("verify", function () { it("12", function () { verifyAndAssertMessages( [ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "import type Foo3 from 'foo';", - "var a={async id(x: Foo2): Foo3 { x; }}; a;" + "var a={async id(x: T): T { x; }}; a;" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] @@ -463,10 +508,7 @@ describe("verify", function () { it("13", function () { verifyAndAssertMessages( [ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "import type Foo3 from 'foo';", - "var a={123(x: Foo2): Foo3 { x; }}; a;" + "var a={123(x: T): T { x; }}; a;" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] @@ -597,10 +639,8 @@ describe("verify", function () { it("24", function () { verifyAndAssertMessages( [ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "import Baz from 'foo';", - "export default class Bar extends Baz { };" + "import type Baz from 'baz';", + "export default class Bar extends Baz { };" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] @@ -610,10 +650,7 @@ describe("verify", function () { it("25", function () { verifyAndAssertMessages( [ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "import type Foo3 from 'foo';", - "export default class Bar { bar():Foo3 { return 42; }}" + "export default class Bar { bar(): T { return 42; }}" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] From d5e2ac1fb656e42bb10d6d03409e0e85d0299f8f Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 9 Jun 2015 15:01:13 -0400 Subject: [PATCH 131/569] 3.1.15 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index c33550c811a8..f50310602aac 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.1.14", + "version": "3.1.15", "description": "", "main": "index.js", "repository": { From eaec0f15953a9a83b35dc4ec071783323f25a28c Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 10 Jun 2015 17:07:53 -0400 Subject: [PATCH 132/569] remove uneeded param --- eslint/babel-eslint-parser/acorn-to-esprima.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index 479e4f97d505..a5a11835ca84 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -216,7 +216,7 @@ var astTransformVisitor = { delete node.isType; } - if (this.isExportDeclaration(node)) { + if (this.isExportDeclaration())) { var declar = this.get("declaration"); if (declar.isClassExpression()) { node.declaration.type = "ClassDeclaration"; From 0c47ebe88128814433f681da1649199f97c5e803 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 10 Jun 2015 17:11:21 -0400 Subject: [PATCH 133/569] fix build.. --- eslint/babel-eslint-parser/acorn-to-esprima.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index a5a11835ca84..9dfdfffa1d71 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -216,7 +216,7 @@ var astTransformVisitor = { delete node.isType; } - if (this.isExportDeclaration())) { + if (this.isExportDeclaration()) { var declar = this.get("declaration"); if (declar.isClassExpression()) { node.declaration.type = "ClassDeclaration"; From da3d4bf5377c5f439e03abb8b30a2112c9c02329 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 15 Jun 2015 20:25:44 -0400 Subject: [PATCH 134/569] Known Issue: object-shorthand with spread operator --- eslint/babel-eslint-parser/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index ec6b7d00f2a7..ff69f517869b 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -13,6 +13,7 @@ For questions and support please visit the `#linting` [babel slack channel](http ## Known Issues > For issues related to JSX (especially `no-unused-vars`), see if [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) helps! - `generator-star` with async/await functions [#78](https://github.com/babel/babel-eslint/issues/78) +- `object-shorthand` with spread operator [#131](https://github.com/babel/babel-eslint/issues/131) ## How does it work? From d224153cba45568222298867fc4e5c13869dd76c Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 17 Jun 2015 07:17:26 -0400 Subject: [PATCH 135/569] Merge pull request babel/babel-eslint#133 from hzoo/i-132 support flow declarations correctly, lint - fixes babel/babel-eslint#132 --- eslint/babel-eslint-parser/acorn-to-esprima.js | 11 +---------- eslint/babel-eslint-parser/index.js | 17 +++++++++++++++-- .../babel-eslint-parser/test/non-regression.js | 16 ++++++++++++++-- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index 9dfdfffa1d71..7809f04a1f8b 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -183,7 +183,7 @@ var astTransformVisitor = { return node.argument; } - // prevent "no-undef" + // flow: prevent "no-undef" // for "Component" in: "let x: React.Component" if (this.isQualifiedTypeIdentifier()) { delete node.id; @@ -201,15 +201,6 @@ var astTransformVisitor = { delete node.name; } - // flow - - if (this.isDeclareModule() || - this.isDeclareClass() || - this.isDeclareFunction() || - this.isDeclareVariable()) { - return this.dangerouslyRemove(); - } - // modules if (this.isImportDeclaration()) { diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index e78025c0f912..f69d9f0a2cb7 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -178,7 +178,7 @@ function monkeypatch() { } scope.__define = function() { return parentScope.__define.apply(parentScope, arguments); - } + }; return scope; } @@ -250,7 +250,7 @@ function monkeypatch() { if (typeAnnotation) { checkIdentifierOrVisit.call(this, typeAnnotation); } - if (id.type === 'ObjectPattern') { + if (id.type === "ObjectPattern") { for (var j = 0; j < id.properties.length; j++) { this.visit(id.properties[j]); } @@ -304,6 +304,19 @@ function monkeypatch() { this.visit(node.right); } }; + + referencer.prototype.DeclareModule = + referencer.prototype.DeclareFunction = + referencer.prototype.DeclareVariable = + referencer.prototype.DeclareClass = function(node) { + var typeParamScope; + if (node.typeParameters) { + typeParamScope = nestTypeParamScope(this.scopeManager, node); + } + if (typeParamScope) { + this.close(node); + } + }; } exports.attachComments = function (ast, comments, tokens) { diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index de0bfbf66b90..4b4665f270aa 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -356,7 +356,7 @@ describe("verify", function () { "var b: T = 1; b;" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, - [ '1:20 T is defined but never used no-unused-vars', + [ "1:20 T is defined but never used no-unused-vars", '3:7 "T" is not defined. no-undef' ] ); }); @@ -371,6 +371,18 @@ describe("verify", function () { ); }); + it("support declarations #132", function () { + verifyAndAssertMessages([ + "declare class A { static () : number }", + "declare module B { declare var x: number; }", + "declare function foo(): void;", + "declare var bar" + ].join("\n"), + { "no-undef": 1, "no-unused-vars": 1 }, + [] + ); + }); + it("1", function () { verifyAndAssertMessages( [ @@ -1133,6 +1145,6 @@ describe("verify", function () { "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", { "no-undef": 1, "no-unused-vars": 1 }, [] - ) + ); }); }); From d16f726b1527f6c37b8b1d7b1c021042c9c50d72 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 17 Jun 2015 07:18:47 -0400 Subject: [PATCH 136/569] 3.1.16 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index f50310602aac..ddf3bf744aea 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.1.15", + "version": "3.1.16", "description": "", "main": "index.js", "repository": { From 0de733b66aae21a35e1ecb81d7d90405ab41a2c8 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 17 Jun 2015 09:18:51 -0400 Subject: [PATCH 137/569] flow: create var declaration for flow declarations --- eslint/babel-eslint-parser/index.js | 4 ++++ eslint/babel-eslint-parser/test/non-regression.js | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index f69d9f0a2cb7..93400573d16c 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -309,6 +309,10 @@ function monkeypatch() { referencer.prototype.DeclareFunction = referencer.prototype.DeclareVariable = referencer.prototype.DeclareClass = function(node) { + if (node.id) { + createScopeVariable.call(this, node, node.id); + } + var typeParamScope; if (node.typeParameters) { typeParamScope = nestTypeParamScope(this.scopeManager, node); diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 4b4665f270aa..6420d1abdd19 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -376,7 +376,8 @@ describe("verify", function () { "declare class A { static () : number }", "declare module B { declare var x: number; }", "declare function foo(): void;", - "declare var bar" + "declare var bar", + "A; B; foo(); bar;" ].join("\n"), { "no-undef": 1, "no-unused-vars": 1 }, [] From cf57c817cbdd320f4ad1ec0bed1a0dd101e823fd Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 17 Jun 2015 20:31:58 -0400 Subject: [PATCH 138/569] Known Issues: add flow declarations with 'no-unused-vars' --- eslint/babel-eslint-parser/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index ff69f517869b..aed3e0bd531a 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -14,6 +14,7 @@ For questions and support please visit the `#linting` [babel slack channel](http > For issues related to JSX (especially `no-unused-vars`), see if [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) helps! - `generator-star` with async/await functions [#78](https://github.com/babel/babel-eslint/issues/78) - `object-shorthand` with spread operator [#131](https://github.com/babel/babel-eslint/issues/131) +- `no-unused-vars/no-undef` with Flow declarations (`declare module A {}`) [#132](https://github.com/babel/babel-eslint/issues/132#issuecomment-112815926) ## How does it work? From c3b0bb21e94ba85303988da08ad995d5965d1448 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 17 Jun 2015 20:32:16 -0400 Subject: [PATCH 139/569] 3.1.17 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index ddf3bf744aea..b1773b615453 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.1.16", + "version": "3.1.17", "description": "", "main": "index.js", "repository": { From cec51daa04b6afde07e22362affbd3cdb5ac4db0 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 18 Jun 2015 21:22:59 -0400 Subject: [PATCH 140/569] add message about using eslint-plugin-babel --- eslint/babel-eslint-parser/README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index aed3e0bd531a..e51c1f04f0b6 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -11,10 +11,14 @@ If there is an issue, first check if it can be reproduced with the regular parse For questions and support please visit the `#linting` [babel slack channel](https://babel-slack.herokuapp.com)! ## Known Issues -> For issues related to JSX (especially `no-unused-vars`), see if [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) helps! +- `no-unused-vars/no-undef` with Flow declarations (`declare module A {}`) [#132](https://github.com/babel/babel-eslint/issues/132#issuecomment-112815926) + +Please check out [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) for react/jsx issues +- `no-unused-vars` with jsx + +Please check out [eslint-plugin-babel](https://github.com/babel/eslint-plugin-babel) for the issues below: - `generator-star` with async/await functions [#78](https://github.com/babel/babel-eslint/issues/78) - `object-shorthand` with spread operator [#131](https://github.com/babel/babel-eslint/issues/131) -- `no-unused-vars/no-undef` with Flow declarations (`declare module A {}`) [#132](https://github.com/babel/babel-eslint/issues/132#issuecomment-112815926) ## How does it work? From 96a9af0a06d64dd47417773d6c6cf3b518dd03d9 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 22 Jun 2015 16:48:51 -0400 Subject: [PATCH 141/569] update eslint, update tests --- eslint/babel-eslint-parser/package.json | 9 ++++----- eslint/babel-eslint-parser/test/non-regression.js | 15 +++++++-------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index b1773b615453..cf924e48352b 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -8,7 +8,7 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "babel-core": "^5.5.1", + "babel-core": "^5.6.4", "lodash.assign": "^3.0.0", "lodash.pick": "^3.1.0" }, @@ -24,9 +24,8 @@ }, "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { - "eslint": "^0.21.2", - "eslint-tester": "^0.7.0", - "espree": "^2.0.0", - "mocha": "^2.1.0" + "eslint": "^0.23.0", + "espree": "^2.0.3", + "mocha": "^2.2.5" } } diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 6420d1abdd19..54ce33429cc3 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -47,7 +47,7 @@ describe("verify", function () { verifyAndAssertMessages( "{ , res }", {}, - [ "1:2 Unexpected token" ] + [ "1:2 Line X: Unexpected token" ] ); }); @@ -297,7 +297,7 @@ describe("verify", function () { it("polymorphpic types #109", function () { verifyAndAssertMessages([ - "export default function groupByEveryN(array: Array, n: number): Array> {}" + "export default function groupByEveryN(array: Array, n: number): Array> { n; }" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] @@ -351,13 +351,12 @@ describe("verify", function () { it("polymorphpic/generic types - outside of fn scope #123", function () { verifyAndAssertMessages([ - "export function foo(value) {", - "};", + "export function foo(value) { value; };", "var b: T = 1; b;" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [ "1:20 T is defined but never used no-unused-vars", - '3:7 "T" is not defined. no-undef' ] + '2:7 "T" is not defined. no-undef' ] ); }); @@ -481,7 +480,7 @@ describe("verify", function () { it("9", function () { verifyAndAssertMessages( [ - "export default function (a: T1, b: T2) {}" + "export default function (a: T1, b: T2) { b; }" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] @@ -744,7 +743,7 @@ describe("verify", function () { verifyAndAssertMessages( [ "import type Foo from 'foo';", - "export default function({x}: { x: Foo; }) {}" + "export default function({x}: { x: Foo; }) { x; }" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] @@ -958,7 +957,7 @@ describe("verify", function () { verifyAndAssertMessages([ "export default function root(stores) {", "return DecoratedComponent => class ReduxRootDecorator {", - "a() { DecoratedComponent; }", + "a() { DecoratedComponent; stores; }", "};", "}", ].join("\n"), From c22414c1fd5364c227d0bb569abf7813fd1dd931 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 22 Jun 2015 17:00:31 -0400 Subject: [PATCH 142/569] fix tests after updating babel --- eslint/babel-eslint-parser/test/non-regression.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 54ce33429cc3..c9d4aeb886aa 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1084,7 +1084,7 @@ describe("verify", function () { "get bar() { }", "@classMethodDeclarationA(decoratorParameter)", "@classMethodDeclarationA", - "set bar() { }", + "set bar(val) { val; }", "}" ].join("\n"), { "no-unused-vars": 1 }, @@ -1122,7 +1122,7 @@ describe("verify", function () { "get bar() { },", "@classMethodDeclarationA(decoratorParameter)", "@classMethodDeclarationA", - "set bar() { }", + "set bar(val) { val; }", "};", "obj;" ].join("\n"), From 7ff5dd56e849158871703ce3c00749fd9dd21a03 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 23 Jun 2015 18:32:09 -0400 Subject: [PATCH 143/569] Merge pull request babel/babel-eslint#135 from PiPeep/fix-jest Fix eslint module path resolution in jest --- eslint/babel-eslint-parser/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 93400573d16c..f6eafd46f282 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -22,9 +22,15 @@ function monkeypatch() { var eslintLoc; try { + // avoid importing a local copy of eslint, try to find a peer dependency eslintLoc = Module._resolveFilename("eslint", module.parent); } catch (err) { - throw new ReferenceError("couldn't resolve eslint"); + try { + // avoids breaking in jest where module.parent is undefined + eslintLoc = require.resolve("eslint"); + } catch (err) { + throw new ReferenceError("couldn't resolve eslint"); + } } // get modules relative to what eslint will load From b05ae77e4158c0efdc3ff84ce2aec98c304335fc Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 23 Jun 2015 18:32:44 -0400 Subject: [PATCH 144/569] 3.1.18 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index cf924e48352b..c4a95cc03a7e 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.1.17", + "version": "3.1.18", "description": "", "main": "index.js", "repository": { From e72e79694f58a5718b5b5bf9d17229639dc5a836 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Fri, 26 Jun 2015 15:06:18 +0100 Subject: [PATCH 145/569] attempt to resolve estraverse relative to esrecurse if found - this is necessary because of the tree flattening in npm 3 --- eslint/babel-eslint-parser/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index f6eafd46f282..7d09ca5043fd 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -38,8 +38,15 @@ function monkeypatch() { var escopeLoc = Module._resolveFilename("escope", eslintMod); var escopeMod = createModule(escopeLoc); + // npm 3: monkeypatch estraverse if it's in escope + var estraverseRelative = escopeMod; + try { + var esrecurseLoc = Module._resolveFilename("esrecurse", eslintMod); + estraverseRelative = createModule(esrecurseLoc); + } catch (err) {} + // monkeypatch estraverse - estraverse = escopeMod.require("estraverse"); + estraverse = estraverseRelative.require("estraverse"); assign(estraverse.VisitorKeys, t.VISITOR_KEYS); // monkeypatch estraverse-fb From 1502bf6a2d6ed560130053e4840f0604a60c1d8d Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Fri, 26 Jun 2015 15:06:21 +0100 Subject: [PATCH 146/569] 3.1.19 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index c4a95cc03a7e..5496628643ee 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.1.18", + "version": "3.1.19", "description": "", "main": "index.js", "repository": { From dee7261bbead22e9c22cac30e62d40d1283fc0fc Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 29 Jun 2015 13:48:19 -0400 Subject: [PATCH 147/569] Merge pull request babel/babel-eslint#140 from hzoo/i-138 create scope for each comprehension - fixes babel/babel-eslint#138 --- eslint/babel-eslint-parser/index.js | 41 ++++++++++++++----- .../test/non-regression.js | 30 ++++++++++++-- 2 files changed, 57 insertions(+), 14 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 7d09ca5043fd..44893c80e4ae 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -300,22 +300,41 @@ function monkeypatch() { } }; - referencer.prototype.ComprehensionBlock = function(node) { - var left = node.left; - if (left) { - if (left.type === "Identifier") { - createScopeVariable.call(this, node, left); - } else if (left.type === "ArrayPattern") { - for (var i = 0; i < left.elements.length; i++) { - if (left.elements[i]) { - createScopeVariable.call(this, left.elements, left.elements[i]); + referencer.prototype.ComprehensionExpression = function(node) { + for (var i = 0; i < node.blocks.length; i++) { + var block = node.blocks[i]; + if (block.left) { + var scope = new escope.Scope(this.scopeManager, "comprehensions", this.currentScope(), node, false); + this.scopeManager.__nestScope(scope); + + var left = block.left; + if (left.type === "Identifier") { + scope.__define(left, new Definition("ComprehensionElement", left, left)); + } else if (left.type === "ArrayPattern") { + for (var i = 0; i < left.elements.length; i++) { + var name = left.elements[i]; + if (name) { + scope.__define(name, new Definition("ComprehensionElement", name, name)); + } + } + } else if (left.type === "ObjectPattern") { + for (var i = 0; i < left.properties.length; i++) { + var name = left.properties[i]; + if (name && name.key && name.key.type === 'Identifier') { + scope.__define(name.key, new Definition("ComprehensionElement", name.key, name.key)); + } } } } + if (block.right) { + this.visit(block.right); + } } - if (node.right) { - this.visit(node.right); + if (node.filter) { + this.visit(block.filter); } + this.visit(node.body); + this.close(node); }; referencer.prototype.DeclareModule = diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index c9d4aeb886aa..6be4343f42b0 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1017,7 +1017,7 @@ describe("verify", function () { ); }); - it("expression, if statement, multiple blocks", function () { + it("generator, if statement, multiple blocks", function () { verifyAndAssertMessages([ "let arr = [1, 2, 3];", "let arr2 = [1, 2, 3];", @@ -1031,13 +1031,37 @@ describe("verify", function () { it("ArrayPattern", function () { verifyAndAssertMessages([ "let arr = [1, 2, 3];", - "let arr2 = [1, 2, 3];", - "[for ([,x] of arr) for ({[start.x]: x, [start.y]: y} of arr2) x]" + "[for ([,x] of arr) x]" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); + + it("ObjectPattern", function () { + verifyAndAssertMessages([ + "let arr = [{x: 1, y: 2}, {x: 2, y: 3}];", + "[for ({x, y} of arr) x + y]" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); + + it("multiple comprehensions #138", function () { + verifyAndAssertMessages([ + "function test() {", + "let items;", + "return {", + "a: [for (i of items) i],", + "b: [for (i of items) i]", + "};", + "} test;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1, "no-redeclare": 1 }, + [] + ); + }); }); describe("decorators #72", function () { From 6b05576d9902102b557e450d3b8aa24eb6164dbd Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 29 Jun 2015 13:51:50 -0400 Subject: [PATCH 148/569] 3.1.20 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 5496628643ee..7c601765e485 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.1.19", + "version": "3.1.20", "description": "", "main": "index.js", "repository": { From 0de11015cc7126dfdeb78b759fd28bf0685861e0 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 29 Jun 2015 14:19:06 -0400 Subject: [PATCH 149/569] update devDep eslint@0.24.0 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 7c601765e485..05bfc82b87de 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -24,7 +24,7 @@ }, "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { - "eslint": "^0.23.0", + "eslint": "^0.24.0", "espree": "^2.0.3", "mocha": "^2.2.5" } From b26b8efca4ade5312103235eed3b03f03751647b Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 1 Jul 2015 11:27:42 -0400 Subject: [PATCH 150/569] add known issue for babel/babel-eslint#136 --- eslint/babel-eslint-parser/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index e51c1f04f0b6..297e1751f21c 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -12,6 +12,7 @@ For questions and support please visit the `#linting` [babel slack channel](http ## Known Issues - `no-unused-vars/no-undef` with Flow declarations (`declare module A {}`) [#132](https://github.com/babel/babel-eslint/issues/132#issuecomment-112815926) +- `no-unused-vars: [2, {vars: local}]` [#136](https://github.com/babel/babel-eslint/issues/136) Please check out [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) for react/jsx issues - `no-unused-vars` with jsx From 78a7af3c0a77781a8182b738a4ac98a578cec78f Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 1 Jul 2015 11:38:00 -0400 Subject: [PATCH 151/569] add known issue for babel/babel-eslint#130 - `no-undef` for global flow types --- eslint/babel-eslint-parser/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index 297e1751f21c..c185ba0fc786 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -11,6 +11,8 @@ If there is an issue, first check if it can be reproduced with the regular parse For questions and support please visit the `#linting` [babel slack channel](https://babel-slack.herokuapp.com)! ## Known Issues +- `no-undef` for global flow types: `ReactElement`, `ReactClass` [#130](https://github.com/babel/babel-eslint/issues/130#issuecomment-111215076) + - Workaround: define types as globals in `.eslintrc` or define types and import them `import type ReactElement from './types'` - `no-unused-vars/no-undef` with Flow declarations (`declare module A {}`) [#132](https://github.com/babel/babel-eslint/issues/132#issuecomment-112815926) - `no-unused-vars: [2, {vars: local}]` [#136](https://github.com/babel/babel-eslint/issues/136) From 4e884f439ec05fb2e543b011803fdae11fae9ac2 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sun, 5 Jul 2015 22:06:15 -0400 Subject: [PATCH 152/569] Merge pull request babel/babel-eslint#143 from hzoo/i-142 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit only visit properties in object destructuring when there is a SpreadP… --- eslint/babel-eslint-parser/acorn-to-esprima.js | 2 +- eslint/babel-eslint-parser/index.js | 11 +++++++++-- eslint/babel-eslint-parser/test/non-regression.js | 8 ++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index 7809f04a1f8b..8681d04e5d71 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -172,7 +172,7 @@ var astTransformVisitor = { noScope: true, exit: function (node) { /* parent */ if (this.isSpreadProperty()) { - node.type = "Property"; + node.type = "SpreadProperty"; node.kind = "init"; node.computed = true; node.key = node.value = node.argument; diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 44893c80e4ae..e37e5417e329 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -264,8 +264,15 @@ function monkeypatch() { checkIdentifierOrVisit.call(this, typeAnnotation); } if (id.type === "ObjectPattern") { - for (var j = 0; j < id.properties.length; j++) { - this.visit(id.properties[j]); + // check if object destructuring has a spread + var hasSpread = id.properties.filter(function(p) { + return p.type === "SpreadProperty" + }); + // visit properties if so + if (hasSpread.length > 0) { + for (var j = 0; j < id.properties.length; j++) { + this.visit(id.properties[j]); + } } } } diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 6be4343f42b0..553594df778d 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1171,4 +1171,12 @@ describe("verify", function () { [] ); }); + + it("detects no-unused-vars with object destructuring #142", function () { + verifyAndAssertMessages( + "const {Bacona} = require('baconjs')", + { "no-undef": 1, "no-unused-vars": 1 }, + [ "1:7 Bacona is defined but never used no-unused-vars" ] + ); + }); }); From 8c4adbf98d85a420e2bb4b873c8a10a06490f18a Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sun, 5 Jul 2015 22:08:19 -0400 Subject: [PATCH 153/569] 3.1.21 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 05bfc82b87de..247f86c3abff 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.1.20", + "version": "3.1.21", "description": "", "main": "index.js", "repository": { From d9bf8d252e54972c0bcb673db303ead2dceb1d87 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 6 Jul 2015 09:36:34 -0400 Subject: [PATCH 154/569] fix no-unused-vars issue with spread Use a private _spread property on Property node instead of SpreadProperty Fixes https://github.com/babel/babel-eslint/issues/142#issuecomment-118707124 --- eslint/babel-eslint-parser/acorn-to-esprima.js | 4 +++- eslint/babel-eslint-parser/index.js | 2 +- eslint/babel-eslint-parser/test/non-regression.js | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index 8681d04e5d71..d1e1d8151c8e 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -172,7 +172,9 @@ var astTransformVisitor = { noScope: true, exit: function (node) { /* parent */ if (this.isSpreadProperty()) { - node.type = "SpreadProperty"; + // private var to track if it's a spread property + node._spread = true; + node.type = "Property"; node.kind = "init"; node.computed = true; node.key = node.value = node.argument; diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index e37e5417e329..7a755aaeb9bc 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -266,7 +266,7 @@ function monkeypatch() { if (id.type === "ObjectPattern") { // check if object destructuring has a spread var hasSpread = id.properties.filter(function(p) { - return p.type === "SpreadProperty" + return p._spread === true; }); // visit properties if so if (hasSpread.length > 0) { diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 553594df778d..ed857f0e2a50 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1179,4 +1179,18 @@ describe("verify", function () { [ "1:7 Bacona is defined but never used no-unused-vars" ] ); }); + + it("don't warn no-unused-vars with spread #142", function () { + verifyAndAssertMessages([ + "export default function test(data) {", + "return {", + "foo: 'bar',", + "...data", + "};", + "}", + ].join("\n"), + { "no-undef": 1, "no-unused-vars": 1 }, + [] + ); + }); }); From f57dde1ac3480b7d5a144da7f233d54547cc5ae5 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 6 Jul 2015 09:38:11 -0400 Subject: [PATCH 155/569] 3.1.22 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 247f86c3abff..1a0fc85c1c7f 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.1.21", + "version": "3.1.22", "description": "", "main": "index.js", "repository": { From 05f5cc3ea8f298c9fbc5558f0b40ad7bf846b4b6 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 6 Jul 2015 10:40:11 -0400 Subject: [PATCH 156/569] Merge pull request babel/babel-eslint#146 from hzoo/i-142-2 use node.babelType for SpreadProperty --- eslint/babel-eslint-parser/acorn-to-esprima.js | 6 ++++-- eslint/babel-eslint-parser/index.js | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index d1e1d8151c8e..82983ca1de66 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -170,10 +170,12 @@ function convertTemplateType(tokens) { var astTransformVisitor = { noScope: true, + enter: function (node) { + // private var to track original node type + node._babelType = node.type; + }, exit: function (node) { /* parent */ if (this.isSpreadProperty()) { - // private var to track if it's a spread property - node._spread = true; node.type = "Property"; node.kind = "init"; node.computed = true; diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 7a755aaeb9bc..6d4da4d7036b 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -266,7 +266,7 @@ function monkeypatch() { if (id.type === "ObjectPattern") { // check if object destructuring has a spread var hasSpread = id.properties.filter(function(p) { - return p._spread === true; + return p._babelType === "SpreadProperty"; }); // visit properties if so if (hasSpread.length > 0) { From 39fa1c4ac2db673869d42e59950708279844fea0 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 6 Jul 2015 10:40:56 -0400 Subject: [PATCH 157/569] 3.1.23 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 1a0fc85c1c7f..a1486a6b32b2 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.1.22", + "version": "3.1.23", "description": "", "main": "index.js", "repository": { From efef3af7b81756a1efa49c2b4fddf878f4d100de Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 9 Jul 2015 13:11:14 -0400 Subject: [PATCH 158/569] update readme - separate channel/signup, categorize known issues better --- eslint/babel-eslint-parser/README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index c185ba0fc786..7556b2998fc0 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -6,17 +6,20 @@ **NOTE:** Please note that this is experimental and may have numerous bugs. It is however successfuly linting the [babel core](https://github.com/babel/babel/blob/master/.eslintrc). -If there is an issue, first check if it can be reproduced with the regular parser and with the latest versions of `eslint` and `babel-eslint`. +> If there is an issue, first check if it can be reproduced with the regular parser or with the latest versions of `eslint` and `babel-eslint`! -For questions and support please visit the `#linting` [babel slack channel](https://babel-slack.herokuapp.com)! +For questions and support please visit the [`#linting`](https://babeljs.slack.com/messages/linting/) babel slack channel (sign up [here](https://babel-slack.herokuapp.com))! ## Known Issues +Flow: - `no-undef` for global flow types: `ReactElement`, `ReactClass` [#130](https://github.com/babel/babel-eslint/issues/130#issuecomment-111215076) - Workaround: define types as globals in `.eslintrc` or define types and import them `import type ReactElement from './types'` - `no-unused-vars/no-undef` with Flow declarations (`declare module A {}`) [#132](https://github.com/babel/babel-eslint/issues/132#issuecomment-112815926) + +Modules/strict mode - `no-unused-vars: [2, {vars: local}]` [#136](https://github.com/babel/babel-eslint/issues/136) -Please check out [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) for react/jsx issues +Please check out [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) for React/JSX issues - `no-unused-vars` with jsx Please check out [eslint-plugin-babel](https://github.com/babel/eslint-plugin-babel) for the issues below: From 61555c6ebd787aa044d394850ae847ba0aba92e5 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 10 Jul 2015 18:37:45 -0400 Subject: [PATCH 159/569] fix typo: attachComment -> attachComments --- eslint/babel-eslint-parser/test/babel-eslint.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 64260de8153f..b9b1201cae6b 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -61,7 +61,7 @@ function parseAndAssertSame(code) { loc: true, range: true, comment: true, - attachComment: true + attachComments: true }); var acornAST = babelEslint.parse(code); try { From e7aecdce711b604a3d5e0be9ad05dff7ef910cc8 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Tue, 21 Jul 2015 22:34:14 +0100 Subject: [PATCH 160/569] convert comment node types from babel to espree - ref facebook/react#4449 --- eslint/babel-eslint-parser/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 6d4da4d7036b..355fc5d34e68 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -447,6 +447,14 @@ exports.parse = function (code) { ast.tokens = acornToEsprima.toTokens(tokens); // add comments + for (var i = 0; i < comments.length; i++) { + var comment = comments[i]; + if (comment.type === "CommentBlock") { + comment.type = "Block"; + } else if (comment.type === "CommentLine") { + comment.type = "Line"; + } + } ast.comments = comments; exports.attachComments(ast, comments, tokens); From 8baea68c6c0c71460d2850e9b56ce9c46c49a3a6 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Tue, 21 Jul 2015 22:34:24 +0100 Subject: [PATCH 161/569] 3.1.24 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index a1486a6b32b2..e9c0d8261ce8 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.1.23", + "version": "3.1.24", "description": "", "main": "index.js", "repository": { From c551545f29978c46a4249288cc1bf1d386e9c89d Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 22 Jul 2015 01:19:23 +0100 Subject: [PATCH 162/569] filter comment tokens - fixes babel/babel-eslint#153 --- .../babel-eslint-parser/acorn-to-esprima.js | 4 ++- .../test/non-regression.js | 25 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index 82983ca1de66..c30023ef364d 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -70,7 +70,9 @@ exports.toTokens = function (tokens) { // transform tokens to type "Template" convertTemplateType(tokens); - return tokens.map(exports.toToken); + return tokens.filter(function (token) { + return token.type !== "CommentLine" && token.type !== "CommentBlock"; + }).map(exports.toToken); }; function convertTemplateType(tokens) { diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index ed857f0e2a50..27f8f299e1e9 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1193,4 +1193,29 @@ describe("verify", function () { [] ); }); + + it("excludes comment tokens #153", function () { + verifyAndAssertMessages( + [ + "var a = [", + "1,", + "2, // a trailing comment makes this line fail comma-dangle (always-multiline)", + "];", + ].join("\n"), + { "comma-dangle": [2, "always-multiline"] }, + [] + ); + + verifyAndAssertMessages( + [ + "switch (a) {", + "// A comment here makes the above line fail brace-style", + "case 1:", + "console.log(a);", + "}" + ].join("\n"), + { "brace-style": 2 }, + [] + ); + }); }); From ec9a75173b13f023bb41d301a515cd6fe324ebda Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 22 Jul 2015 01:19:45 +0100 Subject: [PATCH 163/569] 3.1.25 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index e9c0d8261ce8..ccca7762ee10 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.1.24", + "version": "3.1.25", "description": "", "main": "index.js", "repository": { From 2bb5101112b4c60e910138449cd1d73b3db85b4e Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 21 Jul 2015 23:57:13 -0400 Subject: [PATCH 164/569] add test for babel/babel-eslint#149 --- eslint/babel-eslint-parser/test/non-regression.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 27f8f299e1e9..fee81e582d2a 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1218,4 +1218,13 @@ describe("verify", function () { [] ); }); + + it("ternary and parens #149", function () { + verifyAndAssertMessages([ + "true ? (true) : false;" + ].join("\n"), + { "space-infix-ops": 1 }, + [] + ); + }); }); From 9c452f5b14982c52ca835744306eb2f073b6d20b Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 22 Jul 2015 00:36:03 -0400 Subject: [PATCH 165/569] remove estraverse attach comments method, fix up tests --- eslint/babel-eslint-parser/index.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 355fc5d34e68..efbac4bf3b70 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -363,8 +363,6 @@ function monkeypatch() { } exports.attachComments = function (ast, comments, tokens) { - estraverse.attachComments(ast, comments, tokens); - if (comments.length) { var firstComment = comments[0]; var lastComment = comments[comments.length - 1]; @@ -456,7 +454,7 @@ exports.parse = function (code) { } } ast.comments = comments; - exports.attachComments(ast, comments, tokens); + exports.attachComments(ast, comments, ast.tokens); // transform esprima and acorn divergent nodes acornToEsprima.toAST(ast); From bb29041dce5730b0b5119f134e18a6af148bd21a Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 22 Jul 2015 01:35:33 -0400 Subject: [PATCH 166/569] 3.1.26 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index ccca7762ee10..dfb1c1101a74 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.1.25", + "version": "3.1.26", "description": "", "main": "index.js", "repository": { From 8d65e3e8940e702cd094572e6d9b5026eced5e08 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 25 Jul 2015 10:08:31 -0400 Subject: [PATCH 167/569] Merge pull request babel/babel-eslint#154 from alexkuz/master fix visiting filter in comprehension --- eslint/babel-eslint-parser/index.js | 2 +- eslint/babel-eslint-parser/test/non-regression.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index efbac4bf3b70..a1ceaa8b6bd0 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -338,7 +338,7 @@ function monkeypatch() { } } if (node.filter) { - this.visit(block.filter); + this.visit(node.filter); } this.visit(node.body); this.close(node); diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index fee81e582d2a..3709688a966d 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1062,6 +1062,17 @@ describe("verify", function () { [] ); }); + + it("visiting filter in comprehension", function () { + verifyAndAssertMessages([ + "function test(items, val) {", + "return [ for (i of items) if (i === val) i ];", + "} test;" + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); }); describe("decorators #72", function () { From 80888a1b2362c30c13a3f659190fdfdcf3255e0b Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 25 Jul 2015 10:53:17 -0400 Subject: [PATCH 168/569] 3.1.27 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index dfb1c1101a74..05d56fea5f96 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.1.26", + "version": "3.1.27", "description": "", "main": "index.js", "repository": { From d4318aa0d8d6510657cd07d01004fa60321b00ae Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 25 Jul 2015 11:00:42 -0400 Subject: [PATCH 169/569] Merge pull request babel/babel-eslint#128 from hzoo/i-124 add tests - for babel/babel-eslint#124 --- .../babel-eslint-parser/test/babel-eslint.js | 12 +++++++ .../test/non-regression.js | 34 +++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index b9b1201cae6b..9f0b2850684c 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -265,6 +265,18 @@ describe("acorn-to-esprima", function () { ].join("\n")); }); + it("block comments #124", function () { + parseAndAssertSame([ + "React.createClass({", + "render() {", + "// return (", + "//
", + "// ); // <-- this is the line that is reported", + "}", + "});" + ].join("\n")); + }); + it("null", function () { parseAndAssertSame("null"); }); diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 3709688a966d..3d2bd82e0740 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1238,4 +1238,38 @@ describe("verify", function () { [] ); }); + + // it("line comment space-in-parens #124", function () { + // verifyAndAssertMessages( + // [ + // "React.createClass({", + // "render() {", + // "// return (", + // "//
", + // "// ); // <-- this is the line that is reported", + // "}", + // "});" + // ].join("\n"), + // { "space-in-parens": 1 }, + // [ ] + // ) + // }); + + it("block comment space-in-parens #124", function () { + verifyAndAssertMessages( + [ + "React.createClass({", + "render() {", + "/*", + "return (", + "
", + "); // <-- this is the line that is reported", + "*/", + "}", + "});" + ].join("\n"), + { "space-in-parens": 1 }, + [ ] + ) + }); }); From c5bbf91892db71f02ef6cbf8b7ad262930dc0005 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 25 Jul 2015 11:08:08 -0400 Subject: [PATCH 170/569] Merge pull request babel/babel-eslint#152 from bgw/line-x Replace 'Line X' with actual line number --- eslint/babel-eslint-parser/index.js | 2 +- eslint/babel-eslint-parser/test/non-regression.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index a1ceaa8b6bd0..a686f5e02455 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -430,7 +430,7 @@ exports.parse = function (code) { err.column = err.loc.column; // remove trailing "(LINE:COLUMN)" acorn message and add in esprima syntax error message start - err.message = "Line X: " + err.message.replace(/ \((\d+):(\d+)\)$/, ""); + err.message = "Line " + err.lineNumber + ": " + err.message.replace(/ \((\d+):(\d+)\)$/, ""); } throw err; diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 3d2bd82e0740..c3f6721fd5d4 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -47,7 +47,7 @@ describe("verify", function () { verifyAndAssertMessages( "{ , res }", {}, - [ "1:2 Line X: Unexpected token" ] + [ "1:2 Unexpected token" ] ); }); From 44371323726560f4776e737b4c3a34e258319dc8 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 25 Jul 2015 11:08:25 -0400 Subject: [PATCH 171/569] 4.0.0 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 05d56fea5f96..a25a50949dc8 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "3.1.27", + "version": "4.0.0", "description": "", "main": "index.js", "repository": { From 56a27a06473cae47432b9d817e9112451f18a2fe Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 27 Jul 2015 02:21:18 +0100 Subject: [PATCH 172/569] add range property - fixes babel/babel-eslint#155 --- eslint/babel-eslint-parser/acorn-to-esprima.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index c30023ef364d..c527ea87bced 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -177,6 +177,8 @@ var astTransformVisitor = { node._babelType = node.type; }, exit: function (node) { /* parent */ + node.range = [node.start, node.end]; + if (this.isSpreadProperty()) { node.type = "Property"; node.kind = "init"; From 06ccbca7637527e5723bb946f52cc1437d0f72b4 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 27 Jul 2015 02:21:29 +0100 Subject: [PATCH 173/569] 4.0.1 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index a25a50949dc8..f47bbb142bc1 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "4.0.0", + "version": "4.0.1", "description": "", "main": "index.js", "repository": { From 582cf6cc8a2413f7e8af6ad845ca48fbe98affbd Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 27 Jul 2015 02:44:49 +0100 Subject: [PATCH 174/569] add missing ranges --- eslint/babel-eslint-parser/acorn-to-esprima.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index c527ea87bced..229b3b7c32b4 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -4,6 +4,7 @@ var t = require("babel-core").types; exports.toToken = function (token) { var type = token.type; + token.range = [token.start, token.end]; if (type === tt.name) { token.type = "Identifier"; @@ -63,6 +64,7 @@ exports.toToken = function (token) { exports.toAST = function (ast) { ast.sourceType = "module"; + ast.range = [ast.start, ast.end]; traverse(ast, astTransformVisitor); }; From af51b545bad46232a91189b738023c3ab2c30267 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 27 Jul 2015 02:44:56 +0100 Subject: [PATCH 175/569] 4.0.2 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index f47bbb142bc1..855b83181361 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "4.0.1", + "version": "4.0.2", "description": "", "main": "index.js", "repository": { From 19e2f1bb3376a6f2b190a2dd33430557ce78653f Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 27 Jul 2015 02:58:37 +0100 Subject: [PATCH 176/569] use start/end rather than directly using range in attachComments --- eslint/babel-eslint-parser/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index a686f5e02455..5a94fee62575 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -369,13 +369,13 @@ exports.attachComments = function (ast, comments, tokens) { // fixup program start if (!tokens.length) { // if no tokens, the program starts at the end of the last comment - ast.range[0] = lastComment.range[1]; + ast.start = lastComment.end; ast.loc.start.line = lastComment.loc.end.line; ast.loc.start.column = lastComment.loc.end.column; - } else if (firstComment.start < tokens[0].range[0]) { + } else if (firstComment.start < tokens[0].start) { // if there are comments before the first token, the program starts at the first token var token = tokens[0]; - ast.range[0] = token.range[0]; + ast.start = token.start; ast.loc.start.line = token.loc.start.line; ast.loc.start.column = token.loc.start.column; @@ -384,7 +384,7 @@ exports.attachComments = function (ast, comments, tokens) { if (ast.body.length) { var node = ast.body[0]; node.leadingComments = []; - var firstTokenStart = token.range[0]; + var firstTokenStart = token.start; var len = comments.length; for (var i = 0; i < len && comments[i].start < firstTokenStart; i++) { node.leadingComments.push(comments[i]); @@ -394,10 +394,10 @@ exports.attachComments = function (ast, comments, tokens) { // fixup program end if (tokens.length) { var lastToken = tokens[tokens.length - 1]; - if (lastComment.end > lastToken.range[1]) { + if (lastComment.end > lastToken.end) { // If there is a comment after the last token, the program ends at the // last token and not the comment - ast.range[1] = lastToken.range[1]; + ast.end = lastToken.end; ast.loc.end.line = lastToken.loc.end.line; ast.loc.end.column = lastToken.loc.end.column; } From 39e9fc9e408e27575c39a808ad1ab529ddb31225 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 27 Jul 2015 02:58:45 +0100 Subject: [PATCH 177/569] 4.0.3 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 855b83181361..287c11f46fe2 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "4.0.2", + "version": "4.0.3", "description": "", "main": "index.js", "repository": { From 2c868efbad1d03d4e70d21ea0762122153d3839e Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 27 Jul 2015 04:04:30 +0100 Subject: [PATCH 178/569] fix range generation for template tokens - fixes babel/babel-eslint#156 --- eslint/babel-eslint-parser/acorn-to-esprima.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index 229b3b7c32b4..4c1210857461 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -119,7 +119,8 @@ function convertTemplateType(tokens) { var templateToken = { type: "Template", value: createTemplateValue(start, end), - range: [tokens[start].start, tokens[end].end], + start: tokens[start].start, + end: tokens[end].end, loc: { start: tokens[start].loc.start, end: tokens[end].loc.end @@ -175,12 +176,12 @@ function convertTemplateType(tokens) { var astTransformVisitor = { noScope: true, enter: function (node) { + node.range = [node.start, node.end]; + // private var to track original node type node._babelType = node.type; }, exit: function (node) { /* parent */ - node.range = [node.start, node.end]; - if (this.isSpreadProperty()) { node.type = "Property"; node.kind = "init"; From 18b029ca882eb7f204fa9fca24c7d0c49b989030 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 27 Jul 2015 04:04:37 +0100 Subject: [PATCH 179/569] 4.0.4 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 287c11f46fe2..3ca955bd1237 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "4.0.3", + "version": "4.0.4", "description": "", "main": "index.js", "repository": { From f79577a7ec54c9a5fd547d106d87ab622b5ace44 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 27 Jul 2015 04:07:19 +0100 Subject: [PATCH 180/569] add Makefile --- eslint/babel-eslint-parser/Makefile | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 eslint/babel-eslint-parser/Makefile diff --git a/eslint/babel-eslint-parser/Makefile b/eslint/babel-eslint-parser/Makefile new file mode 100644 index 000000000000..c16045682f14 --- /dev/null +++ b/eslint/babel-eslint-parser/Makefile @@ -0,0 +1,7 @@ +.PHONY: publish-patch + +publish-patch: + mocha + npm version patch + npm publish + git push --tags From 436716fdd72ca67d406974503184e901919cc2f9 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 27 Jul 2015 04:20:19 +0100 Subject: [PATCH 181/569] update babel-core to 5.6.9 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 3ca955bd1237..b0fd855ecfef 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -8,7 +8,7 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "babel-core": "^5.6.4", + "babel-core": "^5.6.9", "lodash.assign": "^3.0.0", "lodash.pick": "^3.1.0" }, From 4255c0f812fb85ad1989d08903a5af42a567cae7 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 27 Jul 2015 04:20:26 +0100 Subject: [PATCH 182/569] 4.0.5 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index b0fd855ecfef..6e7e7d9ae4b1 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "4.0.4", + "version": "4.0.5", "description": "", "main": "index.js", "repository": { From 71ab33eff419688a70623003ffda88cc2ec04e50 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 3 Aug 2015 10:57:06 -0400 Subject: [PATCH 183/569] update to eslint 1.0.0, fix tests --- eslint/babel-eslint-parser/package.json | 2 +- .../babel-eslint-parser/test/non-regression.js | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 6e7e7d9ae4b1..6d8c84a93fb7 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -24,7 +24,7 @@ }, "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { - "eslint": "^0.24.0", + "eslint": "^1.0.0", "espree": "^2.0.3", "mocha": "^2.2.5" } diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index c3f6721fd5d4..4683dc6f3637 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -39,7 +39,7 @@ describe("verify", function () { verifyAndAssertMessages( "module.exports = \"something\";", { "eol-last": 1, "semi": 1 }, - [ "1:1 Newline required at end of file but not found. eol-last" ] + [ "1:2 Newline required at end of file but not found. eol-last" ] ); }); @@ -47,7 +47,7 @@ describe("verify", function () { verifyAndAssertMessages( "{ , res }", {}, - [ "1:2 Unexpected token" ] + [ "1:3 Unexpected token" ] ); }); @@ -108,10 +108,11 @@ describe("verify", function () { ); }); + // fix after updating to ESLint 1.0.0 it("Arrow function with non-block bodies (issue #20)", function () { verifyAndAssertMessages( "\"use strict\"; () => 1", - { "strict": 1 }, + { "strict": [1, "global"] }, [] ); }); @@ -355,8 +356,8 @@ describe("verify", function () { "var b: T = 1; b;" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, - [ "1:20 T is defined but never used no-unused-vars", - '2:7 "T" is not defined. no-undef' ] + [ "1:21 T is defined but never used no-unused-vars", + '2:8 "T" is not defined. no-undef' ] ); }); @@ -366,7 +367,7 @@ describe("verify", function () { "export class Foo extends Bar {}", ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, - [ '2:29 "T" is not defined. no-undef' ] + [ '2:30 "T" is not defined. no-undef' ] ); }); @@ -1171,7 +1172,7 @@ describe("verify", function () { verifyAndAssertMessages( "var unused;", { "no-unused-vars": 1 }, - [ "1:4 unused is defined but never used no-unused-vars" ] + [ "1:5 unused is defined but never used no-unused-vars" ] ); }); @@ -1187,7 +1188,7 @@ describe("verify", function () { verifyAndAssertMessages( "const {Bacona} = require('baconjs')", { "no-undef": 1, "no-unused-vars": 1 }, - [ "1:7 Bacona is defined but never used no-unused-vars" ] + [ "1:8 Bacona is defined but never used no-unused-vars" ] ); }); From 21294eb2283edec634a024c13891144f713c28ba Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 14 Aug 2015 22:00:10 -0400 Subject: [PATCH 184/569] update to eslint@1.1.0 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 6d8c84a93fb7..c1ec430846da 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -24,7 +24,7 @@ }, "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { - "eslint": "^1.0.0", + "eslint": "^1.1.0", "espree": "^2.0.3", "mocha": "^2.2.5" } From 839c5ed57713e3a2a663886aabd08b127b484a54 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 14 Aug 2015 22:00:25 -0400 Subject: [PATCH 185/569] use --follow-tags --- eslint/babel-eslint-parser/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/Makefile b/eslint/babel-eslint-parser/Makefile index c16045682f14..53bfdbc78a5f 100644 --- a/eslint/babel-eslint-parser/Makefile +++ b/eslint/babel-eslint-parser/Makefile @@ -4,4 +4,4 @@ publish-patch: mocha npm version patch npm publish - git push --tags + git push --follow-tags From 6476a8d916917ddb75b7c156ae7b50d1d7e0d438 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 15 Aug 2015 08:48:41 -0400 Subject: [PATCH 186/569] Merge pull request babel/babel-eslint#164 from hzoo/remove-rest-transform Remove rest transform --- .../babel-eslint-parser/acorn-to-esprima.js | 4 --- .../babel-eslint-parser/test/babel-eslint.js | 28 ++++++++++--------- .../test/non-regression.js | 7 +++++ 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index 4c1210857461..c0d02a539244 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -190,10 +190,6 @@ var astTransformVisitor = { delete node.argument; } - if (this.isRestElement()) { - return node.argument; - } - // flow: prevent "no-undef" // for "Component" in: "let x: React.Component" if (this.isQualifiedTypeIdentifier()) { diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 9f0b2850684c..05983d998236 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -35,27 +35,29 @@ function parseAndAssertSame(code) { var esAST = espree.parse(code, { ecmaFeatures: { arrowFunctions: true, - blockBindings: true, - destructuring: true, - regexYFlag: true, - regexUFlag: true, - templateStrings: true, binaryLiterals: true, - octalLiterals: true, - unicodeCodePointEscapes: true, + blockBindings: true, + classes: true, defaultParams: true, - restParams: true, + destructuring: true, forOf: true, + generators: true, + modules: true, objectLiteralComputedProperties: true, + objectLiteralDuplicateProperties: true, objectLiteralShorthandMethods: true, objectLiteralShorthandProperties: true, - objectLiteralDuplicateProperties: true, - generators: true, + octalLiterals: true, + regexUFlag: true, + regexYFlag: true, + restParams: true, spread: true, - classes: true, - modules: true, + superInFunctions: true, + templateStrings: true, + unicodeCodePointEscapes: true, + globalReturn: true, jsx: true, - globalReturn: true + experimentalObjectRestSpread: true, }, tokens: true, loc: true, diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 4683dc6f3637..1dc559b8b131 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1273,4 +1273,11 @@ describe("verify", function () { [ ] ) }); + + it("no no-undef error with rest #11", function () { + verifyAndAssertMessages("const [a, ...rest] = ['1', '2', '3']; a; rest;", + { "no-undef": 1, "no-unused-vars": 1 }, + [ ] + ) + }); }); From cd0f5ccc93b02970f10f84c73ee7bf48f895cdb2 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 15 Aug 2015 09:24:14 -0400 Subject: [PATCH 187/569] add older tests --- .../test/non-regression.js | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 1dc559b8b131..688b08e87b16 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -54,7 +54,9 @@ describe("verify", function () { it("Modules support (issue #5)", function () { verifyAndAssertMessages( "import Foo from 'foo';\n" + - "export default Foo;", + "export default Foo;\n" + + "export const c = 'c';\n" + + "export class Store {}", {}, [] ); @@ -125,6 +127,26 @@ describe("verify", function () { ); }); + it("arrow functions (issue #27)", function () { + verifyAndAssertMessages( + "[1, 2, 3].map(i => i * 2);", + { "func-names": 1, "space-before-blocks": 1 }, + [] + ); + }); + + it("comment with padded-blocks (issue #33)", function () { + verifyAndAssertMessages([ + "if (a){", + "// i'm a comment!", + "let b = c", + "}" + ].join("\n"), + { "padded-blocks": [1, "never"] }, + [] + ); + }); + describe("flow", function () { it("check regular function", function () { verifyAndAssertMessages([ @@ -967,7 +989,7 @@ describe("verify", function () { ); }); - it("class properties", function () { + it("class properties #71", function () { verifyAndAssertMessages( "class Lol { foo = 'bar'; }", { "no-undef": 1 }, From 7d8de4e2ae5a618a18ecd4875e146d5154e7d422 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 15 Aug 2015 09:25:14 -0400 Subject: [PATCH 188/569] 4.0.6 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index c1ec430846da..8945271bbb8f 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "4.0.5", + "version": "4.0.6", "description": "", "main": "index.js", "repository": { From 69c303ea00d44d23a7bd3c55495ead8dd21d74d7 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 15 Aug 2015 19:49:21 -0400 Subject: [PATCH 189/569] Merge pull request babel/babel-eslint#166 from hzoo/remove-async-transform remove async func transform --- eslint/babel-eslint-parser/acorn-to-esprima.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index c0d02a539244..3dab2d6e104b 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -235,11 +235,6 @@ var astTransformVisitor = { // functions - if (this.isFunction()) { - if (node.async) node.generator = true; - delete node.async; - } - if (this.isAwaitExpression()) { node.type = "YieldExpression"; node.delegate = node.all; From 5b577637882c1a639ec4cd08e78774bc9220c235 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 15 Aug 2015 19:49:44 -0400 Subject: [PATCH 190/569] 4.0.7 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 8945271bbb8f..90a7ac27b9b3 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "4.0.6", + "version": "4.0.7", "description": "", "main": "index.js", "repository": { From 9740af8be40823fcd62af6cbb793bb58e1aebe3a Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sun, 16 Aug 2015 16:11:57 -0400 Subject: [PATCH 191/569] Merge pull request babel/babel-eslint#169 from hzoo/i-168 async func and space-before-function-paren --- eslint/babel-eslint-parser/acorn-to-esprima.js | 4 ++++ eslint/babel-eslint-parser/test/non-regression.js | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index 3dab2d6e104b..121d26c5882d 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -235,6 +235,10 @@ var astTransformVisitor = { // functions + if (this.isFunction()) { + if (node.async) node.generator = true; + } + if (this.isAwaitExpression()) { node.type = "YieldExpression"; node.delegate = node.all; diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 688b08e87b16..3bdd61553714 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1302,4 +1302,11 @@ describe("verify", function () { [ ] ) }); + + it("async function with space-before-function-paren #168", function () { + verifyAndAssertMessages("it('handles updates', async function() {});", + { "space-before-function-paren": [1, "never"] }, + [ ] + ) + }); }); From d06c0033440a78ae1ece868531a684935c3d0a7d Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sun, 16 Aug 2015 16:12:18 -0400 Subject: [PATCH 192/569] 4.0.8 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 90a7ac27b9b3..cdf495cf6350 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "4.0.7", + "version": "4.0.8", "description": "", "main": "index.js", "repository": { From 2140a08e3e0c2575915e7e843a4a4d5d22280e78 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sun, 16 Aug 2015 21:54:01 -0400 Subject: [PATCH 193/569] Merge pull request babel/babel-eslint#170 from hzoo/remove-super-transform remove super transform since it should be in espree --- eslint/babel-eslint-parser/acorn-to-esprima.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index 121d26c5882d..f5ce569bb682 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -223,30 +223,24 @@ var astTransformVisitor = { } } - // classes - - if (this.isReferencedIdentifier({ name: "super" })) { - return t.inherits(t.thisExpression(), node); - } - + // remove class property keys (or patch in escope) if (this.isClassProperty()) { delete node.key; } - // functions - + // async function as generator if (this.isFunction()) { if (node.async) node.generator = true; } + // await transform to yield if (this.isAwaitExpression()) { node.type = "YieldExpression"; node.delegate = node.all; delete node.all; } - // template strings - + // template string range fixes if (this.isTemplateLiteral()) { node.quasis.forEach(function (q) { q.range[0] -= 1; From 8d46c00125293679277d0306d796503345070cee Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sun, 16 Aug 2015 22:33:38 -0400 Subject: [PATCH 194/569] 4.0.9 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index cdf495cf6350..84d04f0744cf 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "4.0.8", + "version": "4.0.9", "description": "", "main": "index.js", "repository": { From e8c6b4e98874ad499280ad6be9cf114de223c43f Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sun, 16 Aug 2015 22:48:56 -0400 Subject: [PATCH 195/569] Merge pull request babel/babel-eslint#165 from hzoo/remove-spread-transform use SpreadProperty type, revert other transforms --- eslint/babel-eslint-parser/acorn-to-esprima.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js index f5ce569bb682..729e47ed7f65 100644 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ b/eslint/babel-eslint-parser/acorn-to-esprima.js @@ -183,11 +183,8 @@ var astTransformVisitor = { }, exit: function (node) { /* parent */ if (this.isSpreadProperty()) { - node.type = "Property"; - node.kind = "init"; - node.computed = true; + node.type = "SpreadProperty"; node.key = node.value = node.argument; - delete node.argument; } // flow: prevent "no-undef" From 03492bae52f08185b6f015ff008e6db70a8dea63 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sun, 16 Aug 2015 22:49:15 -0400 Subject: [PATCH 196/569] 4.0.10 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 84d04f0744cf..60a6d3514a52 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "4.0.9", + "version": "4.0.10", "description": "", "main": "index.js", "repository": { From fea7ef937e5719902df76187d9df64c43bb5eae4 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 19 Aug 2015 09:46:50 -0400 Subject: [PATCH 197/569] remove note about babel-eslint being experimental --- eslint/babel-eslint-parser/README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index 7556b2998fc0..157169ba35b2 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -3,17 +3,16 @@ **babel-eslint** allows you to lint **ALL** valid Babel code with the fantastic [ESLint](https://github.com/eslint/eslint). -**NOTE:** Please note that this is experimental and may have numerous bugs. It is however -successfuly linting the [babel core](https://github.com/babel/babel/blob/master/.eslintrc). +`babel-eslint` is successfully linting [babel core](https://github.com/babel/babel/blob/master/.eslintrc) and many other projects. > If there is an issue, first check if it can be reproduced with the regular parser or with the latest versions of `eslint` and `babel-eslint`! For questions and support please visit the [`#linting`](https://babeljs.slack.com/messages/linting/) babel slack channel (sign up [here](https://babel-slack.herokuapp.com))! ## Known Issues -Flow: +Flow: - `no-undef` for global flow types: `ReactElement`, `ReactClass` [#130](https://github.com/babel/babel-eslint/issues/130#issuecomment-111215076) - - Workaround: define types as globals in `.eslintrc` or define types and import them `import type ReactElement from './types'` + - Workaround: define types as globals in `.eslintrc` or define types and import them `import type ReactElement from './types'` - `no-unused-vars/no-undef` with Flow declarations (`declare module A {}`) [#132](https://github.com/babel/babel-eslint/issues/132#issuecomment-112815926) Modules/strict mode @@ -22,7 +21,7 @@ Modules/strict mode Please check out [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) for React/JSX issues - `no-unused-vars` with jsx -Please check out [eslint-plugin-babel](https://github.com/babel/eslint-plugin-babel) for the issues below: +Please check out [eslint-plugin-babel](https://github.com/babel/eslint-plugin-babel) for other issues such as: - `generator-star` with async/await functions [#78](https://github.com/babel/babel-eslint/issues/78) - `object-shorthand` with spread operator [#131](https://github.com/babel/babel-eslint/issues/131) From 412aee0be0224034340cce48dd5e94ed4a091df0 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 20 Aug 2015 14:39:37 -0400 Subject: [PATCH 198/569] update eslint to 1.2.0 --- eslint/babel-eslint-parser/eslint | 2 +- eslint/babel-eslint-parser/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/eslint b/eslint/babel-eslint-parser/eslint index b89d293dcff7..8f6f543b2952 160000 --- a/eslint/babel-eslint-parser/eslint +++ b/eslint/babel-eslint-parser/eslint @@ -1 +1 @@ -Subproject commit b89d293dcff77b52eb39902e1e2453fc6678850a +Subproject commit 8f6f543b2952e439ba5e158b3f0bcfd150ab3914 diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 60a6d3514a52..dc9e5d4080e5 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -24,7 +24,7 @@ }, "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { - "eslint": "^1.1.0", + "eslint": "file:eslint", "espree": "^2.0.3", "mocha": "^2.2.5" } From ac163a64fe6bed5dc3f1aaeedd6b6aeda286d130 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 20 Aug 2015 14:41:06 -0400 Subject: [PATCH 199/569] do not use local --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index dc9e5d4080e5..26c40c935bba 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -24,7 +24,7 @@ }, "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { - "eslint": "file:eslint", + "eslint": "^1.2.1", "espree": "^2.0.3", "mocha": "^2.2.5" } From 8812bf735ec3ecb5c7754478569fb3778b076556 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 20 Aug 2015 15:04:30 -0400 Subject: [PATCH 200/569] update espree, update eslintester for eslint 1.0 --- eslint/babel-eslint-parser/eslint-tester.js | 2 +- eslint/babel-eslint-parser/index.js | 2 +- eslint/babel-eslint-parser/package.json | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eslint/babel-eslint-parser/eslint-tester.js b/eslint/babel-eslint-parser/eslint-tester.js index 52924fa93983..905a625d4689 100644 --- a/eslint/babel-eslint-parser/eslint-tester.js +++ b/eslint/babel-eslint-parser/eslint-tester.js @@ -1,4 +1,4 @@ -var ESLintTester = require("./eslint/node_modules/eslint-tester"); +var ESLintTester = require("./eslint").RuleTester; console.log("Use babel-eslint for test suite"); ESLintTester.setDefaultConfig({ diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 5a94fee62575..8d93ced41d4c 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -415,7 +415,7 @@ exports.parse = function (code) { var opts = { locations: true, - ranges: true, + ranges: true }; var comments = opts.onComment = []; diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 26c40c935bba..69ed11382a25 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -14,7 +14,7 @@ }, "scripts": { "bootstrap": "git submodule update --init && cd eslint && npm install", - "eslint": "cd eslint && mocha -c tests/lib/rules/**/*.js -r ../eslint-tester.js", + "eslint": "cd eslint && mocha -c tests/lib/rules/*.js -r ../eslint-tester.js", "test": "mocha" }, "author": "Sebastian McKenzie ", @@ -25,7 +25,7 @@ "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { "eslint": "^1.2.1", - "espree": "^2.0.3", + "espree": "^2.2.4", "mocha": "^2.2.5" } } From b2405a9924cbd99860d4a0754192ced81a50d934 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 20 Aug 2015 15:07:05 -0400 Subject: [PATCH 201/569] lint fix, lint task --- eslint/babel-eslint-parser/index.js | 2 +- eslint/babel-eslint-parser/package.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 8d93ced41d4c..fad1f83b7a48 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -327,7 +327,7 @@ function monkeypatch() { } else if (left.type === "ObjectPattern") { for (var i = 0; i < left.properties.length; i++) { var name = left.properties[i]; - if (name && name.key && name.key.type === 'Identifier') { + if (name && name.key && name.key.type === "Identifier") { scope.__define(name.key, new Definition("ComprehensionElement", name.key, name.key)); } } diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 69ed11382a25..57c13dead393 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -15,7 +15,8 @@ "scripts": { "bootstrap": "git submodule update --init && cd eslint && npm install", "eslint": "cd eslint && mocha -c tests/lib/rules/*.js -r ../eslint-tester.js", - "test": "mocha" + "test": "mocha", + "lint": "./node_modules/eslint/bin/eslint.js ./test index.js acorn-to-esprima.js" }, "author": "Sebastian McKenzie ", "license": "MIT", From 4cdf59532ddcd8e8c5d6fb45610e439e435ac767 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 25 Aug 2015 12:11:24 -0400 Subject: [PATCH 202/569] Merge pull request babel/babel-eslint#177 from hzoo/use-acorn-to-esprima use `acorn-to-esprima` package --- .../babel-eslint-parser/acorn-to-esprima.js | 258 ------------------ eslint/babel-eslint-parser/index.js | 70 +---- eslint/babel-eslint-parser/package.json | 3 +- 3 files changed, 15 insertions(+), 316 deletions(-) delete mode 100644 eslint/babel-eslint-parser/acorn-to-esprima.js diff --git a/eslint/babel-eslint-parser/acorn-to-esprima.js b/eslint/babel-eslint-parser/acorn-to-esprima.js deleted file mode 100644 index 729e47ed7f65..000000000000 --- a/eslint/babel-eslint-parser/acorn-to-esprima.js +++ /dev/null @@ -1,258 +0,0 @@ -var traverse = require("babel-core").traverse; -var tt = require("babel-core").acorn.tokTypes; -var t = require("babel-core").types; - -exports.toToken = function (token) { - var type = token.type; - token.range = [token.start, token.end]; - - if (type === tt.name) { - token.type = "Identifier"; - } else if (type === tt.semi || type === tt.comma || - type === tt.parenL || type === tt.parenR || - type === tt.braceL || type === tt.braceR || - type === tt.slash || type === tt.dot || - type === tt.bracketL || type === tt.bracketR || - type === tt.ellipsis || type === tt.arrow || - type === tt.star || type === tt.incDec || - type === tt.colon || type === tt.question || - type === tt.template || type === tt.backQuote || - type === tt.dollarBraceL || type === tt.at || - type === tt.logicalOR || type === tt.logicalAND || - type === tt.bitwiseOR || type === tt.bitwiseXOR || - type === tt.bitwiseAND || type === tt.equality || - type === tt.relational || type === tt.bitShift || - type === tt.plusMin || type === tt.modulo || - type === tt.exponent || type === tt.prefix || - type === tt.doubleColon || - type.isAssign) { - token.type = "Punctuator"; - if (!token.value) token.value = type.label; - } else if (type === tt.jsxTagStart) { - token.type = "Punctuator"; - token.value = "<"; - } else if (type === tt.jsxTagEnd) { - token.type = "Punctuator"; - token.value = ">"; - } else if (type === tt.jsxName) { - token.type = "JSXIdentifier"; - } else if (type === tt.jsxText) { - token.type = "JSXText"; - } else if (type.keyword === "null") { - token.type = "Null"; - } else if (type.keyword === "false" || type.keyword === "true") { - token.type = "Boolean"; - } else if (type.keyword) { - token.type = "Keyword"; - } else if (type === tt.num) { - token.type = "Numeric"; - token.value = String(token.value); - } else if (type === tt.string) { - token.type = "String"; - token.value = JSON.stringify(token.value); - } else if (type === tt.regexp) { - token.type = "RegularExpression"; - token.regex = { - pattern: token.value.pattern, - flags: token.value.flags - }; - token.value = String(token.value.value); - } - - return token; -}; - -exports.toAST = function (ast) { - ast.sourceType = "module"; - ast.range = [ast.start, ast.end]; - traverse(ast, astTransformVisitor); -}; - -exports.toTokens = function (tokens) { - // transform tokens to type "Template" - convertTemplateType(tokens); - - return tokens.filter(function (token) { - return token.type !== "CommentLine" && token.type !== "CommentBlock"; - }).map(exports.toToken); -}; - -function convertTemplateType(tokens) { - var startingToken = 0; - var currentToken = 0; - // track use of {} - var numBraces = 0; - // track number of nested templates - var numBackQuotes = 0; - - function isBackQuote(token) { - return tokens[token].type === tt.backQuote; - } - - function isTemplateStarter(token) { - return isBackQuote(token) || - // only can be a template starter when in a template already - tokens[token].type === tt.braceR && numBackQuotes > 0; - } - - function isTemplateEnder(token) { - return isBackQuote(token) || - tokens[token].type === tt.dollarBraceL; - } - - // append the values between start and end - function createTemplateValue(start, end) { - var value = ""; - while (start <= end) { - if (tokens[start].value) { - value += tokens[start].value; - } else if (tokens[start].type !== tt.template) { - value += tokens[start].type.label; - } - start++; - } - return value; - } - - // create Template token - function replaceWithTemplateType(start, end) { - var templateToken = { - type: "Template", - value: createTemplateValue(start, end), - start: tokens[start].start, - end: tokens[end].end, - loc: { - start: tokens[start].loc.start, - end: tokens[end].loc.end - } - }; - - // put new token in place of old tokens - tokens.splice(start, end - start + 1, templateToken); - } - - function trackNumBraces(token) { - if (tokens[token].type === tt.braceL) { - numBraces++; - } else if (tokens[token].type === tt.braceR) { - numBraces--; - } - } - - while (startingToken < tokens.length) { - // template start: check if ` or } - if (isTemplateStarter(startingToken) && numBraces === 0) { - if (isBackQuote(startingToken)) { - numBackQuotes++; - } - - currentToken = startingToken + 1; - - // check if token after template start is "template" - if (currentToken >= tokens.length - 1 || tokens[currentToken].type !== tt.template) { - break; - } - - // template end: find ` or ${ - while (!isTemplateEnder(currentToken)) { - if (currentToken >= tokens.length - 1) { - break; - } - currentToken++; - } - - if (isBackQuote(currentToken)) { - numBackQuotes--; - } - // template start and end found: create new token - replaceWithTemplateType(startingToken, currentToken); - } else if (numBackQuotes > 0) { - trackNumBraces(startingToken); - } - startingToken++; - } -} - -var astTransformVisitor = { - noScope: true, - enter: function (node) { - node.range = [node.start, node.end]; - - // private var to track original node type - node._babelType = node.type; - }, - exit: function (node) { /* parent */ - if (this.isSpreadProperty()) { - node.type = "SpreadProperty"; - node.key = node.value = node.argument; - } - - // flow: prevent "no-undef" - // for "Component" in: "let x: React.Component" - if (this.isQualifiedTypeIdentifier()) { - delete node.id; - } - // for "b" in: "var a: { b: Foo }" - if (this.isObjectTypeProperty()) { - delete node.key; - } - // for "indexer" in: "var a: {[indexer: string]: number}" - if (this.isObjectTypeIndexer()) { - delete node.id; - } - // for "param" in: "var a: { func(param: Foo): Bar };" - if (this.isFunctionTypeParam()) { - delete node.name; - } - - // modules - - if (this.isImportDeclaration()) { - delete node.isType; - } - - if (this.isExportDeclaration()) { - var declar = this.get("declaration"); - if (declar.isClassExpression()) { - node.declaration.type = "ClassDeclaration"; - } else if (declar.isFunctionExpression()) { - node.declaration.type = "FunctionDeclaration"; - } - } - - // remove class property keys (or patch in escope) - if (this.isClassProperty()) { - delete node.key; - } - - // async function as generator - if (this.isFunction()) { - if (node.async) node.generator = true; - } - - // await transform to yield - if (this.isAwaitExpression()) { - node.type = "YieldExpression"; - node.delegate = node.all; - delete node.all; - } - - // template string range fixes - if (this.isTemplateLiteral()) { - node.quasis.forEach(function (q) { - q.range[0] -= 1; - if (q.tail) { - q.range[1] += 1; - } else { - q.range[1] += 2; - } - q.loc.start.column -= 1; - if (q.tail) { - q.loc.end.column += 1; - } else { - q.loc.end.column += 2; - } - }); - } - } -}; diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index fad1f83b7a48..279fd25eb488 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -1,10 +1,12 @@ -var acornToEsprima = require("./acorn-to-esprima"); +var acornToEsprima = require("acorn-to-esprima"); var assign = require("lodash.assign"); var pick = require("lodash.pick"); var Module = require("module"); -var parse = require("babel-core").parse; var path = require("path"); +var parse = require("babel-core").parse; var t = require("babel-core").types; +var tt = require("babel-core").acorn.tokTypes; +var traverse = require("babel-core").traverse; var estraverse; var hasPatched = false; @@ -362,49 +364,6 @@ function monkeypatch() { }; } -exports.attachComments = function (ast, comments, tokens) { - if (comments.length) { - var firstComment = comments[0]; - var lastComment = comments[comments.length - 1]; - // fixup program start - if (!tokens.length) { - // if no tokens, the program starts at the end of the last comment - ast.start = lastComment.end; - ast.loc.start.line = lastComment.loc.end.line; - ast.loc.start.column = lastComment.loc.end.column; - } else if (firstComment.start < tokens[0].start) { - // if there are comments before the first token, the program starts at the first token - var token = tokens[0]; - ast.start = token.start; - ast.loc.start.line = token.loc.start.line; - ast.loc.start.column = token.loc.start.column; - - // estraverse do not put leading comments on first node when the comment - // appear before the first token - if (ast.body.length) { - var node = ast.body[0]; - node.leadingComments = []; - var firstTokenStart = token.start; - var len = comments.length; - for (var i = 0; i < len && comments[i].start < firstTokenStart; i++) { - node.leadingComments.push(comments[i]); - } - } - } - // fixup program end - if (tokens.length) { - var lastToken = tokens[tokens.length - 1]; - if (lastComment.end > lastToken.end) { - // If there is a comment after the last token, the program ends at the - // last token and not the comment - ast.end = lastToken.end; - ast.loc.end.line = lastToken.loc.end.line; - ast.loc.end.column = lastToken.loc.end.column; - } - } - } -}; - exports.parse = function (code) { try { monkeypatch(); @@ -413,6 +372,10 @@ exports.parse = function (code) { process.exit(1); } + return exports.parseNoPatch(code); +} + +exports.parseNoPatch = function (code) { var opts = { locations: true, ranges: true @@ -442,22 +405,15 @@ exports.parse = function (code) { tokens.pop(); // convert tokens - ast.tokens = acornToEsprima.toTokens(tokens); + ast.tokens = acornToEsprima.toTokens(tokens, tt); // add comments - for (var i = 0; i < comments.length; i++) { - var comment = comments[i]; - if (comment.type === "CommentBlock") { - comment.type = "Block"; - } else if (comment.type === "CommentLine") { - comment.type = "Line"; - } - } + acornToEsprima.convertComments(comments); ast.comments = comments; - exports.attachComments(ast, comments, ast.tokens); + acornToEsprima.attachComments(ast, comments, ast.tokens); // transform esprima and acorn divergent nodes - acornToEsprima.toAST(ast); + acornToEsprima.toAST(ast, traverse); return ast; -}; +} \ No newline at end of file diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 57c13dead393..d477eb2529f6 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -10,7 +10,8 @@ "dependencies": { "babel-core": "^5.6.9", "lodash.assign": "^3.0.0", - "lodash.pick": "^3.1.0" + "lodash.pick": "^3.1.0", + "acorn-to-esprima": "^1.0.1" }, "scripts": { "bootstrap": "git submodule update --init && cd eslint && npm install", From 61243967ac2dd56088c27200b58acbaef4de3fcd Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 25 Aug 2015 12:14:17 -0400 Subject: [PATCH 203/569] 4.1.0 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index d477eb2529f6..fad52967c0c4 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "4.0.10", + "version": "4.1.0", "description": "", "main": "index.js", "repository": { From 2b17528c5d8aaf9a74acbf1af846ab32ed2c63ad Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 31 Aug 2015 10:22:52 -0400 Subject: [PATCH 204/569] Merge pull request babel/babel-eslint#180 from hzoo/master update eslint, acorn-to-esprima - ref eslint/eslint#3596 --- eslint/babel-eslint-parser/package.json | 6 +++--- eslint/babel-eslint-parser/test/babel-eslint.js | 8 ++++++++ eslint/babel-eslint-parser/test/non-regression.js | 6 +++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index fad52967c0c4..03d1045cab53 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -8,10 +8,10 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "babel-core": "^5.6.9", + "babel-core": "^5.8.23", "lodash.assign": "^3.0.0", "lodash.pick": "^3.1.0", - "acorn-to-esprima": "^1.0.1" + "acorn-to-esprima": "^1.0.2" }, "scripts": { "bootstrap": "git submodule update --init && cd eslint && npm install", @@ -26,7 +26,7 @@ }, "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { - "eslint": "^1.2.1", + "eslint": "^1.3.1", "espree": "^2.2.4", "mocha": "^2.2.5" } diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 05983d998236..3ef824046cc6 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -294,4 +294,12 @@ describe("acorn-to-esprima", function () { it("regexp in a template string", function () { parseAndAssertSame("`${/\\d/.exec(\"1\")[0]}`"); }); + + it("first line is empty", function () { + parseAndAssertSame("\nimport Immutable from \"immutable\";"); + }); + + it("empty", function () { + parseAndAssertSame(""); + }); }); diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 3bdd61553714..c268199fadb6 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -378,7 +378,7 @@ describe("verify", function () { "var b: T = 1; b;" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, - [ "1:21 T is defined but never used no-unused-vars", + [ "1:21 \"T\" is defined but never used no-unused-vars", '2:8 "T" is not defined. no-undef' ] ); }); @@ -1194,7 +1194,7 @@ describe("verify", function () { verifyAndAssertMessages( "var unused;", { "no-unused-vars": 1 }, - [ "1:5 unused is defined but never used no-unused-vars" ] + [ "1:5 \"unused\" is defined but never used no-unused-vars" ] ); }); @@ -1210,7 +1210,7 @@ describe("verify", function () { verifyAndAssertMessages( "const {Bacona} = require('baconjs')", { "no-undef": 1, "no-unused-vars": 1 }, - [ "1:8 Bacona is defined but never used no-unused-vars" ] + [ "1:8 \"Bacona\" is defined but never used no-unused-vars" ] ); }); From 229a1922d85e1cc5ad4236a54249fcb2fdb60303 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 31 Aug 2015 10:23:10 -0400 Subject: [PATCH 205/569] 4.1.1 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 03d1045cab53..e15825c747c3 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "4.1.0", + "version": "4.1.1", "description": "", "main": "index.js", "repository": { From 742b1cb65dccc3582bba53a5245f3188d958d3d1 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 11 Sep 2015 18:38:53 -0400 Subject: [PATCH 206/569] Merge pull request babel/babel-eslint#182 from bryanrsmith/patch-1 fix typo in comment --- eslint/babel-eslint-parser/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 279fd25eb488..f89554f13097 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -84,7 +84,7 @@ function monkeypatch() { } var Definition = require(definitionLoc).Definition; - // if there are decotators, then visit each + // if there are decorators, then visit each function visitDecorators(node) { if (!node.decorators) { return; @@ -416,4 +416,4 @@ exports.parseNoPatch = function (code) { acornToEsprima.toAST(ast, traverse); return ast; -} \ No newline at end of file +} From c0a7ebf51b56130668c0f3dce815a10d0f37eeb0 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 14 Sep 2015 14:26:21 -0400 Subject: [PATCH 207/569] fix attachComment typo, add comment tests --- .../babel-eslint-parser/test/babel-eslint.js | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 3ef824046cc6..216717312cb8 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -63,7 +63,7 @@ function parseAndAssertSame(code) { loc: true, range: true, comment: true, - attachComments: true + attachComment: true }); var acornAST = babelEslint.parse(code); try { @@ -302,4 +302,29 @@ describe("acorn-to-esprima", function () { it("empty", function () { parseAndAssertSame(""); }); + + it("jsdoc", function () { + parseAndAssertSame([ + "/**", + "* @param {object} options", + "* @return {number}", + "*/", + "const test = function({ a, b, c }) {", + "return a + b + c;", + "};", + "module.exports = test;" + ].join("\n")); + }) + + it("empty block with comment", function () { + parseAndAssertSame([ + "function a () {", + "try {", + "b();", + "} catch (e) {", + "// asdf", + "}", + "}" + ].join("\n")); + }) }); From 95c4c77df19ec5f2e4791230a43e16d91ce0c47b Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 14 Sep 2015 14:45:10 -0400 Subject: [PATCH 208/569] 4.1.2 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index e15825c747c3..959b269743e6 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "4.1.1", + "version": "4.1.2", "description": "", "main": "index.js", "repository": { From cc4ce5bbeda49531e9a383b2d49fe5aa323de21f Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 14 Sep 2015 14:48:14 -0400 Subject: [PATCH 209/569] add node 4 to travis --- eslint/babel-eslint-parser/.travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint/babel-eslint-parser/.travis.yml b/eslint/babel-eslint-parser/.travis.yml index 8ac23aee56e0..551529748b9a 100644 --- a/eslint/babel-eslint-parser/.travis.yml +++ b/eslint/babel-eslint-parser/.travis.yml @@ -5,3 +5,4 @@ language: node_js node_js: - '0.12' - 'io.js' + - '4' \ No newline at end of file From 6dc026c203db869f3da77101ed29cc1dbcd0fc0e Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 15 Sep 2015 09:20:14 -0400 Subject: [PATCH 210/569] un-comment babel/babel-eslint#124 test --- .../test/non-regression.js | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index c268199fadb6..0dbea848c2fc 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1262,21 +1262,21 @@ describe("verify", function () { ); }); - // it("line comment space-in-parens #124", function () { - // verifyAndAssertMessages( - // [ - // "React.createClass({", - // "render() {", - // "// return (", - // "//
", - // "// ); // <-- this is the line that is reported", - // "}", - // "});" - // ].join("\n"), - // { "space-in-parens": 1 }, - // [ ] - // ) - // }); + it("line comment space-in-parens #124", function () { + verifyAndAssertMessages( + [ + "React.createClass({", + "render() {", + "// return (", + "//
", + "// ); // <-- this is the line that is reported", + "}", + "});" + ].join("\n"), + { "space-in-parens": 1 }, + [ ] + ) + }); it("block comment space-in-parens #124", function () { verifyAndAssertMessages( From b5e0dbe8e876f14b584241a89aa7800342082849 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 17 Sep 2015 09:42:18 -0400 Subject: [PATCH 211/569] check AssignmentPattern types - fixes babel/babel-eslint#184 --- eslint/babel-eslint-parser/index.js | 9 +++++++-- .../test/non-regression.js | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index f89554f13097..3cf0b6537ed9 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -244,8 +244,13 @@ function monkeypatch() { // only visit if function parameters have types if (node.params) { for (var i = 0; i < node.params.length; i++) { - if (node.params[i].typeAnnotation) { - checkIdentifierOrVisit.call(this, node.params[i]); + var param = node.params[i]; + if (param.typeAnnotation) { + checkIdentifierOrVisit.call(this, param); + } else if (t.isAssignmentPattern(param)) { + if (param.left.typeAnnotation) { + checkIdentifierOrVisit.call(this, param.left); + } } } } diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 0dbea848c2fc..f24bad04e559 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1309,4 +1309,23 @@ describe("verify", function () { [ ] ) }); + + it("default param flow type no-unused-vars #184", function () { + verifyAndAssertMessages( + [ + "type ResolveOptionType = {", + "depth?: number,", + "identifier?: string", + "};", + "", + "export default function resolve(", + "options: ResolveOptionType = {}", + "): Object {", + "options;", + "}", + ].join("\n"), + { "no-unused-vars": 1, "no-undef": 1 }, + [ ] + ) + }); }); From 463cda9a1097260bcf0089082cd5a50fee498aec Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 17 Sep 2015 09:42:26 -0400 Subject: [PATCH 212/569] 4.1.3 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 959b269743e6..d3a0ddd00c25 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "4.1.2", + "version": "4.1.3", "description": "", "main": "index.js", "repository": { From afd72ba541f2086f82fcb637c79640cb7912a6a1 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 7 Oct 2015 20:05:11 -0400 Subject: [PATCH 213/569] update packages --- eslint/babel-eslint-parser/package.json | 12 ++++++------ eslint/babel-eslint-parser/test/non-regression.js | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index d3a0ddd00c25..3eb79410c310 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -8,10 +8,10 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "babel-core": "^5.8.23", - "lodash.assign": "^3.0.0", + "babel-core": "^5.8.25", + "lodash.assign": "^3.2.0", "lodash.pick": "^3.1.0", - "acorn-to-esprima": "^1.0.2" + "acorn-to-esprima": "^1.0.4" }, "scripts": { "bootstrap": "git submodule update --init && cd eslint && npm install", @@ -26,8 +26,8 @@ }, "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { - "eslint": "^1.3.1", - "espree": "^2.2.4", - "mocha": "^2.2.5" + "eslint": "^1.6.0", + "espree": "^2.2.5", + "mocha": "^2.3.3" } } diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index f24bad04e559..888ed6eda874 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -47,7 +47,7 @@ describe("verify", function () { verifyAndAssertMessages( "{ , res }", {}, - [ "1:3 Unexpected token" ] + [ "1:3 Parsing error: Unexpected token" ] ); }); From dd8ba490ee7cbd651e8dfe5846d000ac8a3f3b7d Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 7 Oct 2015 20:11:00 -0400 Subject: [PATCH 214/569] update readme, add contributing --- eslint/babel-eslint-parser/CONTRIBUTING.md | 11 +++++++++++ eslint/babel-eslint-parser/README.md | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 eslint/babel-eslint-parser/CONTRIBUTING.md diff --git a/eslint/babel-eslint-parser/CONTRIBUTING.md b/eslint/babel-eslint-parser/CONTRIBUTING.md new file mode 100644 index 000000000000..c03d5e74e105 --- /dev/null +++ b/eslint/babel-eslint-parser/CONTRIBUTING.md @@ -0,0 +1,11 @@ +# Contributing + +Thanks for contributing! + +If you're about to report an issue - please first check if it's already been reported in the [issues page](https://github.com/babel/babel-eslint/issues). + +Also check to see if the latest versions of eslint/babel-eslint still produce the issue. + +Also check out the [Known Issues](https://github.com/babel/babel-eslint#known-issues) section of the README. + +If you are having issues with JSX you might want to check out eslint-plugin-react. If there's an issue with new experimental syntax you might need to report that in eslint-plugin-babel instead. diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index 157169ba35b2..df81ef8a3ef0 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -9,6 +9,8 @@ For questions and support please visit the [`#linting`](https://babeljs.slack.com/messages/linting/) babel slack channel (sign up [here](https://babel-slack.herokuapp.com))! +> Note that the `ecmaFeatures` config property may still be required for ESLint to work properly with features not in ECMAScript 5 by default. Examples are `globalReturn` and `modules`) + ## Known Issues Flow: - `no-undef` for global flow types: `ReactElement`, `ReactClass` [#130](https://github.com/babel/babel-eslint/issues/130#issuecomment-111215076) @@ -21,7 +23,7 @@ Modules/strict mode Please check out [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) for React/JSX issues - `no-unused-vars` with jsx -Please check out [eslint-plugin-babel](https://github.com/babel/eslint-plugin-babel) for other issues such as: +Please check out [eslint-plugin-babel](https://github.com/babel/eslint-plugin-babel) for other issues such as (and more): - `generator-star` with async/await functions [#78](https://github.com/babel/babel-eslint/issues/78) - `object-shorthand` with spread operator [#131](https://github.com/babel/babel-eslint/issues/131) From b4fb1d3acae76e8fa5b684ce2218cea408acf916 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 7 Oct 2015 20:23:41 -0400 Subject: [PATCH 215/569] test with ecmaFeatures on by default, add test for babel/babel-eslint#192 Ref babel/babel-eslint#192 --- .../test/non-regression.js | 48 +++++++++++++++++-- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 888ed6eda874..3e749b6ffeda 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -2,7 +2,34 @@ "use strict"; var eslint = require("eslint"); -function verifyAndAssertMessages(code, rules, expectedMessages) { +function verifyAndAssertMessages(code, rules, expectedMessages, features) { + var defaultEcmaFeatures = { + arrowFunctions: true, + binaryLiterals: true, + blockBindings: true, + classes: true, + defaultParams: true, + destructuring: true, + forOf: true, + generators: true, + modules: true, + objectLiteralComputedProperties: true, + objectLiteralDuplicateProperties: true, + objectLiteralShorthandMethods: true, + objectLiteralShorthandProperties: true, + octalLiterals: true, + regexUFlag: true, + regexYFlag: true, + restParams: true, + spread: true, + superInFunctions: true, + templateStrings: true, + unicodeCodePointEscapes: true, + globalReturn: true, + jsx: true, + experimentalObjectRestSpread: true + }; + var messages = eslint.linter.verify( code, { @@ -10,7 +37,8 @@ function verifyAndAssertMessages(code, rules, expectedMessages) { rules: rules, env: { node: true - } + }, + ecmaFeatures: features || defaultEcmaFeatures } ); @@ -111,11 +139,12 @@ describe("verify", function () { }); // fix after updating to ESLint 1.0.0 - it("Arrow function with non-block bodies (issue #20)", function () { + it.skip("Arrow function with non-block bodies (issue #20)", function () { verifyAndAssertMessages( "\"use strict\"; () => 1", { "strict": [1, "global"] }, - [] + [], + { modules: false } ); }); @@ -1328,4 +1357,15 @@ describe("verify", function () { [ ] ) }); + + it("no-use-before-define #192", function () { + verifyAndAssertMessages( + [ + "console.log(x);", + "var x = 1;" + ].join("\n"), + { "no-use-before-define": 1 }, + [ "1:13 x was used before it was defined no-use-before-define" ] + ) + }); }); From 677d42f7ad5b914ada7af7f68044ead4d28904c1 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sun, 1 Nov 2015 10:10:08 -0500 Subject: [PATCH 216/569] update eslint, acorn-to-esprima --- eslint/babel-eslint-parser/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 3eb79410c310..7eea170d803f 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -8,10 +8,10 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "babel-core": "^5.8.25", + "babel-core": "^5.8.33", "lodash.assign": "^3.2.0", "lodash.pick": "^3.1.0", - "acorn-to-esprima": "^1.0.4" + "acorn-to-esprima": "^1.0.5" }, "scripts": { "bootstrap": "git submodule update --init && cd eslint && npm install", @@ -26,7 +26,7 @@ }, "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { - "eslint": "^1.6.0", + "eslint": "^1.8.0", "espree": "^2.2.5", "mocha": "^2.3.3" } From d08053d483ef645ba51369b8f76c93b462dc84d0 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 4 Nov 2015 09:51:00 -0500 Subject: [PATCH 217/569] 4.1.4 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 7eea170d803f..cd3c43dbbbf3 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "4.1.3", + "version": "4.1.4", "description": "", "main": "index.js", "repository": { From a294ab4545e60be6153e856bf8babf5c3c2c2cc4 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 9 Nov 2015 21:04:45 -0500 Subject: [PATCH 218/569] Merge pull request babel/babel-eslint#206 from mysticatea/fix-for-eslint-1.9 Fix for ESLint@1.9 and npm@3 --- eslint/babel-eslint-parser/index.js | 6 ++++++ eslint/babel-eslint-parser/package.json | 2 +- eslint/babel-eslint-parser/test/non-regression.js | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 3cf0b6537ed9..4f72a11558b1 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -55,6 +55,12 @@ function monkeypatch() { var estraverseFb = eslintMod.require("estraverse-fb"); assign(estraverseFb.VisitorKeys, t.VISITOR_KEYS); + // ESLint v1.9.0 uses estraverse directly to work around https://github.com/npm/npm/issues/9663 + var estraverseOfEslint = eslintMod.require("estraverse"); + if (estraverseOfEslint !== estraverseFb) { + assign(estraverseOfEslint.VisitorKeys, t.VISITOR_KEYS); + } + // monkeypatch escope var escope = require(escopeLoc); var analyze = escope.analyze; diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index cd3c43dbbbf3..dc3319204f7f 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -26,7 +26,7 @@ }, "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { - "eslint": "^1.8.0", + "eslint": "^1.9.0", "espree": "^2.2.5", "mocha": "^2.3.3" } diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 3e749b6ffeda..3022560e01b7 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1365,7 +1365,7 @@ describe("verify", function () { "var x = 1;" ].join("\n"), { "no-use-before-define": 1 }, - [ "1:13 x was used before it was defined no-use-before-define" ] + [ "1:13 \"x\" was used before it was defined no-use-before-define" ] ) }); }); From 8f9cc6b8275765149d9dd82f2770568edd9c6381 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 9 Nov 2015 21:11:56 -0500 Subject: [PATCH 219/569] 4.1.5 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index dc3319204f7f..a7a1c275b785 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "4.1.4", + "version": "4.1.5", "description": "", "main": "index.js", "repository": { From 5352ad41c563cd0a73f6ef327f097727c4661664 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sun, 15 Nov 2015 20:59:48 -0500 Subject: [PATCH 220/569] mention eslint-plugin-flow-vars for flow issues --- eslint/babel-eslint-parser/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index df81ef8a3ef0..006007f61949 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -13,6 +13,7 @@ For questions and support please visit the [`#linting`](https://babeljs.slack.co ## Known Issues Flow: +> Check out [eslint-plugin-flow-vars](https://github.com/zertosh/eslint-plugin-flow-vars): An `eslint` plugin that makes flow type annotations global variables and marks declarations as used. Solves the problem of false positives with `no-undef` and `no-unused-vars`. - `no-undef` for global flow types: `ReactElement`, `ReactClass` [#130](https://github.com/babel/babel-eslint/issues/130#issuecomment-111215076) - Workaround: define types as globals in `.eslintrc` or define types and import them `import type ReactElement from './types'` - `no-unused-vars/no-undef` with Flow declarations (`declare module A {}`) [#132](https://github.com/babel/babel-eslint/issues/132#issuecomment-112815926) From 0859607b4e6c7d5a72ce300e8ef962542a1e2ffb Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 23 Nov 2015 13:34:48 -0500 Subject: [PATCH 221/569] Merge pull request babel/babel-eslint#209 from Constellation/pattern-visitor Patch SpreadProperty to escope's PatternVisitor --- eslint/babel-eslint-parser/index.js | 40 ++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 4f72a11558b1..f87d13240ab5 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -81,6 +81,19 @@ function monkeypatch() { var referencerMod = createModule(referencerLoc); var referencer = require(referencerLoc); + // monkeypatch escope/pattern-visitor + var patternVisitorLoc; + var patternVisitorMod; + var patternVisitor; + try { + patternVisitorLoc = Module._resolveFilename("./pattern-visitor", escopeMod); + patternVisitorMod = createModule(patternVisitorLoc); + patternVisitor = require(patternVisitorLoc); + } catch (err) { + // When eslint uses old escope, we cannot find pattern visitor. + // Fallback to the old way. + } + // reference Definition var definitionLoc; try { @@ -266,6 +279,12 @@ function monkeypatch() { } }; + if (patternVisitor) { + patternVisitor.prototype.SpreadProperty = function (node) { + this.visit(node.argument); + }; + } + // visit flow type in VariableDeclaration var variableDeclaration = referencer.prototype.VariableDeclaration; referencer.prototype.VariableDeclaration = function(node) { @@ -276,15 +295,18 @@ function monkeypatch() { if (typeAnnotation) { checkIdentifierOrVisit.call(this, typeAnnotation); } - if (id.type === "ObjectPattern") { - // check if object destructuring has a spread - var hasSpread = id.properties.filter(function(p) { - return p._babelType === "SpreadProperty"; - }); - // visit properties if so - if (hasSpread.length > 0) { - for (var j = 0; j < id.properties.length; j++) { - this.visit(id.properties[j]); + if (!patternVisitor) { + // Old method. Once escope in eslint is updated, this code is not necessary. + if (id.type === "ObjectPattern") { + // check if object destructuring has a spread + var hasSpread = id.properties.filter(function(p) { + return p._babelType === "SpreadProperty"; + }); + // visit properties if so + if (hasSpread.length > 0) { + for (var j = 0; j < id.properties.length; j++) { + this.visit(id.properties[j]); + } } } } From 3d901f59608c1175325362dffd9231021cdb6e47 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 23 Nov 2015 20:33:39 -0500 Subject: [PATCH 222/569] Merge pull request babel/babel-eslint#212 from evocateur/fix-with-latest-eslint Avoid errors with eslint 1.10.x when excluding destructured properties --- eslint/babel-eslint-parser/index.js | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index f87d13240ab5..5a4958fc774a 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -295,18 +295,15 @@ function monkeypatch() { if (typeAnnotation) { checkIdentifierOrVisit.call(this, typeAnnotation); } - if (!patternVisitor) { - // Old method. Once escope in eslint is updated, this code is not necessary. - if (id.type === "ObjectPattern") { - // check if object destructuring has a spread - var hasSpread = id.properties.filter(function(p) { - return p._babelType === "SpreadProperty"; - }); - // visit properties if so - if (hasSpread.length > 0) { - for (var j = 0; j < id.properties.length; j++) { - this.visit(id.properties[j]); - } + if (id.type === "ObjectPattern") { + // check if object destructuring has a spread + var hasSpread = id.properties.filter(function(p) { + return p._babelType === "SpreadProperty"; + }); + // visit properties if so + if (hasSpread.length > 0) { + for (var j = 0; j < id.properties.length; j++) { + this.visit(id.properties[j]); } } } From 2ddb2d4c89b0c698121fb0f64190d36c3edc5046 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 23 Nov 2015 20:37:44 -0500 Subject: [PATCH 223/569] test for no-redeclare --- eslint/babel-eslint-parser/test/non-regression.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 3022560e01b7..1b7e06d8bec1 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1230,7 +1230,15 @@ describe("verify", function () { it("visits excluded properties left of spread #95", function () { verifyAndAssertMessages( "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", - { "no-undef": 1, "no-unused-vars": 1 }, + { "no-undef": 1, "no-unused-vars": 1, "no-redeclare": 1 }, + [] + ); + }); + + it("visits excluded properties left of spread #210", function () { + verifyAndAssertMessages( + "const props = { yo: 'yo' }; const { ...otherProps } = props;", + { "no-undef": 1, "no-unused-vars": 1, "no-redeclare": 1 }, [] ); }); From 12dd87f96ba1371d7e18960727b8d7a33e55ec1d Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 23 Nov 2015 20:38:48 -0500 Subject: [PATCH 224/569] add node 5 --- eslint/babel-eslint-parser/.travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/.travis.yml b/eslint/babel-eslint-parser/.travis.yml index 551529748b9a..d217b09b0469 100644 --- a/eslint/babel-eslint-parser/.travis.yml +++ b/eslint/babel-eslint-parser/.travis.yml @@ -5,4 +5,5 @@ language: node_js node_js: - '0.12' - 'io.js' - - '4' \ No newline at end of file + - '4' + - '5' From 78361c15182ac3bb1b767421e716d04f5e7677b7 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 23 Nov 2015 21:19:08 -0500 Subject: [PATCH 225/569] skip for now --- eslint/babel-eslint-parser/test/non-regression.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 1b7e06d8bec1..6a285b85c31e 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -791,7 +791,7 @@ describe("verify", function () { ); }); - it("32", function () { + it.skip("32", function () { verifyAndAssertMessages( [ "import type Foo from 'foo';", From 27c9abfae528b46f7f72b4d82581987af3a3932b Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 23 Nov 2015 21:19:53 -0500 Subject: [PATCH 226/569] 4.1.6 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index a7a1c275b785..3aeac5769e32 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "4.1.5", + "version": "4.1.6", "description": "", "main": "index.js", "repository": { From 72e8f9d96975434556abe5e49bc4e46eee09a358 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 26 Nov 2015 14:44:37 -0500 Subject: [PATCH 227/569] Merge pull request babel/babel-eslint#202 from hzoo/babel6 Update to babel 6 --- eslint/babel-eslint-parser/index.js | 97 +++++++++---------- eslint/babel-eslint-parser/package.json | 11 ++- .../babel-eslint-parser/test/babel-eslint.js | 75 ++++++++++++-- .../test/non-regression.js | 80 --------------- 4 files changed, 119 insertions(+), 144 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 5a4958fc774a..ba3b784ea7fc 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -3,10 +3,10 @@ var assign = require("lodash.assign"); var pick = require("lodash.pick"); var Module = require("module"); var path = require("path"); -var parse = require("babel-core").parse; -var t = require("babel-core").types; -var tt = require("babel-core").acorn.tokTypes; -var traverse = require("babel-core").traverse; +var parse = require("babylon").parse; +var t = require("babel-types"); +var tt = require("babylon").tokTypes; +var traverse = require("babel-traverse").default; var estraverse; var hasPatched = false; @@ -243,7 +243,7 @@ function monkeypatch() { // visit decorators that are in: Property / MethodDefinition var visitProperty = referencer.prototype.visitProperty; referencer.prototype.visitProperty = function(node) { - if (node.value.type === "TypeCastExpression") { + if (node.value && node.value.type === "TypeCastExpression") { visitTypeAnnotation.call(this, node.value); } visitDecorators.call(this, node); @@ -298,7 +298,7 @@ function monkeypatch() { if (id.type === "ObjectPattern") { // check if object destructuring has a spread var hasSpread = id.properties.filter(function(p) { - return p._babelType === "SpreadProperty"; + return p._babelType === "SpreadProperty" || p._babelType === "RestProperty"; }); // visit properties if so if (hasSpread.length > 0) { @@ -339,43 +339,6 @@ function monkeypatch() { } }; - referencer.prototype.ComprehensionExpression = function(node) { - for (var i = 0; i < node.blocks.length; i++) { - var block = node.blocks[i]; - if (block.left) { - var scope = new escope.Scope(this.scopeManager, "comprehensions", this.currentScope(), node, false); - this.scopeManager.__nestScope(scope); - - var left = block.left; - if (left.type === "Identifier") { - scope.__define(left, new Definition("ComprehensionElement", left, left)); - } else if (left.type === "ArrayPattern") { - for (var i = 0; i < left.elements.length; i++) { - var name = left.elements[i]; - if (name) { - scope.__define(name, new Definition("ComprehensionElement", name, name)); - } - } - } else if (left.type === "ObjectPattern") { - for (var i = 0; i < left.properties.length; i++) { - var name = left.properties[i]; - if (name && name.key && name.key.type === "Identifier") { - scope.__define(name.key, new Definition("ComprehensionElement", name.key, name.key)); - } - } - } - } - if (block.right) { - this.visit(block.right); - } - } - if (node.filter) { - this.visit(node.filter); - } - this.visit(node.body); - this.close(node); - }; - referencer.prototype.DeclareModule = referencer.prototype.DeclareFunction = referencer.prototype.DeclareVariable = @@ -408,11 +371,27 @@ exports.parse = function (code) { exports.parseNoPatch = function (code) { var opts = { locations: true, - ranges: true - }; - - var comments = opts.onComment = []; - var tokens = opts.onToken = []; + ranges: true, + sourceType: "module", + strictMode: true, + allowHashBang: true, + ecmaVersion: Infinity, + plugins: [ + "flow", + "jsx", + "asyncFunctions", + "asyncGenerators", + "classConstructorCall", + "classProperties", + "decorators", + "doExpressions", + "exponentiationOperator", + "exportExtensions", + "functionBind", + "objectRestSpread", + "trailingFunctionCommas" + ] +}; var ast; try { @@ -432,18 +411,30 @@ exports.parseNoPatch = function (code) { // remove EOF token, eslint doesn't use this for anything and it interferes with some rules // see https://github.com/babel/babel-eslint/issues/2 for more info // todo: find a more elegant way to do this - tokens.pop(); + ast.tokens.pop(); // convert tokens - ast.tokens = acornToEsprima.toTokens(tokens, tt); + ast.tokens = acornToEsprima.toTokens(ast.tokens, tt); // add comments - acornToEsprima.convertComments(comments); - ast.comments = comments; - acornToEsprima.attachComments(ast, comments, ast.tokens); + acornToEsprima.convertComments(ast.comments); // transform esprima and acorn divergent nodes acornToEsprima.toAST(ast, traverse); + // ast.program.tokens = ast.tokens; + // ast.program.comments = ast.comments; + // ast = ast.program; + + // remove File + ast.type = 'Program'; + ast.sourceType = ast.program.sourceType; + ast.directives = ast.program.directives; + ast.body = ast.program.body; + delete ast.program; + delete ast._paths; + + acornToEsprima.attachComments(ast, ast.comments, ast.tokens); + return ast; } diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 3aeac5769e32..cf5ddb6afb65 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -8,16 +8,19 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "babel-core": "^5.8.33", + "acorn-to-esprima": "hzoo/acorn-to-esprima#babel6", + "babel-traverse": "^6.0.20", + "babel-types": "^6.0.19", + "babylon": "^6.0.18", "lodash.assign": "^3.2.0", - "lodash.pick": "^3.1.0", - "acorn-to-esprima": "^1.0.5" + "lodash.pick": "^3.1.0" }, "scripts": { "bootstrap": "git submodule update --init && cd eslint && npm install", "eslint": "cd eslint && mocha -c tests/lib/rules/*.js -r ../eslint-tester.js", "test": "mocha", - "lint": "./node_modules/eslint/bin/eslint.js ./test index.js acorn-to-esprima.js" + "lint": "./node_modules/eslint/bin/eslint.js ./test index.js acorn-to-esprima.js", + "preversion": "npm test" }, "author": "Sebastian McKenzie ", "license": "MIT", diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 216717312cb8..c4266de5008c 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -1,3 +1,4 @@ +var assert = require("assert"); var babelEslint = require(".."); var espree = require("espree"); var util = require("util"); @@ -17,7 +18,7 @@ function assertImplementsAST(target, source, path) { var typeA = target === null ? "null" : typeof target; var typeB = source === null ? "null" : typeof source; if (typeA !== typeB) { - error("have different types (" + typeA + " !== " + typeB + ")"); + error("have different types (" + typeA + " !== " + typeB + ") " + "(" + target + " !== " + source + ")"); } else if (typeA === "object") { var keysTarget = Object.keys(target); for (var i in keysTarget) { @@ -65,17 +66,18 @@ function parseAndAssertSame(code) { comment: true, attachComment: true }); - var acornAST = babelEslint.parse(code); + var babylonAST = babelEslint.parse(code); try { - assertImplementsAST(esAST, acornAST); + assertImplementsAST(esAST, babylonAST); } catch(err) { err.message += "\nespree:\n" + util.inspect(esAST, {depth: err.depth, colors: true}) + "\nbabel-eslint:\n" + - util.inspect(acornAST, {depth: err.depth, colors: true}); + util.inspect(babylonAST, {depth: err.depth, colors: true}); throw err; } + // assert.equal(esAST, babylonAST); } describe("acorn-to-esprima", function () { @@ -240,11 +242,11 @@ describe("acorn-to-esprima", function () { parseAndAssertSame("export { foo as bar };"); }); - it("empty program with line comment", function () { + it.skip("empty program with line comment", function () { parseAndAssertSame("// single comment"); }); - it("empty program with block comment", function () { + it.skip("empty program with block comment", function () { parseAndAssertSame(" /* multiline\n * comment\n*/"); }); @@ -326,5 +328,64 @@ describe("acorn-to-esprima", function () { "}", "}" ].join("\n")); - }) + }); + + it("MethodDefinition", function () { + parseAndAssertSame([ + "export default class A {", + "a() {}", + "}" + ].join("\n")); + }); + + it("MethodDefinition 2", function () { + parseAndAssertSame([ + "export default class Bar { get bar() { return 42; }}" + ].join("\n")); + }); + + it("ClassMethod", function () { + parseAndAssertSame([ + "class A {", + "constructor() {", + "}", + "}" + ].join("\n")); + }); + + it("ClassMethod multiple params", function () { + parseAndAssertSame([ + "class A {", + "constructor(a, b, c) {", + "}", + "}" + ].join("\n")); + }); + + it("ClassMethod multiline", function () { + parseAndAssertSame([ + "class A {", + " constructor(", + " a,", + " b,", + " c", + " ) {", + "", + " }", + "}" + ].join("\n")); + }); + + it("ClassMethod oneline", function () { + parseAndAssertSame("class A { constructor(a, b, c) {} }"); + }); + + it("ObjectMethod", function () { + parseAndAssertSame([ + "var a = {", + "b(c) {", + "}", + "}" + ].join("\n")); + }); }); diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 6a285b85c31e..cdbc5555a5f4 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1047,86 +1047,6 @@ describe("verify", function () { ); }); - describe("comprehensions", function () { - it("array #9", function () { - verifyAndAssertMessages([ - "let arr = [1, 2, 3];", - "let b = [for (e of arr) String(e)]; b;" - ].join("\n"), - { "no-unused-vars": 1, "no-undef": 1 }, - [] - ); - }); - - it("array, if statement, multiple blocks", function () { - verifyAndAssertMessages([ - "let arr = [1, 2, 3];", - "let arr2 = [1, 2, 3];", - "[for (x of arr) for (y of arr2) if (x === true && y === true) x + y];" - ].join("\n"), - { "no-unused-vars": 1, "no-undef": 1 }, - [] - ); - }); - - it("generator, if statement, multiple blocks", function () { - verifyAndAssertMessages([ - "let arr = [1, 2, 3];", - "let arr2 = [1, 2, 3];", - "(for (x of arr) for (y of arr2) if (x === true && y === true) x + y)" - ].join("\n"), - { "no-unused-vars": 1, "no-undef": 1 }, - [] - ); - }); - - it("ArrayPattern", function () { - verifyAndAssertMessages([ - "let arr = [1, 2, 3];", - "[for ([,x] of arr) x]" - ].join("\n"), - { "no-unused-vars": 1, "no-undef": 1 }, - [] - ); - }); - - it("ObjectPattern", function () { - verifyAndAssertMessages([ - "let arr = [{x: 1, y: 2}, {x: 2, y: 3}];", - "[for ({x, y} of arr) x + y]" - ].join("\n"), - { "no-unused-vars": 1, "no-undef": 1 }, - [] - ); - }); - - it("multiple comprehensions #138", function () { - verifyAndAssertMessages([ - "function test() {", - "let items;", - "return {", - "a: [for (i of items) i],", - "b: [for (i of items) i]", - "};", - "} test;" - ].join("\n"), - { "no-unused-vars": 1, "no-undef": 1, "no-redeclare": 1 }, - [] - ); - }); - - it("visiting filter in comprehension", function () { - verifyAndAssertMessages([ - "function test(items, val) {", - "return [ for (i of items) if (i === val) i ];", - "} test;" - ].join("\n"), - { "no-unused-vars": 1, "no-undef": 1 }, - [] - ); - }); - }); - describe("decorators #72", function () { it("class declaration", function () { verifyAndAssertMessages( From c435628b6a6a7885bb935c962fc3bacd09c6afb2 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 26 Nov 2015 14:46:42 -0500 Subject: [PATCH 228/569] 5.0.0-beta1 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index cf5ddb6afb65..e3481379a61d 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "4.1.6", + "version": "5.0.0-beta1", "description": "", "main": "index.js", "repository": { From 204ba8641841c59f287a8fb2e1a2ef916f5b2499 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 27 Nov 2015 15:42:16 -0500 Subject: [PATCH 229/569] Merge pull request babel/babel-eslint#215 from zertosh/master babylon/espree option alignment --- eslint/babel-eslint-parser/index.js | 9 ++++----- eslint/babel-eslint-parser/test/babel-eslint.js | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index ba3b784ea7fc..de3cdb0275dd 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -370,12 +370,11 @@ exports.parse = function (code) { exports.parseNoPatch = function (code) { var opts = { - locations: true, - ranges: true, sourceType: "module", strictMode: true, - allowHashBang: true, - ecmaVersion: Infinity, + allowImportExportEverywhere: false, // consistent with espree + allowReturnOutsideFunction: true, + allowSuperOutsideMethod: true, plugins: [ "flow", "jsx", @@ -391,7 +390,7 @@ exports.parseNoPatch = function (code) { "objectRestSpread", "trailingFunctionCommas" ] -}; + }; var ast; try { diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index c4266de5008c..b4498042feec 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -388,4 +388,18 @@ describe("acorn-to-esprima", function () { "}" ].join("\n")); }); + + it("do not allow import export everywhere", function() { + assert.throws(function () { + parseAndAssertSame("function F() { import a from \"a\"; }"); + }, /Illegal import declaration/) + }); + + it("return outside function", function () { + parseAndAssertSame("return;"); + }); + + it("super outside method", function () { + parseAndAssertSame("function F() { super(); }"); + }); }); From faa003168c1113d79abdc8e259c7f68317db0ecf Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 27 Nov 2015 15:44:07 -0500 Subject: [PATCH 230/569] add functionSent to parser --- eslint/babel-eslint-parser/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index de3cdb0275dd..820afe48e4e5 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -387,6 +387,7 @@ exports.parseNoPatch = function (code) { "exponentiationOperator", "exportExtensions", "functionBind", + "functionSent", "objectRestSpread", "trailingFunctionCommas" ] From f76be581b31a5c5cb4fdfdb1a78fe61b0bc1e1de Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 27 Nov 2015 15:45:09 -0500 Subject: [PATCH 231/569] 5.0.0-beta2 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index e3481379a61d..ca08e3365d06 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "5.0.0-beta1", + "version": "5.0.0-beta2", "description": "", "main": "index.js", "repository": { From 4249dcd35354d6049ea2f76195be4eac1fdb2217 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 28 Nov 2015 16:31:13 -0500 Subject: [PATCH 232/569] update acorn-to-esprima, add tests for babel/babel-eslint#216 --- eslint/babel-eslint-parser/index.js | 4 +- .../babel-eslint-parser/test/babel-eslint.js | 132 ++++++++++-------- .../test/non-regression.js | 8 ++ 3 files changed, 80 insertions(+), 64 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 820afe48e4e5..f0e7dea838e9 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -414,13 +414,13 @@ exports.parseNoPatch = function (code) { ast.tokens.pop(); // convert tokens - ast.tokens = acornToEsprima.toTokens(ast.tokens, tt); + ast.tokens = acornToEsprima.toTokens(ast.tokens, tt, code); // add comments acornToEsprima.convertComments(ast.comments); // transform esprima and acorn divergent nodes - acornToEsprima.toAST(ast, traverse); + acornToEsprima.toAST(ast, traverse, code); // ast.program.tokens = ast.tokens; // ast.program.comments = ast.comments; diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index b4498042feec..c709f7da631d 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -330,76 +330,84 @@ describe("acorn-to-esprima", function () { ].join("\n")); }); - it("MethodDefinition", function () { - parseAndAssertSame([ - "export default class A {", - "a() {}", - "}" - ].join("\n")); - }); + describe("babel 6 tests", function () { + it("MethodDefinition", function () { + parseAndAssertSame([ + "export default class A {", + "a() {}", + "}" + ].join("\n")); + }); - it("MethodDefinition 2", function () { - parseAndAssertSame([ - "export default class Bar { get bar() { return 42; }}" - ].join("\n")); - }); + it("MethodDefinition 2", function () { + parseAndAssertSame([ + "export default class Bar { get bar() { return 42; }}" + ].join("\n")); + }); - it("ClassMethod", function () { - parseAndAssertSame([ - "class A {", - "constructor() {", - "}", - "}" - ].join("\n")); - }); + it("ClassMethod", function () { + parseAndAssertSame([ + "class A {", + "constructor() {", + "}", + "}" + ].join("\n")); + }); - it("ClassMethod multiple params", function () { - parseAndAssertSame([ - "class A {", - "constructor(a, b, c) {", - "}", - "}" - ].join("\n")); - }); + it("ClassMethod multiple params", function () { + parseAndAssertSame([ + "class A {", + "constructor(a, b, c) {", + "}", + "}" + ].join("\n")); + }); - it("ClassMethod multiline", function () { - parseAndAssertSame([ - "class A {", - " constructor(", - " a,", - " b,", - " c", - " ) {", - "", - " }", - "}" - ].join("\n")); - }); + it("ClassMethod multiline", function () { + parseAndAssertSame([ + "class A {", + " constructor(", + " a,", + " b,", + " c", + " ) {", + "", + " }", + "}" + ].join("\n")); + }); - it("ClassMethod oneline", function () { - parseAndAssertSame("class A { constructor(a, b, c) {} }"); - }); + it("ClassMethod oneline", function () { + parseAndAssertSame("class A { constructor(a, b, c) {} }"); + }); - it("ObjectMethod", function () { - parseAndAssertSame([ - "var a = {", - "b(c) {", - "}", - "}" - ].join("\n")); - }); + it("ObjectMethod", function () { + parseAndAssertSame([ + "var a = {", + "b(c) {", + "}", + "}" + ].join("\n")); + }); - it("do not allow import export everywhere", function() { - assert.throws(function () { - parseAndAssertSame("function F() { import a from \"a\"; }"); - }, /Illegal import declaration/) - }); + it("do not allow import export everywhere", function() { + assert.throws(function () { + parseAndAssertSame("function F() { import a from \"a\"; }"); + }, /Illegal import declaration/) + }); - it("return outside function", function () { - parseAndAssertSame("return;"); - }); + it("return outside function", function () { + parseAndAssertSame("return;"); + }); - it("super outside method", function () { - parseAndAssertSame("function F() { super(); }"); + it("super outside method", function () { + parseAndAssertSame("function F() { super(); }"); + }); + + it("StringLiteral", function () { + parseAndAssertSame(''); + parseAndAssertSame(""); + parseAndAssertSame("a"); + }); }); }); diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index cdbc5555a5f4..0e7559df3b35 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1296,4 +1296,12 @@ describe("verify", function () { [ "1:13 \"x\" was used before it was defined no-use-before-define" ] ) }); + + it("jsx and stringliteral #216", function () { + verifyAndAssertMessages( + "
", + {}, + [] + ) + }); }); From 61e1c5b546bfb6117143c5381391d6dcddc70a80 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 28 Nov 2015 16:31:24 -0500 Subject: [PATCH 233/569] 5.0.0-beta3 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index ca08e3365d06..9252cd59242a 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "5.0.0-beta2", + "version": "5.0.0-beta3", "description": "", "main": "index.js", "repository": { From c078e11bcf3be8dcbb74338f95f7038a7877435f Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sun, 29 Nov 2015 08:24:10 -0500 Subject: [PATCH 234/569] update acorn-to-esprima to 2.0.1 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 9252cd59242a..1f03fb1d9af8 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -8,7 +8,7 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "acorn-to-esprima": "hzoo/acorn-to-esprima#babel6", + "acorn-to-esprima": "^2.0.1", "babel-traverse": "^6.0.20", "babel-types": "^6.0.19", "babylon": "^6.0.18", From 423683e7ef0e5de87da96924612adddc54862afd Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sun, 29 Nov 2015 08:24:29 -0500 Subject: [PATCH 235/569] 5.0.0-beta4 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 1f03fb1d9af8..74afb831e4ea 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "5.0.0-beta3", + "version": "5.0.0-beta4", "description": "", "main": "index.js", "repository": { From fa7dfc272a06a412f83b9726a8760fbb559f896c Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 1 Dec 2015 09:58:43 -0500 Subject: [PATCH 236/569] update eslint --- eslint/babel-eslint-parser/eslint | 2 +- eslint/babel-eslint-parser/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/eslint b/eslint/babel-eslint-parser/eslint index 8f6f543b2952..fdce86d24e30 160000 --- a/eslint/babel-eslint-parser/eslint +++ b/eslint/babel-eslint-parser/eslint @@ -1 +1 @@ -Subproject commit 8f6f543b2952e439ba5e158b3f0bcfd150ab3914 +Subproject commit fdce86d24e30a31c0c819262b72ab6b454cb552a diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 74afb831e4ea..5bfb001008aa 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -29,7 +29,7 @@ }, "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { - "eslint": "^1.9.0", + "eslint": "^1.10.2", "espree": "^2.2.5", "mocha": "^2.3.3" } From 318a530dfad9869dde88a814c012a12775316aff Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 9 Dec 2015 08:27:19 -0500 Subject: [PATCH 237/569] update acorn-to-esprima, add getter/setter tests --- eslint/babel-eslint-parser/package.json | 2 +- .../babel-eslint-parser/test/babel-eslint.js | 28 +++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 5bfb001008aa..98ceeb96f08d 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -8,7 +8,7 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "acorn-to-esprima": "^2.0.1", + "acorn-to-esprima": "^2.0.3", "babel-traverse": "^6.0.20", "babel-types": "^6.0.19", "babylon": "^6.0.18", diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index c709f7da631d..3c2782dbb791 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -366,11 +366,12 @@ describe("acorn-to-esprima", function () { it("ClassMethod multiline", function () { parseAndAssertSame([ "class A {", - " constructor(", + " constructor (", " a,", " b,", " c", - " ) {", + " )", + "{", "", " }", "}" @@ -409,5 +410,28 @@ describe("acorn-to-esprima", function () { parseAndAssertSame(""); parseAndAssertSame("a"); }); + + it("getters and setters", function () { + parseAndAssertSame("class A { get x ( ) { ; } }"); + parseAndAssertSame([ + "class A {", + "get x(", + ")", + "{", + ";", + "}", + "}" + ].join("\n")); + parseAndAssertSame("class A { set x (a) { ; } }"); + parseAndAssertSame([ + "class A {", + "set x(a", + ")", + "{", + ";", + "}", + "}" + ].join("\n")); + }); }); }); From 3b673ef4b67332d43ab4e0155f12bf006ee821ff Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 9 Dec 2015 08:27:37 -0500 Subject: [PATCH 238/569] 5.0.0-beta5 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 98ceeb96f08d..ace66a9191f4 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "5.0.0-beta4", + "version": "5.0.0-beta5", "description": "", "main": "index.js", "repository": { From c35137040aa31cc49d5126920e93f8e4fab29dd9 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 9 Dec 2015 08:40:27 -0500 Subject: [PATCH 239/569] update acorn-to-esprima, account for getter/setter kind property --- eslint/babel-eslint-parser/package.json | 2 +- .../babel-eslint-parser/test/babel-eslint.js | 10 +++++++ .../test/non-regression.js | 27 +++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index ace66a9191f4..83923ac4904e 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -8,7 +8,7 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "acorn-to-esprima": "^2.0.3", + "acorn-to-esprima": "^2.0.4", "babel-traverse": "^6.0.20", "babel-types": "^6.0.19", "babylon": "^6.0.18", diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 3c2782dbb791..dea774eb2efd 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -432,6 +432,16 @@ describe("acorn-to-esprima", function () { "}", "}" ].join("\n")); + parseAndAssertSame([ + "var B = {", + "get x () {", + "return this.ecks;", + "},", + "set x (ecks) {", + "this.ecks = ecks;", + "}", + "};" + ].join("\n")); }); }); }); diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 0e7559df3b35..af887aa4a7b0 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1304,4 +1304,31 @@ describe("verify", function () { [] ) }); + + it("getter/setter #218", function () { + verifyAndAssertMessages([ + "class Person {", + "set a (v) { }", + "}" + ].join("\n"), + { "space-before-function-paren": 1, "space-before-keywords": 1, "indent": 1 }, + [] + ) + }); + + it("getter/setter #220", function () { + verifyAndAssertMessages([ + "var B = {", + "get x () {", + "return this.ecks;", + "},", + "set x (ecks) {", + "this.ecks = ecks;", + "}", + "};" + ].join("\n"), + { "no-dupe-keys": 1 }, + [] + ) + }); }); From 02d63b7ec4e3e830fd603d2e5a636e967e0c3718 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 9 Dec 2015 08:42:02 -0500 Subject: [PATCH 240/569] 5.0.0-beta6 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 83923ac4904e..7d4c6dedfd8c 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "5.0.0-beta5", + "version": "5.0.0-beta6", "description": "", "main": "index.js", "repository": { From c510fa79d00f0cba5af52f1fd84f5d6a9d3eed72 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 29 Dec 2015 13:44:12 -0500 Subject: [PATCH 241/569] add test for es6 unicode escapes --- eslint/babel-eslint-parser/test/non-regression.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index af887aa4a7b0..77326846588b 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1329,6 +1329,14 @@ describe("verify", function () { ].join("\n"), { "no-dupe-keys": 1 }, [] - ) + ); + }); + + it("regex with es6 unicodeCodePointEscapes", function () { + verifyAndAssertMessages( + "string.replace(/[\u{0000A0}-\u{10FFFF}<>\&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`);", + {}, + [] + ); }); }); From 1adc834b10738410d3a975f87321bd4ee6ff4916 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 29 Dec 2015 13:48:29 -0500 Subject: [PATCH 242/569] skip for now --- eslint/babel-eslint-parser/test/non-regression.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 77326846588b..f2a35d586445 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1332,7 +1332,7 @@ describe("verify", function () { ); }); - it("regex with es6 unicodeCodePointEscapes", function () { + it.skip("regex with es6 unicodeCodePointEscapes", function () { verifyAndAssertMessages( "string.replace(/[\u{0000A0}-\u{10FFFF}<>\&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`);", {}, From 0778f623fb0d633081f13b924e4c69325e42ac09 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 16 Jan 2016 00:16:50 -0500 Subject: [PATCH 243/569] Merge pull request babel/babel-eslint#232 from vaibhavmule/patch-1 update Licenses date --- eslint/babel-eslint-parser/LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/LICENSE b/eslint/babel-eslint-parser/LICENSE index dac23744b010..80194a854b94 100644 --- a/eslint/babel-eslint-parser/LICENSE +++ b/eslint/babel-eslint-parser/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2014-2015 Sebastian McKenzie +Copyright (c) 2014-2016 Sebastian McKenzie MIT License From 9380324a0f74d9e624be911cdda837b756e7e74c Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 30 Jan 2016 10:32:47 -0500 Subject: [PATCH 244/569] temporarily remove test --- eslint/babel-eslint-parser/test/non-regression.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index f2a35d586445..d469fc410406 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1332,11 +1332,11 @@ describe("verify", function () { ); }); - it.skip("regex with es6 unicodeCodePointEscapes", function () { - verifyAndAssertMessages( - "string.replace(/[\u{0000A0}-\u{10FFFF}<>\&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`);", - {}, - [] - ); - }); + // it("regex with es6 unicodeCodePointEscapes", function () { + // verifyAndAssertMessages( + // "string.replace(/[\u{0000A0}-\u{10FFFF}<>\&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`);", + // {}, + // [] + // ); + // }); }); From f083e49a6347c24270554726c5a9a2300c8051b0 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 30 Jan 2016 10:34:38 -0500 Subject: [PATCH 245/569] Merge pull request babel/babel-eslint#241 from jmm/rule-strict Add tests for `strict` rule --- .../fixtures/rules/strict/function-with.js | 3 + .../fixtures/rules/strict/function-without.js | 1 + .../rules/strict/global-with-function-with.js | 5 + .../strict/global-with-function-without.js | 3 + .../test/fixtures/rules/strict/global-with.js | 6 + .../test/fixtures/rules/strict/none.js | 1 + .../babel-eslint-parser/test/integration.js | 202 ++++++++++++++++++ 7 files changed, 221 insertions(+) create mode 100644 eslint/babel-eslint-parser/test/fixtures/rules/strict/function-with.js create mode 100644 eslint/babel-eslint-parser/test/fixtures/rules/strict/function-without.js create mode 100644 eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with-function-with.js create mode 100644 eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with-function-without.js create mode 100644 eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with.js create mode 100644 eslint/babel-eslint-parser/test/fixtures/rules/strict/none.js create mode 100644 eslint/babel-eslint-parser/test/integration.js diff --git a/eslint/babel-eslint-parser/test/fixtures/rules/strict/function-with.js b/eslint/babel-eslint-parser/test/fixtures/rules/strict/function-with.js new file mode 100644 index 000000000000..3df7515269d5 --- /dev/null +++ b/eslint/babel-eslint-parser/test/fixtures/rules/strict/function-with.js @@ -0,0 +1,3 @@ +function x () { + "use strict"; +} diff --git a/eslint/babel-eslint-parser/test/fixtures/rules/strict/function-without.js b/eslint/babel-eslint-parser/test/fixtures/rules/strict/function-without.js new file mode 100644 index 000000000000..20b3e9e55005 --- /dev/null +++ b/eslint/babel-eslint-parser/test/fixtures/rules/strict/function-without.js @@ -0,0 +1 @@ +function x () {} diff --git a/eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with-function-with.js b/eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with-function-with.js new file mode 100644 index 000000000000..ef682f72c947 --- /dev/null +++ b/eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with-function-with.js @@ -0,0 +1,5 @@ +"use strict"; + +function x () { + "use strict"; +} diff --git a/eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with-function-without.js b/eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with-function-without.js new file mode 100644 index 000000000000..206f708141b7 --- /dev/null +++ b/eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with-function-without.js @@ -0,0 +1,3 @@ +"use strict"; + +function x () {} diff --git a/eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with.js b/eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with.js new file mode 100644 index 000000000000..b28e68be0cd3 --- /dev/null +++ b/eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with.js @@ -0,0 +1,6 @@ +"use strict";; +/* +The empty statement is intentional. As of now, ESLint won't enforce +string: [2, "global"] on a program with an empty body. A test for that without +massaging the AST to ESlint's input format should fail. +*/ diff --git a/eslint/babel-eslint-parser/test/fixtures/rules/strict/none.js b/eslint/babel-eslint-parser/test/fixtures/rules/strict/none.js new file mode 100644 index 000000000000..4a6db98f6226 --- /dev/null +++ b/eslint/babel-eslint-parser/test/fixtures/rules/strict/none.js @@ -0,0 +1 @@ +"no use strict anywhere"; diff --git a/eslint/babel-eslint-parser/test/integration.js b/eslint/babel-eslint-parser/test/integration.js new file mode 100644 index 000000000000..5ce7a443fca4 --- /dev/null +++ b/eslint/babel-eslint-parser/test/integration.js @@ -0,0 +1,202 @@ +var assert = require("assert"); +var assign = require("lodash.assign"); +var eslint = require("eslint"); +var fs = require("fs"); +var path = require("path"); + +var paths = { + fixtures: path.join(__dirname, "fixtures", "rules"), +}; + +var encoding = "utf8"; +var errorLevel = 2; + +var baseEslintOpts = { + parser: require.resolve(".."), +}; + +/** + * Load a fixture and run eslint.linter.verify() on it. + * Pass the return value to done(). + * @param object opts + * @param function done + */ +function lint (opts, done) { + readFixture(opts.fixture, function (err, src) { + if (err) return done(err); + done(null, eslint.linter.verify(src, opts.eslint)); + }); +} + +/** + * Read a fixture file, passing the content to done(). + * @param string|array id + * @param function done + */ +function readFixture (id, done) { + if (Array.isArray(id)) id = path.join.apply(path, id); + if (!path.extname(id)) id += ".js"; + fs.readFile( + path.join(paths.fixtures, id), + encoding, + done + ); +} +// readFixture + +describe("Rules:", function () { + describe("`strict`", strictSuite); +}); +// describe + +function strictSuite () { + var ruleId = "strict"; + + describe("when set to 'never'", function () { + var eslintOpts = assign({}, baseEslintOpts, { + rules: {}, + }); + eslintOpts.rules[ruleId] = [errorLevel, "never"]; + + ["global-with", "function-with"].forEach(function (fixture) { + it( + "should error on " + fixture.match(/^[^-]+/)[0] + " directive", + function (done) { + lint({ + fixture: ["strict", fixture], + eslint: eslintOpts, + }, function (err, report) { + if (err) return done(err); + assert(report[0].ruleId === ruleId); + done(); + }); + } + ); + // it + }); + }); + // describe + + describe("when set to 'global'", function () { + var eslintOpts = assign({}, baseEslintOpts, { + rules: {} + }); + eslintOpts.rules[ruleId] = [errorLevel, "global"]; + + it("shouldn't error on single global directive", function (done) { + lint({ + fixture: ["strict", "global-with"], + eslint: eslintOpts, + }, function (err, report) { + if (err) return done(err); + assert(!report.length); + done(); + }); + }); + // it + + it("should error twice on global directive: no and function directive: yes", function (done) { + lint({ + fixture: ["strict", "function-with"], + eslint: eslintOpts, + }, function (err, report) { + if (err) return done(err); + [0, 1].forEach(function (i) { + assert(report[i].ruleId === ruleId); + }); + done(); + }); + }); + // it + + it("should error on function directive", function (done) { + lint({ + fixture: ["strict", "global-with-function-with"], + eslint: eslintOpts, + }, function (err, report) { + if (err) return done(err); + assert(report[0].ruleId === ruleId); + + // This is to make sure the test fails prior to adapting Babel AST + // directive representation to ESLint format. Otherwise it reports an + // error for missing global directive that masquerades as the expected + // result of the previous assertion. + assert(report[0].nodeType !== "Program"); + done(); + }); + }); + // it + + it("should error on no directive", function (done) { + lint({ + fixture: ["strict", "none"], + eslint: eslintOpts, + }, function (err, report) { + if (err) return done(err); + assert(report[0].ruleId === ruleId); + done(); + }); + }); + // it + }); + // describe + + describe("when set to 'function'", function () { + var eslintOpts = assign({}, baseEslintOpts, { + rules: {} + }); + eslintOpts.rules[ruleId] = [errorLevel, "function"]; + + it("shouldn't error on single function directive", function (done) { + lint({ + fixture: ["strict", "function-with"], + eslint: eslintOpts, + }, function (err, report) { + if (err) return done(err); + assert(!report.length); + done(); + }); + }); + // it + + it("should error twice on function directive: no and global directive: yes", function (done) { + lint({ + fixture: ["strict", "global-with-function-without"], + eslint: eslintOpts, + }, function (err, report) { + if (err) return done(err); + [0, 1].forEach(function (i) { + assert(report[i].ruleId === ruleId); + }); + done(); + }); + }); + // it + + it("should error on only global directive", function (done) { + lint({ + fixture: ["strict", "global-with"], + eslint: eslintOpts, + }, function (err, report) { + if (err) return done(err); + assert(report[0].ruleId === ruleId); + done(); + }); + }); + // it + + it("should error on extraneous global directive", function (done) { + lint({ + fixture: ["strict", "global-with-function-with"], + eslint: eslintOpts, + }, function (err, report) { + if (err) return done(err); + assert(report[0].ruleId === ruleId); + assert(report[0].nodeType.indexOf("Function") === -1); + done(); + }); + }); + // it + }); + // describe +} From 167741b80bced41ac533f89bb9957099471ada0c Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 30 Jan 2016 10:37:21 -0500 Subject: [PATCH 246/569] 5.0.0-beta7 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 7d4c6dedfd8c..b5b9f785f54b 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "5.0.0-beta6", + "version": "5.0.0-beta7", "description": "", "main": "index.js", "repository": { From 177c0b497953f2ba467a804e9a97136884058b6d Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 30 Jan 2016 12:19:44 -0500 Subject: [PATCH 247/569] Add a test for use strict and directive ast change Fixes babel/babel-eslint#242 --- eslint/babel-eslint-parser/test/non-regression.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index d469fc410406..c8dcf93da2dc 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -138,8 +138,7 @@ describe("verify", function () { ); }); - // fix after updating to ESLint 1.0.0 - it.skip("Arrow function with non-block bodies (issue #20)", function () { + it("Arrow function with non-block bodies (issue #20)", function () { verifyAndAssertMessages( "\"use strict\"; () => 1", { "strict": [1, "global"] }, @@ -148,6 +147,15 @@ describe("verify", function () { ); }); + it("#242", function () { + verifyAndAssertMessages( + "\"use strict\"; asdf;", + { "no-irregular-whitespace": 1 }, + [], + {} + ); + }); + it("await keyword (issue #22)", function () { verifyAndAssertMessages( "async function foo() { await bar(); }", From e2464f462e219d0784be1752334c79127a505257 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 30 Jan 2016 12:20:15 -0500 Subject: [PATCH 248/569] 5.0.0-beta8 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index b5b9f785f54b..64fbf7e40b1a 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "5.0.0-beta7", + "version": "5.0.0-beta8", "description": "", "main": "index.js", "repository": { From a55236d383d039516b800f69a8173bbcd1995498 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 1 Feb 2016 14:40:01 -0500 Subject: [PATCH 249/569] Merge pull request babel/babel-eslint#244 from christophehurpeau/patch-1 fix babel/babel-eslint#243 --- eslint/babel-eslint-parser/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index f0e7dea838e9..7a76b5f4a676 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -80,6 +80,9 @@ function monkeypatch() { } var referencerMod = createModule(referencerLoc); var referencer = require(referencerLoc); + if (typeof referencer === 'object' && referencer.default) { + referencer = referencer.default; + } // monkeypatch escope/pattern-visitor var patternVisitorLoc; @@ -89,6 +92,9 @@ function monkeypatch() { patternVisitorLoc = Module._resolveFilename("./pattern-visitor", escopeMod); patternVisitorMod = createModule(patternVisitorLoc); patternVisitor = require(patternVisitorLoc); + if (typeof patternVisitor === 'object' && patternVisitor.default) { + patternVisitor = patternVisitor.default; + } } catch (err) { // When eslint uses old escope, we cannot find pattern visitor. // Fallback to the old way. From 740a54624908e40fb0d1129f3193577593f65841 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 1 Feb 2016 14:40:54 -0500 Subject: [PATCH 250/569] 5.0.0-beta9 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 64fbf7e40b1a..247e6cbddd60 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "5.0.0-beta8", + "version": "5.0.0-beta9", "description": "", "main": "index.js", "repository": { From c1bec5c4de96c8a8a931c22067273849d01d5ce3 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 1 Feb 2016 20:22:03 -0500 Subject: [PATCH 251/569] check using `__esModule` --- eslint/babel-eslint-parser/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 7a76b5f4a676..cf42ffb3c49a 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -80,7 +80,7 @@ function monkeypatch() { } var referencerMod = createModule(referencerLoc); var referencer = require(referencerLoc); - if (typeof referencer === 'object' && referencer.default) { + if (referencer.__esModule) { referencer = referencer.default; } @@ -92,7 +92,7 @@ function monkeypatch() { patternVisitorLoc = Module._resolveFilename("./pattern-visitor", escopeMod); patternVisitorMod = createModule(patternVisitorLoc); patternVisitor = require(patternVisitorLoc); - if (typeof patternVisitor === 'object' && patternVisitor.default) { + if (patternVisitor.__esModule) { patternVisitor = patternVisitor.default; } } catch (err) { From 83debbfda0bdc1a2fef6017cfe90b9773822dd24 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 1 Feb 2016 23:05:06 -0500 Subject: [PATCH 252/569] Merge pull request babel/babel-eslint#246 from babel/escope-patterns Prevent escope referencer from traversing into param pattern type annotations --- eslint/babel-eslint-parser/index.js | 17 +++++++++++++++++ .../babel-eslint-parser/test/non-regression.js | 13 +++++++++++++ 2 files changed, 30 insertions(+) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index cf42ffb3c49a..47980470f4cb 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -47,17 +47,23 @@ function monkeypatch() { estraverseRelative = createModule(esrecurseLoc); } catch (err) {} + // contains all the instances of estraverse so we can modify them if necessary + var estraverses = []; + // monkeypatch estraverse estraverse = estraverseRelative.require("estraverse"); + estraverses.push(estraverse); assign(estraverse.VisitorKeys, t.VISITOR_KEYS); // monkeypatch estraverse-fb var estraverseFb = eslintMod.require("estraverse-fb"); + estraverses.push(estraverseFb); assign(estraverseFb.VisitorKeys, t.VISITOR_KEYS); // ESLint v1.9.0 uses estraverse directly to work around https://github.com/npm/npm/issues/9663 var estraverseOfEslint = eslintMod.require("estraverse"); if (estraverseOfEslint !== estraverseFb) { + estraverses.push(estraverseOfEslint); assign(estraverseOfEslint.VisitorKeys, t.VISITOR_KEYS); } @@ -279,7 +285,18 @@ function monkeypatch() { } } } + // set ArrayPattern/ObjectPattern visitor keys back to their original. otherwise + // escope will traverse into them and include the identifiers within as declarations + estraverses.forEach(function (estraverse) { + estraverse.VisitorKeys.ObjectPattern = ["properties"]; + estraverse.VisitorKeys.ArrayPattern = ["elements"]; + }); visitFunction.call(this, node); + // set them back to normal... + estraverses.forEach(function (estraverse) { + estraverse.VisitorKeys.ObjectPattern = t.VISITOR_KEYS.ObjectPattern; + estraverse.VisitorKeys.ArrayPattern = t.VISITOR_KEYS.ArrayPattern; + }); if (typeParamScope) { this.close(node); } diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index c8dcf93da2dc..e1f18afa087e 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1340,6 +1340,19 @@ describe("verify", function () { ); }); + it("fixes issues with flow types and ObjectPattern", function () { + verifyAndAssertMessages([ + "import type Foo from 'bar';", + "export default class Foobar {", + " foo({ bar }: Foo) { bar; }", + " bar({ foo }: Foo) { foo; }", + "}" + ].join("\n"), + { "no-unused-vars": 1 }, + [] + ); + }); + // it("regex with es6 unicodeCodePointEscapes", function () { // verifyAndAssertMessages( // "string.replace(/[\u{0000A0}-\u{10FFFF}<>\&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`);", From 8f9f800dc575e275cd83fca029d92ff6f4cb7e1d Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 1 Feb 2016 23:06:09 -0500 Subject: [PATCH 253/569] 5.0.0-beta10 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 247e6cbddd60..f204d0a9fbe7 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "5.0.0-beta9", + "version": "5.0.0-beta10", "description": "", "main": "index.js", "repository": { From 05f708c330fcc43270974bdf33beab5020b0d2c5 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 2 Feb 2016 17:11:01 -0500 Subject: [PATCH 254/569] Merge pull request babel/babel-eslint#250 from danez/patch-1 Testcase for babel/babel-eslint#239 --- eslint/babel-eslint-parser/test/non-regression.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index e1f18afa087e..4e2d1128ea77 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1348,7 +1348,7 @@ describe("verify", function () { " bar({ foo }: Foo) { foo; }", "}" ].join("\n"), - { "no-unused-vars": 1 }, + { "no-unused-vars": 1, "no-shadow": 1 }, [] ); }); From e4f43aa51bcdaa01518bc26bb9a21d05f0db9a28 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 16 Feb 2016 12:32:56 -0500 Subject: [PATCH 255/569] Merge pull request babel/babel-eslint#255 from deepsweet/npm-ignore include only necessary files in npm package --- eslint/babel-eslint-parser/.npmignore | 1 - eslint/babel-eslint-parser/package.json | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 eslint/babel-eslint-parser/.npmignore diff --git a/eslint/babel-eslint-parser/.npmignore b/eslint/babel-eslint-parser/.npmignore deleted file mode 100644 index 9096200b7c1f..000000000000 --- a/eslint/babel-eslint-parser/.npmignore +++ /dev/null @@ -1 +0,0 @@ -eslint diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index f204d0a9fbe7..0913779a967e 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -3,6 +3,7 @@ "version": "5.0.0-beta10", "description": "", "main": "index.js", + "files": ["index.js"], "repository": { "type": "git", "url": "https://github.com/babel/babel-eslint.git" From 5df6babfad76cf79e7a1a21af27a8448fb084bcd Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 16 Feb 2016 17:43:05 -0500 Subject: [PATCH 256/569] Update README.md --- eslint/babel-eslint-parser/README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index 006007f61949..8c3e1e1db1f7 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -3,7 +3,7 @@ **babel-eslint** allows you to lint **ALL** valid Babel code with the fantastic [ESLint](https://github.com/eslint/eslint). -`babel-eslint` is successfully linting [babel core](https://github.com/babel/babel/blob/master/.eslintrc) and many other projects. +`babel-eslint` is successfully linting babel and many other projects. > If there is an issue, first check if it can be reproduced with the regular parser or with the latest versions of `eslint` and `babel-eslint`! @@ -35,12 +35,15 @@ aren't supported by ESLint. When using this plugin, ESLint is monkeypatched and transformed into code that ESLint can understand. All location info such as line numbers, columns is also retained so you can track down errors with ease. +Basically `babel-eslint` exports an [`index.js`](/index.js) that a linter can use. +It just needs to export a `parse` method that takes in a string of code and outputs an AST. + ## Usage ### Install ```sh -$ npm install -g eslint babel-eslint +$ npm install eslint babel-eslint --save-dev ``` ### Setup From f117721251619a7a1a9dd67a0dc2331ba5b804ed Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 16 Feb 2016 18:06:37 -0500 Subject: [PATCH 257/569] 5.0.0 --- eslint/babel-eslint-parser/package.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 0913779a967e..5433fbfe9916 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,9 +1,11 @@ { "name": "babel-eslint", - "version": "5.0.0-beta10", + "version": "5.0.0", "description": "", "main": "index.js", - "files": ["index.js"], + "files": [ + "index.js" + ], "repository": { "type": "git", "url": "https://github.com/babel/babel-eslint.git" From edc91849cb58277a40a2c286710cc2db4eabec1e Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 16 Feb 2016 18:13:32 -0500 Subject: [PATCH 258/569] Update .travis.yml --- eslint/babel-eslint-parser/.travis.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/eslint/babel-eslint-parser/.travis.yml b/eslint/babel-eslint-parser/.travis.yml index d217b09b0469..ed629d9af263 100644 --- a/eslint/babel-eslint-parser/.travis.yml +++ b/eslint/babel-eslint-parser/.travis.yml @@ -1,9 +1,10 @@ --- git: depth: 1 +sudo: false language: node_js node_js: - - '0.12' - - 'io.js' - - '4' - - '5' + - "0.10" + - "0.12" + - "4" + - "5" From dce22ce5f6a8078e381f453eefb5487e45d6faa6 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 27 Feb 2016 10:23:01 -0500 Subject: [PATCH 259/569] Merge pull request babel/babel-eslint#257 from gmaclennan/patch-1 Update README.md install docs for eslint v1.x --- eslint/babel-eslint-parser/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index 8c3e1e1db1f7..41f349192e1e 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -43,7 +43,7 @@ It just needs to export a `parse` method that takes in a string of code and outp ### Install ```sh -$ npm install eslint babel-eslint --save-dev +$ npm install eslint@1.x babel-eslint --save-dev ``` ### Setup From 511862c4ee2566c832a21fd19e8a5c0eb8a0416c Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 1 Mar 2016 22:34:53 -0500 Subject: [PATCH 260/569] Merge pull request babel/babel-eslint#264 from hzoo/eslint2 ESLint 2 --- .../babylon-to-espree/attachComments.js | 57 ++++ .../babylon-to-espree/convertTemplateType.js | 93 ++++++ .../babylon-to-espree/index.js | 20 ++ .../babylon-to-espree/toAST.js | 272 ++++++++++++++++++ .../babylon-to-espree/toToken.js | 60 ++++ .../babylon-to-espree/toTokens.js | 16 ++ eslint/babel-eslint-parser/index.js | 24 +- eslint/babel-eslint-parser/package.json | 13 +- .../babel-eslint-parser/test/babel-eslint.js | 70 +++-- .../babel-eslint-parser/test/integration.js | 3 + .../test/non-regression.js | 60 ++-- 11 files changed, 603 insertions(+), 85 deletions(-) create mode 100644 eslint/babel-eslint-parser/babylon-to-espree/attachComments.js create mode 100644 eslint/babel-eslint-parser/babylon-to-espree/convertTemplateType.js create mode 100644 eslint/babel-eslint-parser/babylon-to-espree/index.js create mode 100644 eslint/babel-eslint-parser/babylon-to-espree/toAST.js create mode 100644 eslint/babel-eslint-parser/babylon-to-espree/toToken.js create mode 100644 eslint/babel-eslint-parser/babylon-to-espree/toTokens.js diff --git a/eslint/babel-eslint-parser/babylon-to-espree/attachComments.js b/eslint/babel-eslint-parser/babylon-to-espree/attachComments.js new file mode 100644 index 000000000000..4040ce7e4e0b --- /dev/null +++ b/eslint/babel-eslint-parser/babylon-to-espree/attachComments.js @@ -0,0 +1,57 @@ +// comment fixes +module.exports = function (ast, comments, tokens) { + if (comments.length) { + var firstComment = comments[0]; + var lastComment = comments[comments.length - 1]; + // fixup program start + if (!tokens.length) { + // if no tokens, the program starts at the end of the last comment + ast.start = lastComment.end; + ast.loc.start.line = lastComment.loc.end.line; + ast.loc.start.column = lastComment.loc.end.column; + + if (ast.leadingComments === null && ast.innerComments.length) { + ast.leadingComments = ast.innerComments; + } + } else if (firstComment.start < tokens[0].start) { + // if there are comments before the first token, the program starts at the first token + var token = tokens[0]; + // ast.start = token.start; + // ast.loc.start.line = token.loc.start.line; + // ast.loc.start.column = token.loc.start.column; + + // estraverse do not put leading comments on first node when the comment + // appear before the first token + if (ast.body.length) { + var node = ast.body[0]; + node.leadingComments = []; + var firstTokenStart = token.start; + var len = comments.length; + for (var i = 0; i < len && comments[i].start < firstTokenStart; i++) { + node.leadingComments.push(comments[i]); + } + } + } + // fixup program end + if (tokens.length) { + var lastToken = tokens[tokens.length - 1]; + if (lastComment.end > lastToken.end) { + // If there is a comment after the last token, the program ends at the + // last token and not the comment + // ast.end = lastToken.end; + ast.range[1] = lastToken.end; + ast.loc.end.line = lastToken.loc.end.line; + ast.loc.end.column = lastToken.loc.end.column; + } + } + } else { + if (!tokens.length) { + ast.loc.start.line = 1; + ast.loc.end.line = 1; + } + } + if (ast.body && ast.body.length > 0) { + ast.loc.start.line = ast.body[0].loc.start.line; + ast.range[0] = ast.body[0].start; + } +}; diff --git a/eslint/babel-eslint-parser/babylon-to-espree/convertTemplateType.js b/eslint/babel-eslint-parser/babylon-to-espree/convertTemplateType.js new file mode 100644 index 000000000000..0c3293dcf9d7 --- /dev/null +++ b/eslint/babel-eslint-parser/babylon-to-espree/convertTemplateType.js @@ -0,0 +1,93 @@ +module.exports = function (tokens, tt) { + var startingToken = 0; + var currentToken = 0; + var numBraces = 0; // track use of {} + var numBackQuotes = 0; // track number of nested templates + + function isBackQuote(token) { + return tokens[token].type === tt.backQuote; + } + + function isTemplateStarter(token) { + return isBackQuote(token) || + // only can be a template starter when in a template already + tokens[token].type === tt.braceR && numBackQuotes > 0; + } + + function isTemplateEnder(token) { + return isBackQuote(token) || + tokens[token].type === tt.dollarBraceL; + } + + // append the values between start and end + function createTemplateValue(start, end) { + var value = ""; + while (start <= end) { + if (tokens[start].value) { + value += tokens[start].value; + } else if (tokens[start].type !== tt.template) { + value += tokens[start].type.label; + } + start++; + } + return value; + } + + // create Template token + function replaceWithTemplateType(start, end) { + var templateToken = { + type: "Template", + value: createTemplateValue(start, end), + start: tokens[start].start, + end: tokens[end].end, + loc: { + start: tokens[start].loc.start, + end: tokens[end].loc.end + } + }; + + // put new token in place of old tokens + tokens.splice(start, end - start + 1, templateToken); + } + + function trackNumBraces(token) { + if (tokens[token].type === tt.braceL) { + numBraces++; + } else if (tokens[token].type === tt.braceR) { + numBraces--; + } + } + + while (startingToken < tokens.length) { + // template start: check if ` or } + if (isTemplateStarter(startingToken) && numBraces === 0) { + if (isBackQuote(startingToken)) { + numBackQuotes++; + } + + currentToken = startingToken + 1; + + // check if token after template start is "template" + if (currentToken >= tokens.length - 1 || tokens[currentToken].type !== tt.template) { + break; + } + + // template end: find ` or ${ + while (!isTemplateEnder(currentToken)) { + if (currentToken >= tokens.length - 1) { + break; + } + currentToken++; + } + + if (isBackQuote(currentToken)) { + numBackQuotes--; + } + // template start and end found: create new token + replaceWithTemplateType(startingToken, currentToken); + } else if (numBackQuotes > 0) { + trackNumBraces(startingToken); + } + startingToken++; + } +} diff --git a/eslint/babel-eslint-parser/babylon-to-espree/index.js b/eslint/babel-eslint-parser/babylon-to-espree/index.js new file mode 100644 index 000000000000..70accfdfcff2 --- /dev/null +++ b/eslint/babel-eslint-parser/babylon-to-espree/index.js @@ -0,0 +1,20 @@ +exports.attachComments = require("./attachComments"); + +exports.toTokens = require("./toTokens"); +exports.toAST = require("./toAST"); + +exports.convertComments = function (comments) { + for (var i = 0; i < comments.length; i++) { + var comment = comments[i]; + if (comment.type === "CommentBlock") { + comment.type = "Block"; + } else if (comment.type === "CommentLine") { + comment.type = "Line"; + } + // sometimes comments don't get ranges computed, + // even with options.ranges === true + if (!comment.range) { + comment.range = [comment.start, comment.end]; + } + } +} diff --git a/eslint/babel-eslint-parser/babylon-to-espree/toAST.js b/eslint/babel-eslint-parser/babylon-to-espree/toAST.js new file mode 100644 index 000000000000..f82c4e598e0a --- /dev/null +++ b/eslint/babel-eslint-parser/babylon-to-espree/toAST.js @@ -0,0 +1,272 @@ +var source; + +module.exports = function (ast, traverse, code) { + source = code; + ast.range = [ast.start, ast.end]; + traverse(ast, astTransformVisitor); +}; + +function changeToLiteral(node) { + node.type = "Literal"; + if (!node.raw) { + if (node.extra && node.extra.raw) { + node.raw = node.extra.raw; + } else { + node.raw = source.slice(node.start, node.end); + } + } +} + +var astTransformVisitor = { + noScope: true, + enter: function (path) { + var node = path.node; + + node.range = [node.start, node.end]; + + // private var to track original node type + node._babelType = node.type; + + if (node.innerComments) { + node.trailingComments = node.innerComments; + delete node.innerComments; + } + + if (node.trailingComments) { + for (var i = 0; i < node.trailingComments.length; i++) { + var comment = node.trailingComments[i]; + if (comment.type === "CommentLine") { + comment.type = "Line"; + } else if (comment.type === "CommentBlock") { + comment.type = "Block"; + } + comment.range = [comment.start, comment.end]; + } + } + + if (node.leadingComments) { + for (var i = 0; i < node.leadingComments.length; i++) { + var comment = node.leadingComments[i]; + if (comment.type === "CommentLine") { + comment.type = "Line"; + } else if (comment.type === "CommentBlock") { + comment.type = "Block"; + } + comment.range = [comment.start, comment.end]; + } + } + + // make '_paths' non-enumerable (babel-eslint #200) + Object.defineProperty(node, "_paths", { value: node._paths, writable: true }); + }, + exit: function (path) { + var node = path.node; + + [ + fixDirectives, + ].forEach(function (fixer) { + fixer(path); + }); + + if (path.isJSXText()) { + node.type = "Literal"; + node.raw = node.value; + } + + if (path.isNumericLiteral() || + path.isStringLiteral()) { + changeToLiteral(node); + } + + if (path.isBooleanLiteral()) { + node.type = "Literal"; + node.raw = String(node.value); + } + + if (path.isNullLiteral()) { + node.type = "Literal"; + node.raw = "null"; + node.value = null; + } + + if (path.isRegExpLiteral()) { + node.type = "Literal"; + node.raw = node.extra.raw; + node.value = {}; + node.regex = { + pattern: node.pattern, + flags: node.flags + }; + delete node.extra; + delete node.pattern; + delete node.flags; + } + + if (path.isObjectProperty()) { + node.type = "Property"; + node.kind = "init"; + } + + if (path.isClassMethod() || path.isObjectMethod()) { + var code = source.slice(node.key.end, node.body.start); + var offset = code.indexOf("("); + + node.value = { + type: "FunctionExpression", + id: node.id, + params: node.params, + body: node.body, + async: node.async, + generator: node.generator, + expression: node.expression, + defaults: [], // basic support - TODO: remove (old esprima) + loc: { + start: { + line: node.key.loc.start.line, + column: node.key.loc.end.column + offset // a[() {] + }, + end: node.body.loc.end + } + }; + // [asdf]() { + node.value.range = [node.key.end + offset, node.body.end]; + + node.value.start = node.value.range && node.value.range[0] || node.value.loc.start.column; + node.value.end = node.value.range && node.value.range[1] || node.value.loc.end.column; + + if (node.returnType) { + node.value.returnType = node.returnType; + } + + if (node.typeParameters) { + node.value.typeParameters = node.typeParameters; + } + + if (path.isClassMethod()) { + node.type = "MethodDefinition"; + } + + if (path.isObjectMethod()) { + node.type = "Property"; + if (node.kind === "method") { + node.kind = "init"; + } + } + + delete node.body; + delete node.id; + delete node.async; + delete node.generator; + delete node.expression; + delete node.params; + delete node.returnType; + delete node.typeParameters; + } + + if (path.isRestProperty() || path.isSpreadProperty()) { + node.type = "Experimental" + node.type; + } + + // flow: prevent "no-undef" + // for "Component" in: "let x: React.Component" + if (path.isQualifiedTypeIdentifier()) { + delete node.id; + } + // for "b" in: "var a: { b: Foo }" + if (path.isObjectTypeProperty()) { + delete node.key; + } + // for "indexer" in: "var a: {[indexer: string]: number}" + if (path.isObjectTypeIndexer()) { + delete node.id; + } + // for "param" in: "var a: { func(param: Foo): Bar };" + if (path.isFunctionTypeParam()) { + delete node.name; + } + + // modules + + if (path.isImportDeclaration()) { + delete node.isType; + } + + if (path.isExportDeclaration()) { + var declar = path.get("declaration"); + if (declar.isClassExpression()) { + node.declaration.type = "ClassDeclaration"; + } else if (declar.isFunctionExpression()) { + node.declaration.type = "FunctionDeclaration"; + } + } + + // remove class property keys (or patch in escope) + if (path.isClassProperty()) { + delete node.key; + } + + // async function as generator + if (path.isFunction()) { + if (node.async) node.generator = true; + } + + // TODO: remove (old esprima) + if (path.isFunction()) { + if (!node.defaults) { + node.defaults = []; + } + } + + // await transform to yield + if (path.isAwaitExpression()) { + node.type = "YieldExpression"; + node.delegate = node.all; + delete node.all; + } + + // template string range fixes + if (path.isTemplateLiteral()) { + node.quasis.forEach(function (q) { + q.range[0] -= 1; + if (q.tail) { + q.range[1] += 1; + } else { + q.range[1] += 2; + } + q.loc.start.column -= 1; + if (q.tail) { + q.loc.end.column += 1; + } else { + q.loc.end.column += 2; + } + }); + } + } +}; + + +function fixDirectives (path) { + if (!(path.isProgram() || path.isFunction())) return; + + var node = path.node; + var directivesContainer = node; + var body = node.body; + + if (node.type !== "Program") { + directivesContainer = body; + body = body.body; + } + + if (!directivesContainer.directives) return; + + directivesContainer.directives.reverse().forEach(function (directive) { + directive.type = "ExpressionStatement"; + directive.expression = directive.value; + delete directive.value; + directive.expression.type = "Literal"; + changeToLiteral(directive.expression); + body.unshift(directive); + }); + delete directivesContainer.directives; +} +// fixDirectives diff --git a/eslint/babel-eslint-parser/babylon-to-espree/toToken.js b/eslint/babel-eslint-parser/babylon-to-espree/toToken.js new file mode 100644 index 000000000000..7e13f28e0c8a --- /dev/null +++ b/eslint/babel-eslint-parser/babylon-to-espree/toToken.js @@ -0,0 +1,60 @@ +module.exports = function (token, tt, source) { + var type = token.type; + token.range = [token.start, token.end]; + + if (type === tt.name) { + token.type = "Identifier"; + } else if (type === tt.semi || type === tt.comma || + type === tt.parenL || type === tt.parenR || + type === tt.braceL || type === tt.braceR || + type === tt.slash || type === tt.dot || + type === tt.bracketL || type === tt.bracketR || + type === tt.ellipsis || type === tt.arrow || + type === tt.star || type === tt.incDec || + type === tt.colon || type === tt.question || + type === tt.template || type === tt.backQuote || + type === tt.dollarBraceL || type === tt.at || + type === tt.logicalOR || type === tt.logicalAND || + type === tt.bitwiseOR || type === tt.bitwiseXOR || + type === tt.bitwiseAND || type === tt.equality || + type === tt.relational || type === tt.bitShift || + type === tt.plusMin || type === tt.modulo || + type === tt.exponent || type === tt.prefix || + type === tt.doubleColon || + type.isAssign) { + token.type = "Punctuator"; + if (!token.value) token.value = type.label; + } else if (type === tt.jsxTagStart) { + token.type = "Punctuator"; + token.value = "<"; + } else if (type === tt.jsxTagEnd) { + token.type = "Punctuator"; + token.value = ">"; + } else if (type === tt.jsxName) { + token.type = "JSXIdentifier"; + } else if (type === tt.jsxText) { + token.type = "JSXText"; + } else if (type.keyword === "null") { + token.type = "Null"; + } else if (type.keyword === "false" || type.keyword === "true") { + token.type = "Boolean"; + } else if (type.keyword) { + token.type = "Keyword"; + } else if (type === tt.num) { + token.type = "Numeric"; + token.value = source.slice(token.start, token.end); + } else if (type === tt.string) { + token.type = "String"; + token.value = source.slice(token.start, token.end); + } else if (type === tt.regexp) { + token.type = "RegularExpression"; + var value = token.value; + token.regex = { + pattern: value.pattern, + flags: value.flags + }; + token.value = "/" + value.pattern + "/" + value.flags; + } + + return token; +}; diff --git a/eslint/babel-eslint-parser/babylon-to-espree/toTokens.js b/eslint/babel-eslint-parser/babylon-to-espree/toTokens.js new file mode 100644 index 000000000000..dab4b21b96c8 --- /dev/null +++ b/eslint/babel-eslint-parser/babylon-to-espree/toTokens.js @@ -0,0 +1,16 @@ +var convertTemplateType = require("./convertTemplateType"); +var toToken = require("./toToken"); + +module.exports = function (tokens, tt, code) { + // transform tokens to type "Template" + convertTemplateType(tokens, tt); + var transformedTokens = tokens.filter(function (token) { + return token.type !== "CommentLine" && token.type !== "CommentBlock"; + }); + + for (var i = 0, l = transformedTokens.length; i < l; i++) { + transformedTokens[i] = toToken(transformedTokens[i], tt, code); + } + + return transformedTokens; +}; diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 47980470f4cb..87180e67e240 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -1,4 +1,4 @@ -var acornToEsprima = require("acorn-to-esprima"); +var babylonToEspree = require("./babylon-to-espree"); var assign = require("lodash.assign"); var pick = require("lodash.pick"); var Module = require("module"); @@ -380,7 +380,9 @@ function monkeypatch() { }; } -exports.parse = function (code) { +exports.parse = function (code, options) { + options = options || {}; + try { monkeypatch(); } catch (err) { @@ -388,12 +390,12 @@ exports.parse = function (code) { process.exit(1); } - return exports.parseNoPatch(code); + return exports.parseNoPatch(code, options); } -exports.parseNoPatch = function (code) { +exports.parseNoPatch = function (code, options) { var opts = { - sourceType: "module", + sourceType: options.sourceType || "module", strictMode: true, allowImportExportEverywhere: false, // consistent with espree allowReturnOutsideFunction: true, @@ -422,7 +424,7 @@ exports.parseNoPatch = function (code) { } catch (err) { if (err instanceof SyntaxError) { err.lineNumber = err.loc.line; - err.column = err.loc.column; + err.column = err.loc.column + 1; // remove trailing "(LINE:COLUMN)" acorn message and add in esprima syntax error message start err.message = "Line " + err.lineNumber + ": " + err.message.replace(/ \((\d+):(\d+)\)$/, ""); @@ -437,27 +439,27 @@ exports.parseNoPatch = function (code) { ast.tokens.pop(); // convert tokens - ast.tokens = acornToEsprima.toTokens(ast.tokens, tt, code); + ast.tokens = babylonToEspree.toTokens(ast.tokens, tt, code); // add comments - acornToEsprima.convertComments(ast.comments); + babylonToEspree.convertComments(ast.comments); // transform esprima and acorn divergent nodes - acornToEsprima.toAST(ast, traverse, code); + babylonToEspree.toAST(ast, traverse, code); // ast.program.tokens = ast.tokens; // ast.program.comments = ast.comments; // ast = ast.program; // remove File - ast.type = 'Program'; + ast.type = "Program"; ast.sourceType = ast.program.sourceType; ast.directives = ast.program.directives; ast.body = ast.program.body; delete ast.program; delete ast._paths; - acornToEsprima.attachComments(ast, ast.comments, ast.tokens); + babylonToEspree.attachComments(ast, ast.comments, ast.tokens); return ast; } diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 5433fbfe9916..28a969a43a7f 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,17 +1,17 @@ { "name": "babel-eslint", "version": "5.0.0", - "description": "", + "description": "Custom parser for ESLint", "main": "index.js", "files": [ - "index.js" + "index.js", + "babylon-to-espree" ], "repository": { "type": "git", "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "acorn-to-esprima": "^2.0.4", "babel-traverse": "^6.0.20", "babel-types": "^6.0.19", "babylon": "^6.0.18", @@ -22,7 +22,8 @@ "bootstrap": "git submodule update --init && cd eslint && npm install", "eslint": "cd eslint && mocha -c tests/lib/rules/*.js -r ../eslint-tester.js", "test": "mocha", - "lint": "./node_modules/eslint/bin/eslint.js ./test index.js acorn-to-esprima.js", + "lint": "./node_modules/eslint/bin/eslint.js index.js babylon-to-espree test", + "fix": "./node_modules/eslint/bin/eslint.js index.js babylon-to-espree test --fix", "preversion": "npm test" }, "author": "Sebastian McKenzie ", @@ -32,8 +33,8 @@ }, "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { - "eslint": "^1.10.2", - "espree": "^2.2.5", + "eslint": "^2.0.0", + "espree": "^3.0.0", "mocha": "^2.3.3" } } diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index dea774eb2efd..a66f1c40cb14 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -32,49 +32,49 @@ function assertImplementsAST(target, source, path) { } } +function lookup(obj, keypath, backwardsDepth) { + if (!keypath) { return obj; } + + return keypath.split(".").slice(0, -1 * backwardsDepth) + .reduce(function (base, segment) { return base && base[segment], obj }); +} + function parseAndAssertSame(code) { var esAST = espree.parse(code, { ecmaFeatures: { - arrowFunctions: true, - binaryLiterals: true, - blockBindings: true, - classes: true, - defaultParams: true, - destructuring: true, - forOf: true, - generators: true, - modules: true, - objectLiteralComputedProperties: true, - objectLiteralDuplicateProperties: true, - objectLiteralShorthandMethods: true, - objectLiteralShorthandProperties: true, - octalLiterals: true, - regexUFlag: true, - regexYFlag: true, - restParams: true, - spread: true, - superInFunctions: true, - templateStrings: true, - unicodeCodePointEscapes: true, - globalReturn: true, - jsx: true, - experimentalObjectRestSpread: true, + // enable JSX parsing + jsx: true, + // enable return in global scope + globalReturn: true, + // enable implied strict mode (if ecmaVersion >= 5) + impliedStrict: true, + // allow experimental object rest/spread + experimentalObjectRestSpread: true }, tokens: true, loc: true, range: true, comment: true, - attachComment: true + attachComment: true, + ecmaVersion: 6, + sourceType: "module" }); var babylonAST = babelEslint.parse(code); try { assertImplementsAST(esAST, babylonAST); } catch(err) { + var traversal = err.message.slice(3, err.message.indexOf(":")); + if (esAST.tokens) { + delete esAST.tokens; + } + if (babylonAST.tokens) { + delete babylonAST.tokens; + } err.message += "\nespree:\n" + - util.inspect(esAST, {depth: err.depth, colors: true}) + + util.inspect(lookup(esAST, traversal, 2), {depth: err.depth, colors: true}) + "\nbabel-eslint:\n" + - util.inspect(babylonAST, {depth: err.depth, colors: true}); + util.inspect(lookup(babylonAST, traversal, 2), {depth: err.depth, colors: true}); throw err; } // assert.equal(esAST, babylonAST); @@ -394,7 +394,7 @@ describe("acorn-to-esprima", function () { it("do not allow import export everywhere", function() { assert.throws(function () { parseAndAssertSame("function F() { import a from \"a\"; }"); - }, /Illegal import declaration/) + }, /SyntaxError: 'import' and 'export' may only appear at the top level/) }); it("return outside function", function () { @@ -406,7 +406,7 @@ describe("acorn-to-esprima", function () { }); it("StringLiteral", function () { - parseAndAssertSame(''); + parseAndAssertSame(""); parseAndAssertSame(""); parseAndAssertSame("a"); }); @@ -443,5 +443,17 @@ describe("acorn-to-esprima", function () { "};" ].join("\n")); }); + + it("RestOperator", function () { + parseAndAssertSame("var { a, ...b } = c"); + parseAndAssertSame("var [ a, ...b ] = c"); + parseAndAssertSame("var a = function (...b) {}"); + }); + + it("SpreadOperator", function () { + parseAndAssertSame("var a = { b, ...c }"); + parseAndAssertSame("var a = [ a, ...b ]"); + parseAndAssertSame("var a = sum(...b)"); + }); }); }); diff --git a/eslint/babel-eslint-parser/test/integration.js b/eslint/babel-eslint-parser/test/integration.js index 5ce7a443fca4..f3f09522e47d 100644 --- a/eslint/babel-eslint-parser/test/integration.js +++ b/eslint/babel-eslint-parser/test/integration.js @@ -13,6 +13,9 @@ var errorLevel = 2; var baseEslintOpts = { parser: require.resolve(".."), + parserOptions: { + sourceType: "script" + } }; /** diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 4e2d1128ea77..0e979df42dab 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -2,43 +2,25 @@ "use strict"; var eslint = require("eslint"); -function verifyAndAssertMessages(code, rules, expectedMessages, features) { - var defaultEcmaFeatures = { - arrowFunctions: true, - binaryLiterals: true, - blockBindings: true, - classes: true, - defaultParams: true, - destructuring: true, - forOf: true, - generators: true, - modules: true, - objectLiteralComputedProperties: true, - objectLiteralDuplicateProperties: true, - objectLiteralShorthandMethods: true, - objectLiteralShorthandProperties: true, - octalLiterals: true, - regexUFlag: true, - regexYFlag: true, - restParams: true, - spread: true, - superInFunctions: true, - templateStrings: true, - unicodeCodePointEscapes: true, - globalReturn: true, - jsx: true, - experimentalObjectRestSpread: true - }; - +function verifyAndAssertMessages(code, rules, expectedMessages, sourceType) { var messages = eslint.linter.verify( code, { parser: require.resolve(".."), rules: rules, env: { - node: true + node: true, + es6: true }, - ecmaFeatures: features || defaultEcmaFeatures + parserOptions: { + ecmaVersion: 6, + ecmaFeatures: { + jsx: true, + experimentalObjectRestSpread: true, + globalReturn: true + }, + sourceType: sourceType || "module" + } } ); @@ -143,7 +125,7 @@ describe("verify", function () { "\"use strict\"; () => 1", { "strict": [1, "global"] }, [], - { modules: false } + "script" ); }); @@ -415,8 +397,8 @@ describe("verify", function () { "var b: T = 1; b;" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, - [ "1:21 \"T\" is defined but never used no-unused-vars", - '2:8 "T" is not defined. no-undef' ] + [ "1:21 'T' is defined but never used no-unused-vars", + "2:8 'T' is not defined. no-undef" ] ); }); @@ -426,7 +408,7 @@ describe("verify", function () { "export class Foo extends Bar {}", ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, - [ '2:30 "T" is not defined. no-undef' ] + [ "2:30 'T' is not defined. no-undef" ] ); }); @@ -1151,7 +1133,7 @@ describe("verify", function () { verifyAndAssertMessages( "var unused;", { "no-unused-vars": 1 }, - [ "1:5 \"unused\" is defined but never used no-unused-vars" ] + [ "1:5 'unused' is defined but never used no-unused-vars" ] ); }); @@ -1175,7 +1157,7 @@ describe("verify", function () { verifyAndAssertMessages( "const {Bacona} = require('baconjs')", { "no-undef": 1, "no-unused-vars": 1 }, - [ "1:8 \"Bacona\" is defined but never used no-unused-vars" ] + [ "1:8 'Bacona' is defined but never used no-unused-vars" ] ); }); @@ -1301,7 +1283,7 @@ describe("verify", function () { "var x = 1;" ].join("\n"), { "no-use-before-define": 1 }, - [ "1:13 \"x\" was used before it was defined no-use-before-define" ] + [ "1:13 'x' was used before it was defined no-use-before-define" ] ) }); @@ -1316,10 +1298,10 @@ describe("verify", function () { it("getter/setter #218", function () { verifyAndAssertMessages([ "class Person {", - "set a (v) { }", + " set a (v) { }", "}" ].join("\n"), - { "space-before-function-paren": 1, "space-before-keywords": 1, "indent": 1 }, + { "space-before-function-paren": 1, "keyword-spacing": [1, {"before": true}], "indent": 1 }, [] ) }); From c28b839c175150861e4b5657ea7e975b88e67765 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 1 Mar 2016 22:37:28 -0500 Subject: [PATCH 261/569] Update README.md --- eslint/babel-eslint-parser/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index 41f349192e1e..74ea5fb67b6b 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -12,6 +12,7 @@ For questions and support please visit the [`#linting`](https://babeljs.slack.co > Note that the `ecmaFeatures` config property may still be required for ESLint to work properly with features not in ECMAScript 5 by default. Examples are `globalReturn` and `modules`) ## Known Issues + Flow: > Check out [eslint-plugin-flow-vars](https://github.com/zertosh/eslint-plugin-flow-vars): An `eslint` plugin that makes flow type annotations global variables and marks declarations as used. Solves the problem of false positives with `no-undef` and `no-unused-vars`. - `no-undef` for global flow types: `ReactElement`, `ReactClass` [#130](https://github.com/babel/babel-eslint/issues/130#issuecomment-111215076) @@ -44,6 +45,8 @@ It just needs to export a `parse` method that takes in a string of code and outp ```sh $ npm install eslint@1.x babel-eslint --save-dev + +$ npm install eslint@2.x babel-eslint@next --save-dev ``` ### Setup From c3915b9798784f74b91e772728bac94e0fcb49f1 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 1 Mar 2016 22:39:34 -0500 Subject: [PATCH 262/569] 6.0.0-beta.1 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 28a969a43a7f..31826ee15864 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "5.0.0", + "version": "6.0.0-beta.1", "description": "Custom parser for ESLint", "main": "index.js", "files": [ From a827ab2d4e4f5d75c6365435fa9eebf71b57c857 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sun, 6 Mar 2016 22:29:51 -0500 Subject: [PATCH 263/569] Merge pull request babel/babel-eslint#269 from babel/eslint-2.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit try catch estraverse-fb since eslint removed it in 2.3.0, temp skip b… --- eslint/babel-eslint-parser/index.js | 12 ++++++++---- eslint/babel-eslint-parser/package.json | 2 +- eslint/babel-eslint-parser/test/non-regression.js | 4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 87180e67e240..58d31147532b 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -55,10 +55,12 @@ function monkeypatch() { estraverses.push(estraverse); assign(estraverse.VisitorKeys, t.VISITOR_KEYS); - // monkeypatch estraverse-fb - var estraverseFb = eslintMod.require("estraverse-fb"); - estraverses.push(estraverseFb); - assign(estraverseFb.VisitorKeys, t.VISITOR_KEYS); + // monkeypatch estraverse-fb (only for eslint < 2.3.0) + try { + var estraverseFb = eslintMod.require("estraverse-fb"); + estraverses.push(estraverseFb); + assign(estraverseFb.VisitorKeys, t.VISITOR_KEYS); + } catch (err) {} // ESLint v1.9.0 uses estraverse directly to work around https://github.com/npm/npm/issues/9663 var estraverseOfEslint = eslintMod.require("estraverse"); @@ -380,6 +382,8 @@ function monkeypatch() { }; } +exports.VisitorKeys = t.VISITOR_KEYS; + exports.parse = function (code, options) { options = options || {}; diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 31826ee15864..94bed305f96a 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -33,7 +33,7 @@ }, "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { - "eslint": "^2.0.0", + "eslint": "^2.3.0", "espree": "^3.0.0", "mocha": "^2.3.3" } diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 0e979df42dab..11be9483d1f9 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -391,7 +391,7 @@ describe("verify", function () { ); }); - it("polymorphpic/generic types - outside of fn scope #123", function () { + it.skip("polymorphpic/generic types - outside of fn scope #123", function () { verifyAndAssertMessages([ "export function foo(value) { value; };", "var b: T = 1; b;" @@ -402,7 +402,7 @@ describe("verify", function () { ); }); - it("polymorphpic/generic types - extending unknown #123", function () { + it.skip("polymorphpic/generic types - extending unknown #123", function () { verifyAndAssertMessages([ "import Bar from 'bar';", "export class Foo extends Bar {}", From 4a8c6d8a8ba7ea4705c3683d9e9358046aac4789 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 7 Mar 2016 08:31:48 -0500 Subject: [PATCH 264/569] Merge pull request babel/babel-eslint#270 from danez/cleanup-monkey remove monkey-patching of patternVisitor as unused --- eslint/babel-eslint-parser/index.js | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 58d31147532b..67ec4e5337b4 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -92,22 +92,6 @@ function monkeypatch() { referencer = referencer.default; } - // monkeypatch escope/pattern-visitor - var patternVisitorLoc; - var patternVisitorMod; - var patternVisitor; - try { - patternVisitorLoc = Module._resolveFilename("./pattern-visitor", escopeMod); - patternVisitorMod = createModule(patternVisitorLoc); - patternVisitor = require(patternVisitorLoc); - if (patternVisitor.__esModule) { - patternVisitor = patternVisitor.default; - } - } catch (err) { - // When eslint uses old escope, we cannot find pattern visitor. - // Fallback to the old way. - } - // reference Definition var definitionLoc; try { @@ -304,12 +288,6 @@ function monkeypatch() { } }; - if (patternVisitor) { - patternVisitor.prototype.SpreadProperty = function (node) { - this.visit(node.argument); - }; - } - // visit flow type in VariableDeclaration var variableDeclaration = referencer.prototype.VariableDeclaration; referencer.prototype.VariableDeclaration = function(node) { From e886404171198436e99db8252b089fad7aa4347f Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 7 Mar 2016 12:34:10 -0500 Subject: [PATCH 265/569] 6.0.0-beta.2 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 94bed305f96a..b2c264481f80 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "6.0.0-beta.1", + "version": "6.0.0-beta.2", "description": "Custom parser for ESLint", "main": "index.js", "files": [ From 6e3aa3357ccffcc063a873b85deb8ab099f1d2a3 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 7 Mar 2016 23:09:33 -0500 Subject: [PATCH 266/569] Merge pull request babel/babel-eslint#272 from kaicataldo/fixes259 Update readme to fix npm registry escaped HTML (fixes babel/babel-eslint#259) --- eslint/babel-eslint-parser/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index 74ea5fb67b6b..9ebee0f461e8 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -1,4 +1,5 @@ -# babel-eslint [![Build Status][travis-image]][travis-url] +# babel-eslint +[![Build Status][travis-image]][travis-url] **babel-eslint** allows you to lint **ALL** valid Babel code with the fantastic [ESLint](https://github.com/eslint/eslint). From 217f83fd5699716c885f5daff54d9788a82bf4c2 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 7 Mar 2016 23:09:46 -0500 Subject: [PATCH 267/569] Merge pull request babel/babel-eslint#271 from danez/fix-use-before-define Remove visiting of properties left of spread, fixes babel/babel-eslint#249. --- eslint/babel-eslint-parser/index.js | 12 ------- .../test/non-regression.js | 35 ++++++++++++++++--- 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 67ec4e5337b4..0cabbb85c77d 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -298,18 +298,6 @@ function monkeypatch() { if (typeAnnotation) { checkIdentifierOrVisit.call(this, typeAnnotation); } - if (id.type === "ObjectPattern") { - // check if object destructuring has a spread - var hasSpread = id.properties.filter(function(p) { - return p._babelType === "SpreadProperty" || p._babelType === "RestProperty"; - }); - // visit properties if so - if (hasSpread.length > 0) { - for (var j = 0; j < id.properties.length; j++) { - this.visit(id.properties[j]); - } - } - } } } variableDeclaration.call(this, node); diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 11be9483d1f9..e34e9f506b80 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1137,18 +1137,45 @@ describe("verify", function () { ); }); - it("visits excluded properties left of spread #95", function () { + // This two tests are disabled, as the feature to visit properties when + // there is a spread/rest operator has been removed as it caused problems + // with other rules #249 + it.skip("visits excluded properties left of spread #95", function () { verifyAndAssertMessages( "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", - { "no-undef": 1, "no-unused-vars": 1, "no-redeclare": 1 }, + { "no-unused-vars": 1 }, [] ); }); - it("visits excluded properties left of spread #210", function () { + it.skip("visits excluded properties left of spread #210", function () { verifyAndAssertMessages( "const props = { yo: 'yo' }; const { ...otherProps } = props;", - { "no-undef": 1, "no-unused-vars": 1, "no-redeclare": 1 }, + { "no-unused-vars": 1 }, + [] + ); + }); + + it("does not mark spread variables false-positive", function () { + verifyAndAssertMessages( + "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", + { "no-undef": 1, "no-redeclare": 1 }, + [] + ); + }); + + it("does not mark spread variables false-positive", function () { + verifyAndAssertMessages( + "const props = { yo: 'yo' }; const { ...otherProps } = props;", + { "no-undef": 1, "no-redeclare": 1 }, + [] + ); + }); + + it("does not mark spread variables as use-before-define #249", function () { + verifyAndAssertMessages( + "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", + { "no-use-before-define": 1 }, [] ); }); From d75bd7b82c6664a5ac80f57c761573767612ce23 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 7 Mar 2016 23:13:50 -0500 Subject: [PATCH 268/569] 6.0.0-beta.3 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index b2c264481f80..505beb3656b8 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "6.0.0-beta.2", + "version": "6.0.0-beta.3", "description": "Custom parser for ESLint", "main": "index.js", "files": [ From 7fbf6111e3f342f7765e78ccbb9d31faf8289d83 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 8 Mar 2016 10:57:22 -0500 Subject: [PATCH 269/569] just throw an error right now instead of it silently working but with bugs --- eslint/babel-eslint-parser/index.js | 4 +++- eslint/babel-eslint-parser/package.json | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 0cabbb85c77d..2cf21cb02151 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -45,7 +45,9 @@ function monkeypatch() { try { var esrecurseLoc = Module._resolveFilename("esrecurse", eslintMod); estraverseRelative = createModule(esrecurseLoc); - } catch (err) {} + } catch (err) { + throw new Error("babel-eslint isn't currently compatible with ESLint 2.3.x. The recommendation is to pin to ESLint 2.2.x right now."); + } // contains all the instances of estraverse so we can modify them if necessary var estraverses = []; diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 505beb3656b8..a62420bdc6cf 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -33,7 +33,7 @@ }, "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { - "eslint": "^2.3.0", + "eslint": "~2.2.0", "espree": "^3.0.0", "mocha": "^2.3.3" } From c8ff9bad937fb484418e021d5faf561da7cc52b2 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 8 Mar 2016 11:04:19 -0500 Subject: [PATCH 270/569] 6.0.0-beta.4 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index a62420bdc6cf..c66d6f9a157c 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "6.0.0-beta.3", + "version": "6.0.0-beta.4", "description": "Custom parser for ESLint", "main": "index.js", "files": [ From b42d59b29cb454bf28b17d5a37c743107599b3e8 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 8 Mar 2016 11:06:47 -0500 Subject: [PATCH 271/569] errror on estraverse-fb.. --- eslint/babel-eslint-parser/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 2cf21cb02151..76073ea32567 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -45,9 +45,7 @@ function monkeypatch() { try { var esrecurseLoc = Module._resolveFilename("esrecurse", eslintMod); estraverseRelative = createModule(esrecurseLoc); - } catch (err) { - throw new Error("babel-eslint isn't currently compatible with ESLint 2.3.x. The recommendation is to pin to ESLint 2.2.x right now."); - } + } catch (err) {} // contains all the instances of estraverse so we can modify them if necessary var estraverses = []; @@ -62,7 +60,9 @@ function monkeypatch() { var estraverseFb = eslintMod.require("estraverse-fb"); estraverses.push(estraverseFb); assign(estraverseFb.VisitorKeys, t.VISITOR_KEYS); - } catch (err) {} + } catch (err) { + throw new Error("babel-eslint isn't currently compatible with ESLint 2.3.x. The recommendation is to pin to ESLint 2.2.x right now."); + } // ESLint v1.9.0 uses estraverse directly to work around https://github.com/npm/npm/issues/9663 var estraverseOfEslint = eslintMod.require("estraverse"); From 2c6b323a620b13049a60d5f39d61fbdc3d9b2835 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 8 Mar 2016 11:06:58 -0500 Subject: [PATCH 272/569] 6.0.0-beta.5 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index c66d6f9a157c..a0ea3e2ea166 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "6.0.0-beta.4", + "version": "6.0.0-beta.5", "description": "Custom parser for ESLint", "main": "index.js", "files": [ From 080f0c7b22335002f53da33fa77a7b5fcf1358d4 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 14 Mar 2016 08:36:44 -0400 Subject: [PATCH 273/569] Merge pull request babel/babel-eslint#273 from mysticatea/fix-monkeypatching-for-2.3.0 Fix: Remove throwing an error when estraverse-fb has not found. --- eslint/babel-eslint-parser/index.js | 5 ++--- eslint/babel-eslint-parser/package.json | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 76073ea32567..c9e7bc4df94b 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -61,7 +61,7 @@ function monkeypatch() { estraverses.push(estraverseFb); assign(estraverseFb.VisitorKeys, t.VISITOR_KEYS); } catch (err) { - throw new Error("babel-eslint isn't currently compatible with ESLint 2.3.x. The recommendation is to pin to ESLint 2.2.x right now."); + // Ignore: ESLint v2.3.0 does not have estraverse-fb } // ESLint v1.9.0 uses estraverse directly to work around https://github.com/npm/npm/issues/9663 @@ -77,6 +77,7 @@ function monkeypatch() { escope.analyze = function (ast, opts) { opts.ecmaVersion = 6; opts.sourceType = "module"; + var results = analyze.call(this, ast, opts); return results; }; @@ -350,8 +351,6 @@ function monkeypatch() { }; } -exports.VisitorKeys = t.VISITOR_KEYS; - exports.parse = function (code, options) { options = options || {}; diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index a0ea3e2ea166..e3642d0be3a4 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -33,7 +33,7 @@ }, "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { - "eslint": "~2.2.0", + "eslint": "^2.4.0", "espree": "^3.0.0", "mocha": "^2.3.3" } From c6a69b763fac400fbf90d94942eab7d81a075988 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 14 Mar 2016 08:37:34 -0400 Subject: [PATCH 274/569] 6.0.0-beta.6 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index e3642d0be3a4..69be55a8b7e4 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "6.0.0-beta.5", + "version": "6.0.0-beta.6", "description": "Custom parser for ESLint", "main": "index.js", "files": [ From c6401945d9833853812a26f1d8eb932b7e5c8aa4 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 25 Mar 2016 23:51:29 -0400 Subject: [PATCH 275/569] 6.0.0 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 69be55a8b7e4..de25c28ce281 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "6.0.0-beta.6", + "version": "6.0.0", "description": "Custom parser for ESLint", "main": "index.js", "files": [ From cccce9d0abf20d85e66ac49213ffc588a1c9fc13 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 28 Mar 2016 18:23:37 -0400 Subject: [PATCH 276/569] update install instructions for eslint 1 and 2 --- eslint/babel-eslint-parser/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index 9ebee0f461e8..d57329ae34c9 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -45,9 +45,9 @@ It just needs to export a `parse` method that takes in a string of code and outp ### Install ```sh -$ npm install eslint@1.x babel-eslint --save-dev +$ npm install eslint@1.x babel-eslint@5 --save-dev -$ npm install eslint@2.x babel-eslint@next --save-dev +$ npm install eslint@2.x babel-eslint@6 --save-dev ``` ### Setup From 1fe0d4a94b0c06cdb3e9f38a0fa07650a1f877eb Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 31 Mar 2016 16:49:31 -0400 Subject: [PATCH 277/569] Merge pull request babel/babel-eslint#282 from josh/no-implicit-globals-regression Fix processing sourceType: script --- eslint/babel-eslint-parser/index.js | 1 - .../test/non-regression.js | 69 ++++++++++++++----- 2 files changed, 50 insertions(+), 20 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index c9e7bc4df94b..b42c3408eeb8 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -76,7 +76,6 @@ function monkeypatch() { var analyze = escope.analyze; escope.analyze = function (ast, opts) { opts.ecmaVersion = 6; - opts.sourceType = "module"; var results = analyze.call(this, ast, opts); return results; diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index e34e9f506b80..b87ae83caa41 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -2,27 +2,32 @@ "use strict"; var eslint = require("eslint"); -function verifyAndAssertMessages(code, rules, expectedMessages, sourceType) { - var messages = eslint.linter.verify( - code, - { - parser: require.resolve(".."), - rules: rules, - env: { - node: true, - es6: true +function verifyAndAssertMessages(code, rules, expectedMessages, sourceType, overrideConfig) { + var config = { + parser: require.resolve(".."), + rules: rules, + env: { + node: true, + es6: true + }, + parserOptions: { + ecmaVersion: 6, + ecmaFeatures: { + jsx: true, + experimentalObjectRestSpread: true, + globalReturn: true }, - parserOptions: { - ecmaVersion: 6, - ecmaFeatures: { - jsx: true, - experimentalObjectRestSpread: true, - globalReturn: true - }, - sourceType: sourceType || "module" - } + sourceType: sourceType || "module" } - ); + } + + if (overrideConfig) { + for (var key in overrideConfig) { + config[key] = overrideConfig[key] + } + } + + var messages = eslint.linter.verify(code, config); if (messages.length !== expectedMessages.length) { throw new Error("Expected " + expectedMessages.length + " message(s), got " + messages.length + " " + JSON.stringify(messages)); @@ -1137,6 +1142,32 @@ describe("verify", function () { ); }); + it("no-implicit-globals in script", function () { + verifyAndAssertMessages( + "var leakedGlobal = 1;", + { "no-implicit-globals": 1 }, + [ "1:5 Implicit global variable, assign as global property instead. no-implicit-globals" ], + "script", + { + env: {}, + parserOptions: { ecmaVersion: 6, sourceType: "script" } + } + ); + }); + + it("no-implicit-globals in module", function () { + verifyAndAssertMessages( + "var leakedGlobal = 1;", + { "no-implicit-globals": 1 }, + [], + "module", + { + env: {}, + parserOptions: { ecmaVersion: 6, sourceType: "module" } + } + ); + }); + // This two tests are disabled, as the feature to visit properties when // there is a spread/rest operator has been removed as it caused problems // with other rules #249 From 3c9ef8ec7e42784d918857fc5b1bd5700e3707ba Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 31 Mar 2016 19:09:30 -0400 Subject: [PATCH 278/569] Merge pull request babel/babel-eslint#285 from josh/revert-282-no-implicit-globals-regression Revert "Fix processing sourceType: script" --- eslint/babel-eslint-parser/index.js | 1 + .../test/non-regression.js | 69 +++++-------------- 2 files changed, 20 insertions(+), 50 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index b42c3408eeb8..c9e7bc4df94b 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -76,6 +76,7 @@ function monkeypatch() { var analyze = escope.analyze; escope.analyze = function (ast, opts) { opts.ecmaVersion = 6; + opts.sourceType = "module"; var results = analyze.call(this, ast, opts); return results; diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index b87ae83caa41..e34e9f506b80 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -2,32 +2,27 @@ "use strict"; var eslint = require("eslint"); -function verifyAndAssertMessages(code, rules, expectedMessages, sourceType, overrideConfig) { - var config = { - parser: require.resolve(".."), - rules: rules, - env: { - node: true, - es6: true - }, - parserOptions: { - ecmaVersion: 6, - ecmaFeatures: { - jsx: true, - experimentalObjectRestSpread: true, - globalReturn: true +function verifyAndAssertMessages(code, rules, expectedMessages, sourceType) { + var messages = eslint.linter.verify( + code, + { + parser: require.resolve(".."), + rules: rules, + env: { + node: true, + es6: true }, - sourceType: sourceType || "module" - } - } - - if (overrideConfig) { - for (var key in overrideConfig) { - config[key] = overrideConfig[key] + parserOptions: { + ecmaVersion: 6, + ecmaFeatures: { + jsx: true, + experimentalObjectRestSpread: true, + globalReturn: true + }, + sourceType: sourceType || "module" + } } - } - - var messages = eslint.linter.verify(code, config); + ); if (messages.length !== expectedMessages.length) { throw new Error("Expected " + expectedMessages.length + " message(s), got " + messages.length + " " + JSON.stringify(messages)); @@ -1142,32 +1137,6 @@ describe("verify", function () { ); }); - it("no-implicit-globals in script", function () { - verifyAndAssertMessages( - "var leakedGlobal = 1;", - { "no-implicit-globals": 1 }, - [ "1:5 Implicit global variable, assign as global property instead. no-implicit-globals" ], - "script", - { - env: {}, - parserOptions: { ecmaVersion: 6, sourceType: "script" } - } - ); - }); - - it("no-implicit-globals in module", function () { - verifyAndAssertMessages( - "var leakedGlobal = 1;", - { "no-implicit-globals": 1 }, - [], - "module", - { - env: {}, - parserOptions: { ecmaVersion: 6, sourceType: "module" } - } - ); - }); - // This two tests are disabled, as the feature to visit properties when // there is a spread/rest operator has been removed as it caused problems // with other rules #249 From 8a089b65fb4ffd076f85c0bd31ae767db8bfb966 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 31 Mar 2016 19:14:07 -0400 Subject: [PATCH 279/569] 6.0.2 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index de25c28ce281..d6bd28bbf449 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "6.0.0", + "version": "6.0.2", "description": "Custom parser for ESLint", "main": "index.js", "files": [ From 44ff3603796a9e6d558ea1c365cb0a5a3d37eb9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ruci=C5=84ski?= Date: Mon, 18 Apr 2016 03:59:08 +0200 Subject: [PATCH 280/569] Make npm scripts work on Windows too. (babel/babel-eslint#295) --- eslint/babel-eslint-parser/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index d6bd28bbf449..214d13412f76 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -22,8 +22,8 @@ "bootstrap": "git submodule update --init && cd eslint && npm install", "eslint": "cd eslint && mocha -c tests/lib/rules/*.js -r ../eslint-tester.js", "test": "mocha", - "lint": "./node_modules/eslint/bin/eslint.js index.js babylon-to-espree test", - "fix": "./node_modules/eslint/bin/eslint.js index.js babylon-to-espree test --fix", + "lint": "node node_modules/eslint/bin/eslint.js index.js babylon-to-espree test", + "fix": "node node_modules/eslint/bin/eslint.js index.js babylon-to-espree test --fix", "preversion": "npm test" }, "author": "Sebastian McKenzie ", From 149dd082f349a92f91224df2716d18798f5077c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ruci=C5=84ski?= Date: Mon, 18 Apr 2016 04:01:15 +0200 Subject: [PATCH 281/569] Add root: true to eslint config. (babel/babel-eslint#294) This prevents taking user's eslint config files that are higher in the directory structure into consideration. --- eslint/babel-eslint-parser/.eslintrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/.eslintrc b/eslint/babel-eslint-parser/.eslintrc index 63b343642b89..57a95f9d7e45 100644 --- a/eslint/babel-eslint-parser/.eslintrc +++ b/eslint/babel-eslint-parser/.eslintrc @@ -1,4 +1,5 @@ { + "root": true, "rules": { "strict": 0, "no-underscore-dangle": 0, @@ -24,4 +25,4 @@ "node": true, "mocha": true } -} \ No newline at end of file +} From fd36e3cf8d23879cad9be02f8523743552f69525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ruci=C5=84ski?= Date: Wed, 20 Apr 2016 02:55:24 +0200 Subject: [PATCH 282/569] Declare eslint call more simply in the scripts. (babel/babel-eslint#297) --- eslint/babel-eslint-parser/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 214d13412f76..856e93aeaded 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -22,8 +22,8 @@ "bootstrap": "git submodule update --init && cd eslint && npm install", "eslint": "cd eslint && mocha -c tests/lib/rules/*.js -r ../eslint-tester.js", "test": "mocha", - "lint": "node node_modules/eslint/bin/eslint.js index.js babylon-to-espree test", - "fix": "node node_modules/eslint/bin/eslint.js index.js babylon-to-espree test --fix", + "lint": "eslint index.js babylon-to-espree test", + "fix": "eslint index.js babylon-to-espree test --fix", "preversion": "npm test" }, "author": "Sebastian McKenzie ", From cf456bfe4a2e1a76a328637166c3c1e51f1663ea Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Wed, 20 Apr 2016 02:56:15 +0200 Subject: [PATCH 283/569] Fix escope to take sourceType and ecmaVersion from options (babel/babel-eslint#288) escope was hardcoded to sourcetype: "module" and ecmaVersion: "6" This changes it to take the configuration from the eslint options and still defaulting to "module" and "6". This is done by having to global variables, as monkeypatch is only triggered once. To fix scoping issues, the same logic as in eslint is applied. It disables the nodejs scope if the sourceType is module. --- eslint/babel-eslint-parser/index.js | 17 ++- .../test/non-regression.js | 104 ++++++++++++++---- 2 files changed, 99 insertions(+), 22 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index c9e7bc4df94b..70980797b27e 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -10,6 +10,7 @@ var traverse = require("babel-traverse").default; var estraverse; var hasPatched = false; +var eslintOptions = {}; function createModule(filename) { var mod = new Module(filename); @@ -75,8 +76,11 @@ function monkeypatch() { var escope = require(escopeLoc); var analyze = escope.analyze; escope.analyze = function (ast, opts) { - opts.ecmaVersion = 6; - opts.sourceType = "module"; + opts.ecmaVersion = eslintOptions.ecmaVersion; + opts.sourceType = eslintOptions.sourceType; + if (eslintOptions.globalReturn !== undefined) { + opts.nodejsScope = eslintOptions.globalReturn; + } var results = analyze.call(this, ast, opts); return results; @@ -353,6 +357,13 @@ function monkeypatch() { exports.parse = function (code, options) { options = options || {}; + eslintOptions.ecmaVersion = options.ecmaVersion = options.ecmaVersion || 6; + eslintOptions.sourceType = options.sourceType = options.sourceType || "module"; + if (options.sourceType === "module") { + eslintOptions.globalReturn = false; + } else { + delete eslintOptions.globalReturn; + } try { monkeypatch(); @@ -366,7 +377,7 @@ exports.parse = function (code, options) { exports.parseNoPatch = function (code, options) { var opts = { - sourceType: options.sourceType || "module", + sourceType: options.sourceType, strictMode: true, allowImportExportEverywhere: false, // consistent with espree allowReturnOutsideFunction: true, diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index e34e9f506b80..f88ba58cef15 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -2,27 +2,32 @@ "use strict"; var eslint = require("eslint"); -function verifyAndAssertMessages(code, rules, expectedMessages, sourceType) { - var messages = eslint.linter.verify( - code, - { - parser: require.resolve(".."), - rules: rules, - env: { - node: true, - es6: true +function verifyAndAssertMessages(code, rules, expectedMessages, sourceType, overrideConfig) { + var config = { + parser: require.resolve(".."), + rules: rules, + env: { + node: true, + es6: true + }, + parserOptions: { + ecmaVersion: 6, + ecmaFeatures: { + jsx: true, + experimentalObjectRestSpread: true, + globalReturn: true }, - parserOptions: { - ecmaVersion: 6, - ecmaFeatures: { - jsx: true, - experimentalObjectRestSpread: true, - globalReturn: true - }, - sourceType: sourceType || "module" - } + sourceType: sourceType + } + }; + + if (overrideConfig) { + for (var key in overrideConfig) { + config[key] = overrideConfig[key] } - ); + } + + var messages = eslint.linter.verify(code, config); if (messages.length !== expectedMessages.length) { throw new Error("Expected " + expectedMessages.length + " message(s), got " + messages.length + " " + JSON.stringify(messages)); @@ -1362,6 +1367,67 @@ describe("verify", function () { ); }); + it("correctly detects redeclares if in script mode #217", function () { + verifyAndAssertMessages([ + "var a = 321;", + "var a = 123;", + ].join("\n"), + { "no-redeclare": 1 }, + [ "2:5 'a' is already defined no-redeclare" ], + "script" + ); + }); + + it("correctly detects redeclares if in module mode #217", function () { + verifyAndAssertMessages([ + "var a = 321;", + "var a = 123;", + ].join("\n"), + { "no-redeclare": 1 }, + [ "2:5 'a' is already defined no-redeclare" ], + "module" + ); + }); + + it("no-implicit-globals in script", function () { + verifyAndAssertMessages( + "var leakedGlobal = 1;", + { "no-implicit-globals": 1 }, + [ "1:5 Implicit global variable, assign as global property instead. no-implicit-globals" ], + "script", + { + env: {}, + parserOptions: { ecmaVersion: 6, sourceType: "script" } + } + ); + }); + + it("no-implicit-globals in module", function () { + verifyAndAssertMessages( + "var leakedGlobal = 1;", + { "no-implicit-globals": 1 }, + [], + "module", + { + env: {}, + parserOptions: { ecmaVersion: 6, sourceType: "module" } + } + ); + }); + + it("no-implicit-globals in default", function () { + verifyAndAssertMessages( + "var leakedGlobal = 1;", + { "no-implicit-globals": 1 }, + [], + null, + { + env: {}, + parserOptions: { ecmaVersion: 6 } + } + ); + }); + // it("regex with es6 unicodeCodePointEscapes", function () { // verifyAndAssertMessages( // "string.replace(/[\u{0000A0}-\u{10FFFF}<>\&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`);", From cbc0475634a4c91ba18a6b2c87182ab7efea7eb5 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Mon, 25 Apr 2016 01:14:39 +0200 Subject: [PATCH 284/569] Update lodash and replace pick by pickBy (babel/babel-eslint#301) --- eslint/babel-eslint-parser/index.js | 2 +- eslint/babel-eslint-parser/package.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 70980797b27e..98d0b18c9d67 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -1,6 +1,6 @@ var babylonToEspree = require("./babylon-to-espree"); var assign = require("lodash.assign"); -var pick = require("lodash.pick"); +var pick = require("lodash.pickby"); var Module = require("module"); var path = require("path"); var parse = require("babylon").parse; diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 856e93aeaded..92705bd7f948 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -15,8 +15,8 @@ "babel-traverse": "^6.0.20", "babel-types": "^6.0.19", "babylon": "^6.0.18", - "lodash.assign": "^3.2.0", - "lodash.pick": "^3.1.0" + "lodash.assign": "^4.0.0", + "lodash.pickby": "^4.0.0" }, "scripts": { "bootstrap": "git submodule update --init && cd eslint && npm install", From 0ccbceb9e86b2008b3c4d7f744050f7a10aed00d Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Mon, 25 Apr 2016 15:41:43 +0200 Subject: [PATCH 285/569] Ensure strictmode is enabled/disabled when changing sourceType (babel/babel-eslint#302) --- .../babel-eslint-parser/test/non-regression.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index f88ba58cef15..593cc49239c4 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1428,6 +1428,23 @@ describe("verify", function () { ); }); + it("with does not crash parsing in script mode (strict off) #171", function () { + verifyAndAssertMessages( + "with (arguments) { length; }", + {}, + [], + "script" + ); + }); + + it("with does crash parsing in module mode (strict on) #171", function () { + verifyAndAssertMessages( + "with (arguments) { length; }", + {}, + [ "1:1 Parsing error: 'with' in strict mode" ] + ); + }); + // it("regex with es6 unicodeCodePointEscapes", function () { // verifyAndAssertMessages( // "string.replace(/[\u{0000A0}-\u{10FFFF}<>\&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`);", From cfd35799da208aa781645e620176b7691ca42d19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ruci=C5=84ski?= Date: Mon, 25 Apr 2016 23:51:43 +0200 Subject: [PATCH 286/569] Fix parent not being set for decorator nodes. (babel/babel-eslint#296) --- eslint/babel-eslint-parser/index.js | 5 +++++ eslint/babel-eslint-parser/test/non-regression.js | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 98d0b18c9d67..46a196e87df9 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -72,6 +72,11 @@ function monkeypatch() { assign(estraverseOfEslint.VisitorKeys, t.VISITOR_KEYS); } + estraverses.forEach(function (estraverse) { + estraverse.VisitorKeys.MethodDefinition.push("decorators"); + estraverse.VisitorKeys.Property.push("decorators"); + }); + // monkeypatch escope var escope = require(escopeLoc); var analyze = escope.analyze; diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 593cc49239c4..9f1e4d9deaf5 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1048,6 +1048,7 @@ describe("verify", function () { [ "import classDeclaration from 'decorator';", "import decoratorParameter from 'decorator';", + "@classDeclaration((parameter) => parameter)", "@classDeclaration(decoratorParameter)", "@classDeclaration", "export class TextareaAutosize {}" @@ -1063,6 +1064,7 @@ describe("verify", function () { "import classMethodDeclarationA from 'decorator';", "import decoratorParameter from 'decorator';", "export class TextareaAutosize {", + "@classMethodDeclarationA((parameter) => parameter)", "@classMethodDeclarationA(decoratorParameter)", "@classMethodDeclarationA", "methodDeclaration(e) {", @@ -1081,9 +1083,11 @@ describe("verify", function () { "import classMethodDeclarationA from 'decorator';", "import decoratorParameter from 'decorator';", "export class TextareaAutosize {", + "@classMethodDeclarationA((parameter) => parameter)", "@classMethodDeclarationA(decoratorParameter)", "@classMethodDeclarationA", "get bar() { }", + "@classMethodDeclarationA((parameter) => parameter)", "@classMethodDeclarationA(decoratorParameter)", "@classMethodDeclarationA", "set bar(val) { val; }", @@ -1100,6 +1104,7 @@ describe("verify", function () { "import classMethodDeclarationA from 'decorator';", "import decoratorParameter from 'decorator';", "var obj = {", + "@classMethodDeclarationA((parameter) => parameter)", "@classMethodDeclarationA(decoratorParameter)", "@classMethodDeclarationA", "methodDeclaration(e) {", @@ -1119,9 +1124,11 @@ describe("verify", function () { "import classMethodDeclarationA from 'decorator';", "import decoratorParameter from 'decorator';", "var obj = {", + "@classMethodDeclarationA((parameter) => parameter)", "@classMethodDeclarationA(decoratorParameter)", "@classMethodDeclarationA", "get bar() { },", + "@classMethodDeclarationA((parameter) => parameter)", "@classMethodDeclarationA(decoratorParameter)", "@classMethodDeclarationA", "set bar(val) { val; }", From 161edcca4834c0277b79c62f073844da12c6146a Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 25 Apr 2016 17:55:19 -0400 Subject: [PATCH 287/569] 6.0.4 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 92705bd7f948..81429d0d27b6 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "6.0.2", + "version": "6.0.4", "description": "Custom parser for ESLint", "main": "index.js", "files": [ From a2f345b24b5ac01e971b7267086efa0afaa8d77b Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 25 Apr 2016 18:00:58 -0400 Subject: [PATCH 288/569] add changelog command --- eslint/babel-eslint-parser/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 81429d0d27b6..2654996cc2f0 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -24,7 +24,8 @@ "test": "mocha", "lint": "eslint index.js babylon-to-espree test", "fix": "eslint index.js babylon-to-espree test --fix", - "preversion": "npm test" + "preversion": "npm test", + "changelog": "git log `git describe --tags --abbrev=0`..HEAD --pretty=format:' * %s (%an)' | grep -v 'Merge pull request'" }, "author": "Sebastian McKenzie ", "license": "MIT", From 872449d6fc3c8515490e5499b5e68db5b1d98cec Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Tue, 26 Apr 2016 18:11:33 +0200 Subject: [PATCH 289/569] Add configuration section to README (babel/babel-eslint#303) --- eslint/babel-eslint-parser/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index d57329ae34c9..627e1554fd9c 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -65,6 +65,21 @@ $ npm install eslint@2.x babel-eslint@6 --save-dev Check out the [ESLint docs](http://eslint.org/docs/rules/) for all possible rules. +### Configuration + +`sourceType` can be set to `'module'`(default) or `'script'` if your code isn't using ECMAScript modules. + +**.eslintrc** + +```json +{ + "parser": "babel-eslint", + "parserOptions": { + "sourceType": "module" + } +} +``` + ### Run ```sh From 2b66040f0dd82a78bf1f0ec08650743a637075d0 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Fri, 29 Apr 2016 23:07:02 +0200 Subject: [PATCH 290/569] Add tests for two issues and rename test suite (babel/babel-eslint#304) --- .../babel-eslint-parser/test/babel-eslint.js | 2 +- .../test/non-regression.js | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index a66f1c40cb14..76005da1377f 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -80,7 +80,7 @@ function parseAndAssertSame(code) { // assert.equal(esAST, babylonAST); } -describe("acorn-to-esprima", function () { +describe("babylon-to-esprima", function () { describe("templates", function () { it("empty template string", function () { parseAndAssertSame("``"); diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 9f1e4d9deaf5..992667a3df75 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1452,6 +1452,26 @@ describe("verify", function () { ); }); + it("new.target is not reported as undef #235", function () { + verifyAndAssertMessages( + "function foo () { return new.target }", + { "no-undef": 1 }, + [] + ); + }); + + it("decorator does not create TypeError #229", function () { + verifyAndAssertMessages([ + "class A {", + " @test", + " f() {}", + "}" + ].join("\n"), + { "no-undef": 1 }, + [ "2:4 'test' is not defined. no-undef"] + ); + }); + // it("regex with es6 unicodeCodePointEscapes", function () { // verifyAndAssertMessages( // "string.replace(/[\u{0000A0}-\u{10FFFF}<>\&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`);", From 81ce743986caa6daabac184f3c3c06828820ec69 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Fri, 29 Apr 2016 23:22:40 +0200 Subject: [PATCH 291/569] Add node 6 to travis tests. --- eslint/babel-eslint-parser/.travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint/babel-eslint-parser/.travis.yml b/eslint/babel-eslint-parser/.travis.yml index ed629d9af263..f8062f9e28b7 100644 --- a/eslint/babel-eslint-parser/.travis.yml +++ b/eslint/babel-eslint-parser/.travis.yml @@ -8,3 +8,4 @@ node_js: - "0.12" - "4" - "5" + - "6" From 97af2b0b62577cf684f2e1a625c746d1aa69a3da Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Fri, 29 Apr 2016 23:23:13 +0200 Subject: [PATCH 292/569] Add regression test for babel/babel-eslint#223 (babel/babel-eslint#305) --- eslint/babel-eslint-parser/test/non-regression.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 992667a3df75..1d1889c5d6eb 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1468,7 +1468,17 @@ describe("verify", function () { "}" ].join("\n"), { "no-undef": 1 }, - [ "2:4 'test' is not defined. no-undef"] + [ "2:4 'test' is not defined. no-undef" ] + ); + }); + + it("Flow definition does not trigger warnings #223", function () { + verifyAndAssertMessages([ + "import { Map as $Map } from 'immutable';", + "function myFunction($state: $Map, { a, b, c } : { a: ?Object, b: ?Object, c: $Map }) {}" + ].join("\n"), + { "no-dupe-args": 1, "no-redeclare": 1, "no-shadow": 1 }, + [] ); }); From c8fe9136d754ea253dd5f6034d11e4c6e57e7f2d Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 2 May 2016 08:41:41 -0400 Subject: [PATCH 293/569] add a message about using the default parser (babel/babel-eslint#306) * add a message about using the default parser * decrease the size --- eslint/babel-eslint-parser/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index 627e1554fd9c..fe434784c551 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -4,7 +4,9 @@ **babel-eslint** allows you to lint **ALL** valid Babel code with the fantastic [ESLint](https://github.com/eslint/eslint). -`babel-eslint` is successfully linting babel and many other projects. +#### Note: You don't need to use babel-eslint if you are only using ES6/ES2015. ESLint actually supports ES6/ES7, JSX, and object rest/spread by default now. + +##### At the moment, you'll need it if you use stuff like class properties, decorators, async/await, types. > If there is an issue, first check if it can be reproduced with the regular parser or with the latest versions of `eslint` and `babel-eslint`! From 93a9a8d638853086ebf8ab1cc5a254951a60b70c Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Mon, 20 Jun 2016 23:11:38 +0200 Subject: [PATCH 294/569] Reset TypeParameters to Identifier (babel/babel-eslint#325) --- eslint/babel-eslint-parser/babylon-to-espree/toAST.js | 6 ++++++ eslint/babel-eslint-parser/index.js | 3 ++- eslint/babel-eslint-parser/test/non-regression.js | 6 +++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/eslint/babel-eslint-parser/babylon-to-espree/toAST.js b/eslint/babel-eslint-parser/babylon-to-espree/toAST.js index f82c4e598e0a..5dce899a52e2 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/toAST.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/toAST.js @@ -167,6 +167,12 @@ var astTransformVisitor = { node.type = "Experimental" + node.type; } + if (path.isTypeParameter && path.isTypeParameter()) { + node.type = "Identifier"; + node.typeAnnotation = node.bound; + delete node.bound; + } + // flow: prevent "no-undef" // for "Component" in: "let x: React.Component" if (path.isQualifiedTypeIdentifier()) { diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 46a196e87df9..ea963b9e7c75 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -250,7 +250,8 @@ function monkeypatch() { this.close(node); } }; - // visit decorators that are in: Property / MethodDefinition + + // visit decorators that are in: Property / MethodDefinition var visitProperty = referencer.prototype.visitProperty; referencer.prototype.visitProperty = function(node) { if (node.value && node.value.type === "TypeCastExpression") { diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 1d1889c5d6eb..9b338ec785e7 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -396,7 +396,7 @@ describe("verify", function () { ); }); - it.skip("polymorphpic/generic types - outside of fn scope #123", function () { + it("polymorphpic/generic types - outside of fn scope #123", function () { verifyAndAssertMessages([ "export function foo(value) { value; };", "var b: T = 1; b;" @@ -407,7 +407,7 @@ describe("verify", function () { ); }); - it.skip("polymorphpic/generic types - extending unknown #123", function () { + it("polymorphpic/generic types - extending unknown #123", function () { verifyAndAssertMessages([ "import Bar from 'bar';", "export class Foo extends Bar {}", @@ -786,7 +786,7 @@ describe("verify", function () { ); }); - it.skip("32", function () { + it("32", function () { verifyAndAssertMessages( [ "import type Foo from 'foo';", From 4d473c330579fead88ce135df03a89948c11af46 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 20 Jun 2016 17:12:33 -0400 Subject: [PATCH 295/569] 6.0.5 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 2654996cc2f0..ae4c2871f66f 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "6.0.4", + "version": "6.0.5", "description": "Custom parser for ESLint", "main": "index.js", "files": [ From ab9afd33d1109c7f718c6b1f290b2d2b4309c12f Mon Sep 17 00:00:00 2001 From: rhettlivingston Date: Wed, 22 Jun 2016 16:36:47 -0400 Subject: [PATCH 296/569] Add allowImportExportEverywhere parserOption (babel/babel-eslint#327) (babel/babel-eslint#329) * Add allowImportExportEverywhere parserOption (babel/babel-eslint#327) * Added "allowImportExportEverywhere option (babel/babel-eslint#327)" test. --- eslint/babel-eslint-parser/README.md | 4 +++- eslint/babel-eslint-parser/index.js | 3 ++- .../babel-eslint-parser/test/non-regression.js | 16 ++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index fe434784c551..da28aa1189d4 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -70,6 +70,7 @@ Check out the [ESLint docs](http://eslint.org/docs/rules/) for all possible rule ### Configuration `sourceType` can be set to `'module'`(default) or `'script'` if your code isn't using ECMAScript modules. +`allowImportExportEverywhere` can be set to true to allow import and export declarations to appear anywhere a statement is allowed if your build environment supports that. By default, import and export declarations can only appear at a program's top level. **.eslintrc** @@ -77,7 +78,8 @@ Check out the [ESLint docs](http://eslint.org/docs/rules/) for all possible rule { "parser": "babel-eslint", "parserOptions": { - "sourceType": "module" + "sourceType": "module", + "allowImportExportEverywhere": false } } ``` diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index ea963b9e7c75..aec064893091 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -365,6 +365,7 @@ exports.parse = function (code, options) { options = options || {}; eslintOptions.ecmaVersion = options.ecmaVersion = options.ecmaVersion || 6; eslintOptions.sourceType = options.sourceType = options.sourceType || "module"; + eslintOptions.allowImportExportEverywhere = options.allowImportExportEverywhere = options.allowImportExportEverywhere || false; if (options.sourceType === "module") { eslintOptions.globalReturn = false; } else { @@ -385,7 +386,7 @@ exports.parseNoPatch = function (code, options) { var opts = { sourceType: options.sourceType, strictMode: true, - allowImportExportEverywhere: false, // consistent with espree + allowImportExportEverywhere: options.allowImportExportEverywhere, // consistent with espree allowReturnOutsideFunction: true, allowSuperOutsideMethod: true, plugins: [ diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 9b338ec785e7..a56bbff3758a 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1435,6 +1435,22 @@ describe("verify", function () { ); }); + it("allowImportExportEverywhere option (#327)", function () { + verifyAndAssertMessages([ + "if (true) { import Foo from 'foo'; }", + "function foo() { import Bar from 'bar'; }", + "switch (a) { case 1: import FooBar from 'foobar'; }" + ].join("\n"), + {}, + [], + "module", + { + env: {}, + parserOptions: { ecmaVersion: 6, sourceType: "module", allowImportExportEverywhere: true } + } + ); + }); + it("with does not crash parsing in script mode (strict off) #171", function () { verifyAndAssertMessages( "with (arguments) { length; }", From 167b8bf0a034b0d6f7e1579729ebbec3ecfb08db Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 22 Jun 2016 16:37:11 -0400 Subject: [PATCH 297/569] 6.1.0 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index ae4c2871f66f..891502c9f226 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "6.0.5", + "version": "6.1.0", "description": "Custom parser for ESLint", "main": "index.js", "files": [ From ce54b07e2d1520230dd0fdab0d7d1778da7d2f7a Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Sun, 26 Jun 2016 21:52:39 +0200 Subject: [PATCH 298/569] Testcase for newline-before-return shouldn't fail with comments. (babel/babel-eslint#300) --- eslint/babel-eslint-parser/test/non-regression.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index a56bbff3758a..d6b5d958a7ee 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1498,6 +1498,21 @@ describe("verify", function () { ); }); + it("newline-before-return with comments #289", function () { + verifyAndAssertMessages(["function a() {", + "if (b) {", + "/* eslint-disable no-console */", + "console.log('test');", + "/* eslint-enable no-console */", + "}", + "", + "return hasGlobal;", + "}"].join("\n"), + { "newline-before-return": 1 }, + [] + ); + }); + // it("regex with es6 unicodeCodePointEscapes", function () { // verifyAndAssertMessages( // "string.replace(/[\u{0000A0}-\u{10FFFF}<>\&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`);", From 19baee224290d4f2d906911e45a57636b1f08d5e Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Sun, 26 Jun 2016 22:50:50 +0200 Subject: [PATCH 299/569] Add testcase for space-comment and shebang babel/babel-eslint#163 This works as of babylon 6.8.2 --- .../test/non-regression.js | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index d6b5d958a7ee..8caf04aaa651 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1499,20 +1499,32 @@ describe("verify", function () { }); it("newline-before-return with comments #289", function () { - verifyAndAssertMessages(["function a() {", - "if (b) {", - "/* eslint-disable no-console */", - "console.log('test');", - "/* eslint-enable no-console */", - "}", - "", - "return hasGlobal;", - "}"].join("\n"), + verifyAndAssertMessages([ + "function a() {", + "if (b) {", + "/* eslint-disable no-console */", + "console.log('test');", + "/* eslint-enable no-console */", + "}", + "", + "return hasGlobal;", + "}" + ].join("\n"), { "newline-before-return": 1 }, [] ); }); + it("spaced-comment with shebang #163", function () { + verifyAndAssertMessages(["#!/usr/bin/env babel-node", + "", + "import {spawn} from 'foobar';" + ].join("\n"), + { "spaced-comment": 1 }, + [] + ); + }); + // it("regex with es6 unicodeCodePointEscapes", function () { // verifyAndAssertMessages( // "string.replace(/[\u{0000A0}-\u{10FFFF}<>\&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`);", From 66a4cf578fa8e7cb5ed2143b98834f014f509c11 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 27 Jun 2016 01:53:27 -0400 Subject: [PATCH 300/569] remove hardcoded strict mode value (babel/babel-eslint#331) --- eslint/babel-eslint-parser/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index aec064893091..004f3a761dbd 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -385,7 +385,6 @@ exports.parse = function (code, options) { exports.parseNoPatch = function (code, options) { var opts = { sourceType: options.sourceType, - strictMode: true, allowImportExportEverywhere: options.allowImportExportEverywhere, // consistent with espree allowReturnOutsideFunction: true, allowSuperOutsideMethod: true, From 9ee5e6e59ca96bc79a32adf0eb2f985fc65c1bd6 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 8 Jul 2016 14:23:04 -0400 Subject: [PATCH 301/569] Create a variable for class properties in scope instead of deleting the key (babel/babel-eslint#336) --- eslint/babel-eslint-parser/babylon-to-espree/toAST.js | 5 ----- eslint/babel-eslint-parser/index.js | 7 +++++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/eslint/babel-eslint-parser/babylon-to-espree/toAST.js b/eslint/babel-eslint-parser/babylon-to-espree/toAST.js index 5dce899a52e2..cc680e999e53 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/toAST.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/toAST.js @@ -206,11 +206,6 @@ var astTransformVisitor = { } } - // remove class property keys (or patch in escope) - if (path.isClassProperty()) { - delete node.key; - } - // async function as generator if (path.isFunction()) { if (node.async) node.generator = true; diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 004f3a761dbd..9cbfb51a3952 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -229,6 +229,13 @@ function monkeypatch() { // visit decorators that are in: ClassDeclaration / ClassExpression var visitClass = referencer.prototype.visitClass; referencer.prototype.visitClass = function(node) { + var classBody = node.body.body; + for (var a = 0; a < classBody.length; a++) { + if (classBody[a].type === "ClassProperty") { + createScopeVariable.call(this, classBody[a], classBody[a].key); + } + } + visitDecorators.call(this, node); var typeParamScope; if (node.typeParameters) { From 52d9c34465aba12ea42b8eadc1c7b36361f92e0a Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 8 Jul 2016 14:23:39 -0400 Subject: [PATCH 302/569] 6.1.1 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 891502c9f226..1ebc73129f63 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "6.1.0", + "version": "6.1.1", "description": "Custom parser for ESLint", "main": "index.js", "files": [ From 1766a21145d8ebd3d8c1133b5761032d3f821033 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Sun, 10 Jul 2016 00:40:08 +0900 Subject: [PATCH 303/569] Fix: improve handling of class properties (fixes babel/babel-eslint#337) (babel/babel-eslint#338) I added ClassProperty method into Referencer of escope. This method will address class properties and those type anotations. --- eslint/babel-eslint-parser/index.js | 15 +++--- .../test/non-regression.js | 48 +++++++++++++++++++ 2 files changed, 56 insertions(+), 7 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 9cbfb51a3952..90c9259fef45 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -229,13 +229,6 @@ function monkeypatch() { // visit decorators that are in: ClassDeclaration / ClassExpression var visitClass = referencer.prototype.visitClass; referencer.prototype.visitClass = function(node) { - var classBody = node.body.body; - for (var a = 0; a < classBody.length; a++) { - if (classBody[a].type === "ClassProperty") { - createScopeVariable.call(this, classBody[a], classBody[a].key); - } - } - visitDecorators.call(this, node); var typeParamScope; if (node.typeParameters) { @@ -268,6 +261,14 @@ function monkeypatch() { visitProperty.call(this, node); }; + // visit ClassProperty as a Property. + referencer.prototype.ClassProperty = function(node) { + if (node.typeAnnotation) { + visitTypeAnnotation.call(this, node.typeAnnotation); + } + this.visitProperty(node); + }; + // visit flow type in FunctionDeclaration, FunctionExpression, ArrowFunctionExpression var visitFunction = referencer.prototype.visitFunction; referencer.prototype.visitFunction = function(node) { diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 8caf04aaa651..1aca7343ceee 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1525,6 +1525,54 @@ describe("verify", function () { ); }); + describe("Class Property Declarations", function() { + it("no-redeclare false positive 1", function() { + verifyAndAssertMessages( + [ + "class Group {", + " static propTypes = {};", + "}", + "class TypicalForm {", + " static propTypes = {};", + "}" + ].join("\n"), + { "no-redeclare": 1 }, + [] + ); + }); + + it("no-redeclare false positive 2", function() { + verifyAndAssertMessages( + [ + "function validate() {}", + "class MyComponent {", + " static validate = validate;", + "}" + ].join("\n"), + { "no-redeclare": 1 }, + [] + ); + }); + + it("check references", function() { + verifyAndAssertMessages( + [ + "var a;", + "class A {", + " prop1;", + " prop2 = a;", + " prop3 = b;", + "}", + "new A" + ].join("\n"), + { "no-undef": 1, "no-unused-vars": 1, "no-redeclare": 1 }, + [ + "5:11 'b' is not defined. no-undef" + ] + ); + }); + }); + // it("regex with es6 unicodeCodePointEscapes", function () { // verifyAndAssertMessages( // "string.replace(/[\u{0000A0}-\u{10FFFF}<>\&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`);", From b0dbbfcc031983f0a93a637d0b7de676ccdc97d8 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 9 Jul 2016 11:40:34 -0400 Subject: [PATCH 304/569] 6.1.2 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 1ebc73129f63..dfaa5254e2c2 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "6.1.1", + "version": "6.1.2", "description": "Custom parser for ESLint", "main": "index.js", "files": [ From 0cb35ab04e8a2a5d5c223a16dbe3311803b39978 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Sun, 10 Jul 2016 23:47:44 +0200 Subject: [PATCH 305/569] Fix tests for eslint 3.0 Seems that eslint got a lot smarter and reports vars that are used, but are useless as unused These examples are also failing with espree --- eslint/babel-eslint-parser/test/non-regression.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 1aca7343ceee..17bd277fedae 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -174,7 +174,7 @@ describe("verify", function () { describe("flow", function () { it("check regular function", function () { verifyAndAssertMessages([ - "function a(b, c) { b += 1; c += 1; } a;", + "function a(b, c) { b += 1; c += 1; return b + c; } a;", ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] @@ -389,7 +389,7 @@ describe("verify", function () { it("polymorphpic/generic types for type alias #123", function () { verifyAndAssertMessages([ "import Bar from './Bar';", - "type Foo = Bar; var x: Foo = 1; x++" + "type Foo = Bar; var x: Foo = 1; console.log(x);" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] From af44a1cc83bffbd7a703ef690f8ff10005bde85f Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Mon, 11 Jul 2016 00:28:57 +0200 Subject: [PATCH 306/569] Test eslint 3 and 2 on travis (babel/babel-eslint#340) closes babel/babel-eslint#332 --- eslint/babel-eslint-parser/.travis.yml | 27 ++++++++++++++++++------- eslint/babel-eslint-parser/package.json | 2 +- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/eslint/babel-eslint-parser/.travis.yml b/eslint/babel-eslint-parser/.travis.yml index f8062f9e28b7..284614267923 100644 --- a/eslint/babel-eslint-parser/.travis.yml +++ b/eslint/babel-eslint-parser/.travis.yml @@ -1,11 +1,24 @@ ---- git: depth: 1 sudo: false language: node_js -node_js: - - "0.10" - - "0.12" - - "4" - - "5" - - "6" +before_install: + - sh -c "if [ '$ESLINT_VERSION' = '2' ]; then npm i --save-dev eslint@2; fi" +matrix: + include: + - node_js: "0.10" + env: ESLINT_VERSION=2 + - node_js: "0.12" + env: ESLINT_VERSION=2 + - node_js: "4" + env: ESLINT_VERSION=2 + - node_js: "4" + env: ESLINT_VERSION=3 + - node_js: "5" + env: ESLINT_VERSION=2 + - node_js: "5" + env: ESLINT_VERSION=3 + - node_js: "6" + env: ESLINT_VERSION=2 + - node_js: "6" + env: ESLINT_VERSION=3 diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index dfaa5254e2c2..798b69311c7e 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -34,7 +34,7 @@ }, "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { - "eslint": "^2.4.0", + "eslint": "^3.0.0", "espree": "^3.0.0", "mocha": "^2.3.3" } From 289bf4f84a2e81bd24a0cf835b9d4dda2f1da870 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Mon, 11 Jul 2016 01:18:41 +0200 Subject: [PATCH 307/569] Add note about eslint 3 [skip ci] --- eslint/babel-eslint-parser/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index da28aa1189d4..5eadb475df29 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -44,12 +44,22 @@ It just needs to export a `parse` method that takes in a string of code and outp ## Usage +### Supported ESLint versions + +ESLint | babel-eslint +------------ | ------------- +1.x | <= 5.x +2.x | >= 6.x +3.x | >= 6.x + ### Install ```sh $ npm install eslint@1.x babel-eslint@5 --save-dev $ npm install eslint@2.x babel-eslint@6 --save-dev + +$ npm install eslint@3.x babel-eslint@6 --save-dev ``` ### Setup From 0534eb764495bbc79be815da8369072149151651 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Sat, 30 Jul 2016 19:44:42 +0200 Subject: [PATCH 308/569] Fix tests for eslint 3.2 (babel/babel-eslint#352) --- eslint/babel-eslint-parser/test/non-regression.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 17bd277fedae..eeb993adb5f6 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -402,7 +402,7 @@ describe("verify", function () { "var b: T = 1; b;" ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, - [ "1:21 'T' is defined but never used no-unused-vars", + [ "1:21 'T' is defined but never used. no-unused-vars", "2:8 'T' is not defined. no-undef" ] ); }); @@ -1145,7 +1145,7 @@ describe("verify", function () { verifyAndAssertMessages( "var unused;", { "no-unused-vars": 1 }, - [ "1:5 'unused' is defined but never used no-unused-vars" ] + [ "1:5 'unused' is defined but never used. no-unused-vars" ] ); }); @@ -1196,7 +1196,7 @@ describe("verify", function () { verifyAndAssertMessages( "const {Bacona} = require('baconjs')", { "no-undef": 1, "no-unused-vars": 1 }, - [ "1:8 'Bacona' is defined but never used no-unused-vars" ] + [ "1:8 'Bacona' is defined but never used. no-unused-vars" ] ); }); From 50e0abfd16e39bebbec2f315040f39daf7c315f7 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 1 Aug 2016 15:00:01 -0400 Subject: [PATCH 309/569] Drop node < 4 (babel/babel-eslint#358) --- eslint/babel-eslint-parser/.travis.yml | 15 --------------- eslint/babel-eslint-parser/package.json | 3 +++ 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/eslint/babel-eslint-parser/.travis.yml b/eslint/babel-eslint-parser/.travis.yml index 284614267923..8aac7f25eee0 100644 --- a/eslint/babel-eslint-parser/.travis.yml +++ b/eslint/babel-eslint-parser/.travis.yml @@ -2,23 +2,8 @@ git: depth: 1 sudo: false language: node_js -before_install: - - sh -c "if [ '$ESLINT_VERSION' = '2' ]; then npm i --save-dev eslint@2; fi" matrix: include: - - node_js: "0.10" - env: ESLINT_VERSION=2 - - node_js: "0.12" - env: ESLINT_VERSION=2 - node_js: "4" - env: ESLINT_VERSION=2 - - node_js: "4" - env: ESLINT_VERSION=3 - - node_js: "5" - env: ESLINT_VERSION=2 - node_js: "5" - env: ESLINT_VERSION=3 - - node_js: "6" - env: ESLINT_VERSION=2 - node_js: "6" - env: ESLINT_VERSION=3 diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 798b69311c7e..8fbade9960fc 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -29,6 +29,9 @@ }, "author": "Sebastian McKenzie ", "license": "MIT", + "engines": { + "node": ">=4" + }, "bugs": { "url": "https://github.com/babel/babel-eslint/issues" }, From 481329a47e6b3defdfcf5ac8d40813c19e27390b Mon Sep 17 00:00:00 2001 From: Greenkeeper Date: Tue, 2 Aug 2016 04:34:39 +0200 Subject: [PATCH 310/569] chore(package): update mocha to version 3.0.0 (babel/babel-eslint#356) https://greenkeeper.io/ --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 8fbade9960fc..0234029bdc55 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -39,6 +39,6 @@ "devDependencies": { "eslint": "^3.0.0", "espree": "^3.0.0", - "mocha": "^2.3.3" + "mocha": "^3.0.0" } } From 2b812b087c47e8968a9d0bc087bbaf87aed3dc09 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 3 Aug 2016 09:34:51 -0400 Subject: [PATCH 311/569] Merge pull request babel/babel-eslint#354 from babel/eslint-config-babel Use eslint-config-babel --- eslint/babel-eslint-parser/.eslintignore | 1 + eslint/babel-eslint-parser/.eslintrc | 28 -- eslint/babel-eslint-parser/.eslintrc.js | 16 + eslint/babel-eslint-parser/.travis.yml | 2 + .../babylon-to-espree/convertTemplateType.js | 2 +- .../babylon-to-espree/index.js | 2 +- .../babylon-to-espree/toAST.js | 32 +- eslint/babel-eslint-parser/index.js | 32 +- eslint/babel-eslint-parser/package.json | 2 + .../babel-eslint-parser/test/babel-eslint.js | 108 ++--- .../test/fixtures/rules/strict/global-with.js | 2 +- .../test/non-regression.js | 452 +++++++++--------- 12 files changed, 334 insertions(+), 345 deletions(-) create mode 100644 eslint/babel-eslint-parser/.eslintignore delete mode 100644 eslint/babel-eslint-parser/.eslintrc create mode 100644 eslint/babel-eslint-parser/.eslintrc.js diff --git a/eslint/babel-eslint-parser/.eslintignore b/eslint/babel-eslint-parser/.eslintignore new file mode 100644 index 000000000000..a843dc44a197 --- /dev/null +++ b/eslint/babel-eslint-parser/.eslintignore @@ -0,0 +1 @@ +test/fixtures diff --git a/eslint/babel-eslint-parser/.eslintrc b/eslint/babel-eslint-parser/.eslintrc deleted file mode 100644 index 57a95f9d7e45..000000000000 --- a/eslint/babel-eslint-parser/.eslintrc +++ /dev/null @@ -1,28 +0,0 @@ -{ - "root": true, - "rules": { - "strict": 0, - "no-underscore-dangle": 0, - "curly": 0, - "no-multi-spaces": 0, - "key-spacing": 0, - "no-return-assign": 0, - "consistent-return": 0, - "no-shadow": 0, - "comma-dangle": 0, - "no-use-before-define": 0, - "no-empty": 0, - "new-parens": 0, - "no-cond-assign": 0, - "no-fallthrough": 0, - "new-cap": 0, - "no-loop-func": 0, - "no-unreachable": 0, - "no-process-exit": 0, - "quotes": [1, "double", "avoid-escape"] - }, - "env": { - "node": true, - "mocha": true - } -} diff --git a/eslint/babel-eslint-parser/.eslintrc.js b/eslint/babel-eslint-parser/.eslintrc.js new file mode 100644 index 000000000000..1f91933ff5b4 --- /dev/null +++ b/eslint/babel-eslint-parser/.eslintrc.js @@ -0,0 +1,16 @@ +module.exports = { + root: true, + extends: "babel", + parserOptions: { + ecmaVersion: 7, + sourceType: "module" + }, + rules: { + "no-var": 0, + "max-len": 0 + }, + env: { + node: true, + mocha: true + } +}; diff --git a/eslint/babel-eslint-parser/.travis.yml b/eslint/babel-eslint-parser/.travis.yml index 8aac7f25eee0..9f2b522cd50e 100644 --- a/eslint/babel-eslint-parser/.travis.yml +++ b/eslint/babel-eslint-parser/.travis.yml @@ -7,3 +7,5 @@ matrix: - node_js: "4" - node_js: "5" - node_js: "6" + +script: npm run test-ci diff --git a/eslint/babel-eslint-parser/babylon-to-espree/convertTemplateType.js b/eslint/babel-eslint-parser/babylon-to-espree/convertTemplateType.js index 0c3293dcf9d7..c9537ddde0e9 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/convertTemplateType.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/convertTemplateType.js @@ -90,4 +90,4 @@ module.exports = function (tokens, tt) { } startingToken++; } -} +}; diff --git a/eslint/babel-eslint-parser/babylon-to-espree/index.js b/eslint/babel-eslint-parser/babylon-to-espree/index.js index 70accfdfcff2..401570b6b199 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/index.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/index.js @@ -17,4 +17,4 @@ exports.convertComments = function (comments) { comment.range = [comment.start, comment.end]; } } -} +}; diff --git a/eslint/babel-eslint-parser/babylon-to-espree/toAST.js b/eslint/babel-eslint-parser/babylon-to-espree/toAST.js index cc680e999e53..388253f1d06e 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/toAST.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/toAST.js @@ -17,6 +17,18 @@ function changeToLiteral(node) { } } +function changeComments(nodeComments) { + for (var i = 0; i < nodeComments.length; i++) { + var comment = nodeComments[i]; + if (comment.type === "CommentLine") { + comment.type = "Line"; + } else if (comment.type === "CommentBlock") { + comment.type = "Block"; + } + comment.range = [comment.start, comment.end]; + } +} + var astTransformVisitor = { noScope: true, enter: function (path) { @@ -33,27 +45,11 @@ var astTransformVisitor = { } if (node.trailingComments) { - for (var i = 0; i < node.trailingComments.length; i++) { - var comment = node.trailingComments[i]; - if (comment.type === "CommentLine") { - comment.type = "Line"; - } else if (comment.type === "CommentBlock") { - comment.type = "Block"; - } - comment.range = [comment.start, comment.end]; - } + changeComments(node.trailingComments); } if (node.leadingComments) { - for (var i = 0; i < node.leadingComments.length; i++) { - var comment = node.leadingComments[i]; - if (comment.type === "CommentLine") { - comment.type = "Line"; - } else if (comment.type === "CommentBlock") { - comment.type = "Block"; - } - comment.range = [comment.start, comment.end]; - } + changeComments(node.leadingComments); } // make '_paths' non-enumerable (babel-eslint #200) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 90c9259fef45..f41deb047605 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -388,7 +388,7 @@ exports.parse = function (code, options) { } return exports.parseNoPatch(code, options); -} +}; exports.parseNoPatch = function (code, options) { var opts = { @@ -397,20 +397,20 @@ exports.parseNoPatch = function (code, options) { allowReturnOutsideFunction: true, allowSuperOutsideMethod: true, plugins: [ - "flow", - "jsx", - "asyncFunctions", - "asyncGenerators", - "classConstructorCall", - "classProperties", - "decorators", - "doExpressions", - "exponentiationOperator", - "exportExtensions", - "functionBind", - "functionSent", - "objectRestSpread", - "trailingFunctionCommas" + "flow", + "jsx", + "asyncFunctions", + "asyncGenerators", + "classConstructorCall", + "classProperties", + "decorators", + "doExpressions", + "exponentiationOperator", + "exportExtensions", + "functionBind", + "functionSent", + "objectRestSpread", + "trailingFunctionCommas" ] }; @@ -458,4 +458,4 @@ exports.parseNoPatch = function (code, options) { babylonToEspree.attachComments(ast, ast.comments, ast.tokens); return ast; -} +}; diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 0234029bdc55..12f568b375ea 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -22,6 +22,7 @@ "bootstrap": "git submodule update --init && cd eslint && npm install", "eslint": "cd eslint && mocha -c tests/lib/rules/*.js -r ../eslint-tester.js", "test": "mocha", + "test-ci" "npm test && npm run lint", "lint": "eslint index.js babylon-to-espree test", "fix": "eslint index.js babylon-to-espree test --fix", "preversion": "npm test", @@ -38,6 +39,7 @@ "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { "eslint": "^3.0.0", + "eslint-config-babel": "^1.0.1", "espree": "^3.0.0", "mocha": "^3.0.0" } diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 76005da1377f..956354803a09 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -36,20 +36,20 @@ function lookup(obj, keypath, backwardsDepth) { if (!keypath) { return obj; } return keypath.split(".").slice(0, -1 * backwardsDepth) - .reduce(function (base, segment) { return base && base[segment], obj }); + .reduce(function (base, segment) { return base && base[segment], obj; }); } function parseAndAssertSame(code) { var esAST = espree.parse(code, { ecmaFeatures: { // enable JSX parsing - jsx: true, + jsx: true, // enable return in global scope - globalReturn: true, + globalReturn: true, // enable implied strict mode (if ecmaVersion >= 5) - impliedStrict: true, + impliedStrict: true, // allow experimental object rest/spread - experimentalObjectRestSpread: true + experimentalObjectRestSpread: true }, tokens: true, loc: true, @@ -62,7 +62,7 @@ function parseAndAssertSame(code) { var babylonAST = babelEslint.parse(code); try { assertImplementsAST(esAST, babylonAST); - } catch(err) { + } catch (err) { var traversal = err.message.slice(3, err.message.indexOf(":")); if (esAST.tokens) { delete esAST.tokens; @@ -145,10 +145,10 @@ describe("babylon-to-esprima", function () { it("template with destructuring #31", function () { parseAndAssertSame([ "module.exports = {", - "render() {", - "var {name} = this.props;", - "return Math.max(null, `Name: ${name}, Name: ${name}`);", - "}", + "render() {", + "var {name} = this.props;", + "return Math.max(null, `Name: ${name}, Name: ${name}`);", + "}", "};" ].join("\n")); }); @@ -199,19 +199,19 @@ describe("babylon-to-esprima", function () { }); it("default import", function () { - parseAndAssertSame('import foo from "foo";'); + parseAndAssertSame("import foo from \"foo\";"); }); it("import specifier", function () { - parseAndAssertSame('import { foo } from "foo";'); + parseAndAssertSame("import { foo } from \"foo\";"); }); it("import specifier with name", function () { - parseAndAssertSame('import { foo as bar } from "foo";'); + parseAndAssertSame("import { foo as bar } from \"foo\";"); }); it("import bare", function () { - parseAndAssertSame('import "foo";'); + parseAndAssertSame("import \"foo\";"); }); it("export default class declaration", function () { @@ -231,7 +231,7 @@ describe("babylon-to-esprima", function () { }); it("export all", function () { - parseAndAssertSame('export * from "foo";'); + parseAndAssertSame("export * from \"foo\";"); }); it("export named", function () { @@ -272,11 +272,11 @@ describe("babylon-to-esprima", function () { it("block comments #124", function () { parseAndAssertSame([ "React.createClass({", - "render() {", - "// return (", - "//
", - "// ); // <-- this is the line that is reported", - "}", + "render() {", + "// return (", + "//
", + "// ); // <-- this is the line that is reported", + "}", "});" ].join("\n")); }); @@ -308,24 +308,24 @@ describe("babylon-to-esprima", function () { it("jsdoc", function () { parseAndAssertSame([ "/**", - "* @param {object} options", - "* @return {number}", - "*/", + "* @param {object} options", + "* @return {number}", + "*/", "const test = function({ a, b, c }) {", - "return a + b + c;", + "return a + b + c;", "};", "module.exports = test;" ].join("\n")); - }) + }); it("empty block with comment", function () { parseAndAssertSame([ "function a () {", - "try {", - "b();", - "} catch (e) {", - "// asdf", - "}", + "try {", + "b();", + "} catch (e) {", + "// asdf", + "}", "}" ].join("\n")); }); @@ -334,7 +334,7 @@ describe("babylon-to-esprima", function () { it("MethodDefinition", function () { parseAndAssertSame([ "export default class A {", - "a() {}", + "a() {}", "}" ].join("\n")); }); @@ -348,8 +348,8 @@ describe("babylon-to-esprima", function () { it("ClassMethod", function () { parseAndAssertSame([ "class A {", - "constructor() {", - "}", + "constructor() {", + "}", "}" ].join("\n")); }); @@ -357,8 +357,8 @@ describe("babylon-to-esprima", function () { it("ClassMethod multiple params", function () { parseAndAssertSame([ "class A {", - "constructor(a, b, c) {", - "}", + "constructor(a, b, c) {", + "}", "}" ].join("\n")); }); @@ -385,8 +385,8 @@ describe("babylon-to-esprima", function () { it("ObjectMethod", function () { parseAndAssertSame([ "var a = {", - "b(c) {", - "}", + "b(c) {", + "}", "}" ].join("\n")); }); @@ -394,7 +394,7 @@ describe("babylon-to-esprima", function () { it("do not allow import export everywhere", function() { assert.throws(function () { parseAndAssertSame("function F() { import a from \"a\"; }"); - }, /SyntaxError: 'import' and 'export' may only appear at the top level/) + }, /SyntaxError: 'import' and 'export' may only appear at the top level/); }); it("return outside function", function () { @@ -415,31 +415,31 @@ describe("babylon-to-esprima", function () { parseAndAssertSame("class A { get x ( ) { ; } }"); parseAndAssertSame([ "class A {", - "get x(", - ")", - "{", - ";", - "}", + "get x(", + ")", + "{", + ";", + "}", "}" ].join("\n")); parseAndAssertSame("class A { set x (a) { ; } }"); parseAndAssertSame([ "class A {", - "set x(a", - ")", - "{", - ";", - "}", + "set x(a", + ")", + "{", + ";", + "}", "}" ].join("\n")); parseAndAssertSame([ "var B = {", - "get x () {", - "return this.ecks;", - "},", - "set x (ecks) {", - "this.ecks = ecks;", - "}", + "get x () {", + "return this.ecks;", + "},", + "set x (ecks) {", + "this.ecks = ecks;", + "}", "};" ].join("\n")); }); diff --git a/eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with.js b/eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with.js index b28e68be0cd3..e967aa4994d0 100644 --- a/eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with.js +++ b/eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with.js @@ -1,4 +1,4 @@ -"use strict";; +"use strict"; /* The empty statement is intentional. As of now, ESLint won't enforce string: [2, "global"] on a program with an empty body. A test for that without diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index eeb993adb5f6..e75a75a6edaa 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -23,7 +23,7 @@ function verifyAndAssertMessages(code, rules, expectedMessages, sourceType, over if (overrideConfig) { for (var key in overrideConfig) { - config[key] = overrideConfig[key] + config[key] = overrideConfig[key]; } } @@ -161,11 +161,11 @@ describe("verify", function () { it("comment with padded-blocks (issue #33)", function () { verifyAndAssertMessages([ - "if (a){", - "// i'm a comment!", - "let b = c", - "}" - ].join("\n"), + "if (a){", + "// i'm a comment!", + "let b = c", + "}" + ].join("\n"), { "padded-blocks": [1, "never"] }, [] ); @@ -174,8 +174,8 @@ describe("verify", function () { describe("flow", function () { it("check regular function", function () { verifyAndAssertMessages([ - "function a(b, c) { b += 1; c += 1; return b + c; } a;", - ].join("\n"), + "function a(b, c) { b += 1; c += 1; return b + c; } a;", + ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -199,14 +199,14 @@ describe("verify", function () { it("multiple nullable type annotations and return #108", function () { verifyAndAssertMessages([ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "import type Foo3 from 'foo';", - "function log(foo: ?Foo, foo2: ?Foo2): ?Foo3 {", - "console.log(foo, foo2);", - "}", - "log(1, 2);" - ].join("\n"), + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "import type Foo3 from 'foo';", + "function log(foo: ?Foo, foo2: ?Foo2): ?Foo3 {", + "console.log(foo, foo2);", + "}", + "log(1, 2);" + ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -214,11 +214,11 @@ describe("verify", function () { it("type parameters", function () { verifyAndAssertMessages([ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "function log(a: T1, b: T2) { return a + b; }", - "log(1, 2);" - ].join("\n"), + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "function log(a: T1, b: T2) { return a + b; }", + "log(1, 2);" + ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -226,12 +226,12 @@ describe("verify", function () { it("nested type annotations", function () { verifyAndAssertMessages([ - "import type Foo from 'foo';", - "function foo(callback: () => Foo) {", - "return callback();", - "}", - "foo();" - ].join("\n"), + "import type Foo from 'foo';", + "function foo(callback: () => Foo) {", + "return callback();", + "}", + "foo();" + ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -239,10 +239,10 @@ describe("verify", function () { it("type in var declaration", function () { verifyAndAssertMessages([ - "import type Foo from 'foo';", - "var x: Foo = 1;", - "x;" - ].join("\n"), + "import type Foo from 'foo';", + "var x: Foo = 1;", + "x;" + ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -250,10 +250,10 @@ describe("verify", function () { it("object type annotation", function () { verifyAndAssertMessages([ - "import type Foo from 'foo';", - "var a: {numVal: Foo};", - "a;" - ].join("\n"), + "import type Foo from 'foo';", + "var a: {numVal: Foo};", + "a;" + ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -261,13 +261,13 @@ describe("verify", function () { it("object property types", function () { verifyAndAssertMessages([ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "var a = {", - "circle: (null : ?{ setNativeProps(props: Foo): Foo2 })", - "};", - "a;" - ].join("\n"), + "import type Foo from 'foo';", + "import type Foo2 from 'foo';", + "var a = {", + "circle: (null : ?{ setNativeProps(props: Foo): Foo2 })", + "};", + "a;" + ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -275,16 +275,16 @@ describe("verify", function () { it("namespaced types", function () { verifyAndAssertMessages([ - "var React = require('react-native');", - "var b = {", - "openExternalExample: (null: ?React.Component)", - "};", - "var c = {", - "render(): React.Component {}", - "};", - "b;", - "c;" - ].join("\n"), + "var React = require('react-native');", + "var b = {", + "openExternalExample: (null: ?React.Component)", + "};", + "var c = {", + "render(): React.Component {}", + "};", + "b;", + "c;" + ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -292,9 +292,9 @@ describe("verify", function () { it("ArrayTypeAnnotation", function () { verifyAndAssertMessages([ - "import type Foo from 'foo';", - "var x: Foo[]; x;" - ].join("\n"), + "import type Foo from 'foo';", + "var x: Foo[]; x;" + ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -302,9 +302,9 @@ describe("verify", function () { it("ClassImplements", function () { verifyAndAssertMessages([ - "import type Bar from 'foo';", - "export default class Foo implements Bar {}" - ].join("\n"), + "import type Bar from 'foo';", + "export default class Foo implements Bar {}" + ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -312,9 +312,9 @@ describe("verify", function () { it("type alias creates declaration + usage", function () { verifyAndAssertMessages([ - "type Foo = any;", - "var x : Foo = 1; x;" - ].join("\n"), + "type Foo = any;", + "var x : Foo = 1; x;" + ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -322,11 +322,11 @@ describe("verify", function () { it("type alias with type parameters", function () { verifyAndAssertMessages([ - "import type Bar from 'foo';", - "import type Foo3 from 'foo';", - "type Foo = Bar", - "var x : Foo = 1; x;" - ].join("\n"), + "import type Bar from 'foo';", + "import type Foo3 from 'foo';", + "type Foo = Bar", + "var x : Foo = 1; x;" + ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -334,9 +334,9 @@ describe("verify", function () { it("export type alias", function () { verifyAndAssertMessages([ - "import type Foo2 from 'foo';", - "export type Foo = Foo2;" - ].join("\n"), + "import type Foo2 from 'foo';", + "export type Foo = Foo2;" + ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -344,8 +344,8 @@ describe("verify", function () { it("polymorphpic types #109", function () { verifyAndAssertMessages([ - "export default function groupByEveryN(array: Array, n: number): Array> { n; }" - ].join("\n"), + "export default function groupByEveryN(array: Array, n: number): Array> { n; }" + ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -353,10 +353,10 @@ describe("verify", function () { it("types definition from import", function () { verifyAndAssertMessages([ - "import type Promise from 'bluebird';", - "type Operation = () => Promise;", - "x: Operation;" - ].join("\n"), + "import type Promise from 'bluebird';", + "type Operation = () => Promise;", + "x: Operation;" + ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -364,12 +364,12 @@ describe("verify", function () { it("polymorphpic/generic types for class #123", function () { verifyAndAssertMessages([ - "class Box {", - "value: T;", - "}", - "var box = new Box();", - "console.log(box.value);" - ].join("\n"), + "class Box {", + "value: T;", + "}", + "var box = new Box();", + "console.log(box.value);" + ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -377,10 +377,10 @@ describe("verify", function () { it("polymorphpic/generic types for function #123", function () { verifyAndAssertMessages([ - "export function identity(value) {", - "var a: T = value; a;", - "}" - ].join("\n"), + "export function identity(value) {", + "var a: T = value; a;", + "}" + ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -388,9 +388,9 @@ describe("verify", function () { it("polymorphpic/generic types for type alias #123", function () { verifyAndAssertMessages([ - "import Bar from './Bar';", - "type Foo = Bar; var x: Foo = 1; console.log(x);" - ].join("\n"), + "import Bar from './Bar';", + "type Foo = Bar; var x: Foo = 1; console.log(x);" + ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -398,9 +398,9 @@ describe("verify", function () { it("polymorphpic/generic types - outside of fn scope #123", function () { verifyAndAssertMessages([ - "export function foo(value) { value; };", - "var b: T = 1; b;" - ].join("\n"), + "export function foo(value) { value; };", + "var b: T = 1; b;" + ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [ "1:21 'T' is defined but never used. no-unused-vars", "2:8 'T' is not defined. no-undef" ] @@ -409,9 +409,9 @@ describe("verify", function () { it("polymorphpic/generic types - extending unknown #123", function () { verifyAndAssertMessages([ - "import Bar from 'bar';", - "export class Foo extends Bar {}", - ].join("\n"), + "import Bar from 'bar';", + "export class Foo extends Bar {}", + ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [ "2:30 'T' is not defined. no-undef" ] ); @@ -419,12 +419,12 @@ describe("verify", function () { it("support declarations #132", function () { verifyAndAssertMessages([ - "declare class A { static () : number }", - "declare module B { declare var x: number; }", - "declare function foo(): void;", - "declare var bar", - "A; B; foo(); bar;" - ].join("\n"), + "declare class A { static () : number }", + "declare module B { declare var x: number; }", + "declare function foo(): void;", + "declare var bar", + "A; B; foo(); bar;" + ].join("\n"), { "no-undef": 1, "no-unused-vars": 1 }, [] ); @@ -1002,12 +1002,12 @@ describe("verify", function () { it("class definition: gaearon/redux#24", function () { verifyAndAssertMessages([ - "export default function root(stores) {", - "return DecoratedComponent => class ReduxRootDecorator {", - "a() { DecoratedComponent; stores; }", - "};", - "}", - ].join("\n"), + "export default function root(stores) {", + "return DecoratedComponent => class ReduxRootDecorator {", + "a() { DecoratedComponent; stores; }", + "};", + "}", + ].join("\n"), { "no-undef": 1, "no-unused-vars": 1 }, [] ); @@ -1032,10 +1032,10 @@ describe("verify", function () { it("template with destructuring #31", function () { verifyAndAssertMessages([ "module.exports = {", - "render() {", - "var {name} = this.props;", - "return Math.max(null, `Name: ${name}, Name: ${name}`);", - "}", + "render() {", + "var {name} = this.props;", + "return Math.max(null, `Name: ${name}, Name: ${name}`);", + "}", "};"].join("\n"), { "comma-spacing": 1 }, [] @@ -1064,12 +1064,12 @@ describe("verify", function () { "import classMethodDeclarationA from 'decorator';", "import decoratorParameter from 'decorator';", "export class TextareaAutosize {", - "@classMethodDeclarationA((parameter) => parameter)", - "@classMethodDeclarationA(decoratorParameter)", - "@classMethodDeclarationA", - "methodDeclaration(e) {", - "e();", - "}", + "@classMethodDeclarationA((parameter) => parameter)", + "@classMethodDeclarationA(decoratorParameter)", + "@classMethodDeclarationA", + "methodDeclaration(e) {", + "e();", + "}", "}" ].join("\n"), { "no-unused-vars": 1 }, @@ -1083,14 +1083,14 @@ describe("verify", function () { "import classMethodDeclarationA from 'decorator';", "import decoratorParameter from 'decorator';", "export class TextareaAutosize {", - "@classMethodDeclarationA((parameter) => parameter)", - "@classMethodDeclarationA(decoratorParameter)", - "@classMethodDeclarationA", - "get bar() { }", - "@classMethodDeclarationA((parameter) => parameter)", - "@classMethodDeclarationA(decoratorParameter)", - "@classMethodDeclarationA", - "set bar(val) { val; }", + "@classMethodDeclarationA((parameter) => parameter)", + "@classMethodDeclarationA(decoratorParameter)", + "@classMethodDeclarationA", + "get bar() { }", + "@classMethodDeclarationA((parameter) => parameter)", + "@classMethodDeclarationA(decoratorParameter)", + "@classMethodDeclarationA", + "set bar(val) { val; }", "}" ].join("\n"), { "no-unused-vars": 1 }, @@ -1104,12 +1104,12 @@ describe("verify", function () { "import classMethodDeclarationA from 'decorator';", "import decoratorParameter from 'decorator';", "var obj = {", - "@classMethodDeclarationA((parameter) => parameter)", - "@classMethodDeclarationA(decoratorParameter)", - "@classMethodDeclarationA", - "methodDeclaration(e) {", - "e();", - "}", + "@classMethodDeclarationA((parameter) => parameter)", + "@classMethodDeclarationA(decoratorParameter)", + "@classMethodDeclarationA", + "methodDeclaration(e) {", + "e();", + "}", "};", "obj;" ].join("\n"), @@ -1124,14 +1124,14 @@ describe("verify", function () { "import classMethodDeclarationA from 'decorator';", "import decoratorParameter from 'decorator';", "var obj = {", - "@classMethodDeclarationA((parameter) => parameter)", - "@classMethodDeclarationA(decoratorParameter)", - "@classMethodDeclarationA", - "get bar() { },", - "@classMethodDeclarationA((parameter) => parameter)", - "@classMethodDeclarationA(decoratorParameter)", - "@classMethodDeclarationA", - "set bar(val) { val; }", + "@classMethodDeclarationA((parameter) => parameter)", + "@classMethodDeclarationA(decoratorParameter)", + "@classMethodDeclarationA", + "get bar() { },", + "@classMethodDeclarationA((parameter) => parameter)", + "@classMethodDeclarationA(decoratorParameter)", + "@classMethodDeclarationA", + "set bar(val) { val; }", "};", "obj;" ].join("\n"), @@ -1202,13 +1202,13 @@ describe("verify", function () { it("don't warn no-unused-vars with spread #142", function () { verifyAndAssertMessages([ - "export default function test(data) {", - "return {", - "foo: 'bar',", - "...data", - "};", - "}", - ].join("\n"), + "export default function test(data) {", + "return {", + "foo: 'bar',", + "...data", + "};", + "}", + ].join("\n"), { "no-undef": 1, "no-unused-vars": 1 }, [] ); @@ -1218,8 +1218,8 @@ describe("verify", function () { verifyAndAssertMessages( [ "var a = [", - "1,", - "2, // a trailing comment makes this line fail comma-dangle (always-multiline)", + "1,", + "2, // a trailing comment makes this line fail comma-dangle (always-multiline)", "];", ].join("\n"), { "comma-dangle": [2, "always-multiline"] }, @@ -1229,9 +1229,9 @@ describe("verify", function () { verifyAndAssertMessages( [ "switch (a) {", - "// A comment here makes the above line fail brace-style", - "case 1:", - "console.log(a);", + "// A comment here makes the above line fail brace-style", + "case 1:", + "console.log(a);", "}" ].join("\n"), { "brace-style": 2 }, @@ -1241,8 +1241,8 @@ describe("verify", function () { it("ternary and parens #149", function () { verifyAndAssertMessages([ - "true ? (true) : false;" - ].join("\n"), + "true ? (true) : false;" + ].join("\n"), { "space-infix-ops": 1 }, [] ); @@ -1252,67 +1252,67 @@ describe("verify", function () { verifyAndAssertMessages( [ "React.createClass({", - "render() {", - "// return (", - "//
", - "// ); // <-- this is the line that is reported", - "}", + "render() {", + "// return (", + "//
", + "// ); // <-- this is the line that is reported", + "}", "});" ].join("\n"), { "space-in-parens": 1 }, [ ] - ) + ); }); it("block comment space-in-parens #124", function () { verifyAndAssertMessages( [ "React.createClass({", - "render() {", - "/*", - "return (", - "
", - "); // <-- this is the line that is reported", - "*/", - "}", + "render() {", + "/*", + "return (", + "
", + "); // <-- this is the line that is reported", + "*/", + "}", "});" ].join("\n"), { "space-in-parens": 1 }, [ ] - ) + ); }); it("no no-undef error with rest #11", function () { verifyAndAssertMessages("const [a, ...rest] = ['1', '2', '3']; a; rest;", { "no-undef": 1, "no-unused-vars": 1 }, [ ] - ) + ); }); it("async function with space-before-function-paren #168", function () { verifyAndAssertMessages("it('handles updates', async function() {});", { "space-before-function-paren": [1, "never"] }, [ ] - ) + ); }); it("default param flow type no-unused-vars #184", function () { verifyAndAssertMessages( [ "type ResolveOptionType = {", - "depth?: number,", - "identifier?: string", + "depth?: number,", + "identifier?: string", "};", "", "export default function resolve(", - "options: ResolveOptionType = {}", + "options: ResolveOptionType = {}", "): Object {", - "options;", + "options;", "}", ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [ ] - ) + ); }); it("no-use-before-define #192", function () { @@ -1322,8 +1322,8 @@ describe("verify", function () { "var x = 1;" ].join("\n"), { "no-use-before-define": 1 }, - [ "1:13 'x' was used before it was defined no-use-before-define" ] - ) + [ "1:13 'x' was used before it was defined. no-use-before-define" ] + ); }); it("jsx and stringliteral #216", function () { @@ -1331,31 +1331,31 @@ describe("verify", function () { "
", {}, [] - ) + ); }); it("getter/setter #218", function () { verifyAndAssertMessages([ - "class Person {", - " set a (v) { }", - "}" - ].join("\n"), + "class Person {", + " set a (v) { }", + "}" + ].join("\n"), { "space-before-function-paren": 1, "keyword-spacing": [1, {"before": true}], "indent": 1 }, [] - ) + ); }); it("getter/setter #220", function () { verifyAndAssertMessages([ - "var B = {", - "get x () {", - "return this.ecks;", - "},", - "set x (ecks) {", - "this.ecks = ecks;", - "}", - "};" - ].join("\n"), + "var B = {", + "get x () {", + "return this.ecks;", + "},", + "set x (ecks) {", + "this.ecks = ecks;", + "}", + "};" + ].join("\n"), { "no-dupe-keys": 1 }, [] ); @@ -1363,12 +1363,12 @@ describe("verify", function () { it("fixes issues with flow types and ObjectPattern", function () { verifyAndAssertMessages([ - "import type Foo from 'bar';", - "export default class Foobar {", - " foo({ bar }: Foo) { bar; }", - " bar({ foo }: Foo) { foo; }", - "}" - ].join("\n"), + "import type Foo from 'bar';", + "export default class Foobar {", + " foo({ bar }: Foo) { bar; }", + " bar({ foo }: Foo) { foo; }", + "}" + ].join("\n"), { "no-unused-vars": 1, "no-shadow": 1 }, [] ); @@ -1376,22 +1376,22 @@ describe("verify", function () { it("correctly detects redeclares if in script mode #217", function () { verifyAndAssertMessages([ - "var a = 321;", - "var a = 123;", - ].join("\n"), + "var a = 321;", + "var a = 123;", + ].join("\n"), { "no-redeclare": 1 }, - [ "2:5 'a' is already defined no-redeclare" ], + [ "2:5 'a' is already defined. no-redeclare" ], "script" ); }); it("correctly detects redeclares if in module mode #217", function () { verifyAndAssertMessages([ - "var a = 321;", - "var a = 123;", - ].join("\n"), + "var a = 321;", + "var a = 123;", + ].join("\n"), { "no-redeclare": 1 }, - [ "2:5 'a' is already defined no-redeclare" ], + [ "2:5 'a' is already defined. no-redeclare" ], "module" ); }); @@ -1437,10 +1437,10 @@ describe("verify", function () { it("allowImportExportEverywhere option (#327)", function () { verifyAndAssertMessages([ - "if (true) { import Foo from 'foo'; }", - "function foo() { import Bar from 'bar'; }", - "switch (a) { case 1: import FooBar from 'foobar'; }" - ].join("\n"), + "if (true) { import Foo from 'foo'; }", + "function foo() { import Bar from 'bar'; }", + "switch (a) { case 1: import FooBar from 'foobar'; }" + ].join("\n"), {}, [], "module", @@ -1478,11 +1478,11 @@ describe("verify", function () { it("decorator does not create TypeError #229", function () { verifyAndAssertMessages([ - "class A {", - " @test", - " f() {}", - "}" - ].join("\n"), + "class A {", + " @test", + " f() {}", + "}" + ].join("\n"), { "no-undef": 1 }, [ "2:4 'test' is not defined. no-undef" ] ); @@ -1490,9 +1490,9 @@ describe("verify", function () { it("Flow definition does not trigger warnings #223", function () { verifyAndAssertMessages([ - "import { Map as $Map } from 'immutable';", - "function myFunction($state: $Map, { a, b, c } : { a: ?Object, b: ?Object, c: $Map }) {}" - ].join("\n"), + "import { Map as $Map } from 'immutable';", + "function myFunction($state: $Map, { a, b, c } : { a: ?Object, b: ?Object, c: $Map }) {}" + ].join("\n"), { "no-dupe-args": 1, "no-redeclare": 1, "no-shadow": 1 }, [] ); @@ -1500,16 +1500,16 @@ describe("verify", function () { it("newline-before-return with comments #289", function () { verifyAndAssertMessages([ - "function a() {", - "if (b) {", - "/* eslint-disable no-console */", - "console.log('test');", - "/* eslint-enable no-console */", - "}", - "", - "return hasGlobal;", - "}" - ].join("\n"), + "function a() {", + "if (b) {", + "/* eslint-disable no-console */", + "console.log('test');", + "/* eslint-enable no-console */", + "}", + "", + "return hasGlobal;", + "}" + ].join("\n"), { "newline-before-return": 1 }, [] ); From 313388b293ebf5db8d909b9113eedabc806f7d35 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 3 Aug 2016 09:36:15 -0400 Subject: [PATCH 312/569] typo --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 12f568b375ea..1eaf5440e96a 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -22,7 +22,7 @@ "bootstrap": "git submodule update --init && cd eslint && npm install", "eslint": "cd eslint && mocha -c tests/lib/rules/*.js -r ../eslint-tester.js", "test": "mocha", - "test-ci" "npm test && npm run lint", + "test-ci": "npm test && npm run lint", "lint": "eslint index.js babylon-to-espree test", "fix": "eslint index.js babylon-to-espree test --fix", "preversion": "npm test", From 9c70c76cfdf7bde99500a9bd350ea0ba3cf0fb7c Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 9 Sep 2016 11:26:47 -0400 Subject: [PATCH 313/569] add deps for npm 2 --- eslint/babel-eslint-parser/package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 1eaf5440e96a..ec432f4f72bc 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -40,6 +40,8 @@ "devDependencies": { "eslint": "^3.0.0", "eslint-config-babel": "^1.0.1", + "eslint-plugin-babel": "^3.3.0", + "eslint-plugin-flow-vars": "^0.5.0", "espree": "^3.0.0", "mocha": "^3.0.0" } From f97d83d8471ac46b94e92f66f577a72d44384aeb Mon Sep 17 00:00:00 2001 From: Dan Harper Date: Fri, 9 Sep 2016 16:28:19 +0100 Subject: [PATCH 314/569] eslint-plugin-flow-vars -> eslint-plugin-flowtype (babel/babel-eslint#374) [skip ci] --- eslint/babel-eslint-parser/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index 5eadb475df29..1f6e3e350ff3 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -17,7 +17,7 @@ For questions and support please visit the [`#linting`](https://babeljs.slack.co ## Known Issues Flow: -> Check out [eslint-plugin-flow-vars](https://github.com/zertosh/eslint-plugin-flow-vars): An `eslint` plugin that makes flow type annotations global variables and marks declarations as used. Solves the problem of false positives with `no-undef` and `no-unused-vars`. +> Check out [eslint-plugin-flowtype](https://github.com/gajus/eslint-plugin-flowtype): An `eslint` plugin that makes flow type annotations global variables and marks declarations as used. Solves the problem of false positives with `no-undef` and `no-unused-vars`. - `no-undef` for global flow types: `ReactElement`, `ReactClass` [#130](https://github.com/babel/babel-eslint/issues/130#issuecomment-111215076) - Workaround: define types as globals in `.eslintrc` or define types and import them `import type ReactElement from './types'` - `no-unused-vars/no-undef` with Flow declarations (`declare module A {}`) [#132](https://github.com/babel/babel-eslint/issues/132#issuecomment-112815926) From 3d4e8cfea38116a3b26bfed5ad50d3ac65496a4b Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 27 Sep 2016 08:42:41 -0400 Subject: [PATCH 315/569] update test line number [skip ci] --- eslint/babel-eslint-parser/test/non-regression.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index e75a75a6edaa..7067c4d87a1e 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -54,7 +54,7 @@ describe("verify", function () { verifyAndAssertMessages( "module.exports = \"something\";", { "eol-last": 1, "semi": 1 }, - [ "1:2 Newline required at end of file but not found. eol-last" ] + [ "1:30 Newline required at end of file but not found. eol-last" ] ); }); From 93a73cc4837e20c0163c33181bf38dc1fad8b4f3 Mon Sep 17 00:00:00 2001 From: Greenkeeper Date: Tue, 27 Sep 2016 14:43:03 +0200 Subject: [PATCH 316/569] chore(package): update eslint to version 3.6.0 (babel/babel-eslint#392) https://greenkeeper.io/ --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index ec432f4f72bc..18c974d3b31b 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -38,7 +38,7 @@ }, "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { - "eslint": "^3.0.0", + "eslint": "^3.6.0", "eslint-config-babel": "^1.0.1", "eslint-plugin-babel": "^3.3.0", "eslint-plugin-flow-vars": "^0.5.0", From 2339c8af0f3583f48fa6f0bcd58940f6363ea494 Mon Sep 17 00:00:00 2001 From: Greenkeeper Date: Tue, 27 Sep 2016 14:43:14 +0200 Subject: [PATCH 317/569] chore(package): update espree to version 3.3.1 (babel/babel-eslint#394) https://greenkeeper.io/ --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 18c974d3b31b..1e7629eb9840 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -42,7 +42,7 @@ "eslint-config-babel": "^1.0.1", "eslint-plugin-babel": "^3.3.0", "eslint-plugin-flow-vars": "^0.5.0", - "espree": "^3.0.0", + "espree": "^3.3.1", "mocha": "^3.0.0" } } From 33343e6688ffd5ba206795b1960b9d756e0952ea Mon Sep 17 00:00:00 2001 From: Greenkeeper Date: Tue, 27 Sep 2016 14:43:22 +0200 Subject: [PATCH 318/569] chore(package): update babylon to version 6.11.2 (babel/babel-eslint#391) https://greenkeeper.io/ --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 1e7629eb9840..083c056c1eba 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -14,7 +14,7 @@ "dependencies": { "babel-traverse": "^6.0.20", "babel-types": "^6.0.19", - "babylon": "^6.0.18", + "babylon": "^6.11.2", "lodash.assign": "^4.0.0", "lodash.pickby": "^4.0.0" }, From ce6d9df1926e5086b4e4fd46b3ba7ec02e282e20 Mon Sep 17 00:00:00 2001 From: Ville Immonen Date: Tue, 27 Sep 2016 18:32:52 +0300 Subject: [PATCH 319/569] Remove the lodash.assign dependency (babel/babel-eslint#393) lodash.assign is deprecated: ``` npm WARN deprecated lodash.assign@4.2.0: This package is deprecated. Use Object.assign. ``` --- eslint/babel-eslint-parser/index.js | 7 +++---- eslint/babel-eslint-parser/package.json | 1 - eslint/babel-eslint-parser/test/integration.js | 7 +++---- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index f41deb047605..643f82156ef5 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -1,5 +1,4 @@ var babylonToEspree = require("./babylon-to-espree"); -var assign = require("lodash.assign"); var pick = require("lodash.pickby"); var Module = require("module"); var path = require("path"); @@ -54,13 +53,13 @@ function monkeypatch() { // monkeypatch estraverse estraverse = estraverseRelative.require("estraverse"); estraverses.push(estraverse); - assign(estraverse.VisitorKeys, t.VISITOR_KEYS); + Object.assign(estraverse.VisitorKeys, t.VISITOR_KEYS); // monkeypatch estraverse-fb (only for eslint < 2.3.0) try { var estraverseFb = eslintMod.require("estraverse-fb"); estraverses.push(estraverseFb); - assign(estraverseFb.VisitorKeys, t.VISITOR_KEYS); + Object.assign(estraverseFb.VisitorKeys, t.VISITOR_KEYS); } catch (err) { // Ignore: ESLint v2.3.0 does not have estraverse-fb } @@ -69,7 +68,7 @@ function monkeypatch() { var estraverseOfEslint = eslintMod.require("estraverse"); if (estraverseOfEslint !== estraverseFb) { estraverses.push(estraverseOfEslint); - assign(estraverseOfEslint.VisitorKeys, t.VISITOR_KEYS); + Object.assign(estraverseOfEslint.VisitorKeys, t.VISITOR_KEYS); } estraverses.forEach(function (estraverse) { diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 083c056c1eba..545de6ebe87b 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -15,7 +15,6 @@ "babel-traverse": "^6.0.20", "babel-types": "^6.0.19", "babylon": "^6.11.2", - "lodash.assign": "^4.0.0", "lodash.pickby": "^4.0.0" }, "scripts": { diff --git a/eslint/babel-eslint-parser/test/integration.js b/eslint/babel-eslint-parser/test/integration.js index f3f09522e47d..b7f735121a6e 100644 --- a/eslint/babel-eslint-parser/test/integration.js +++ b/eslint/babel-eslint-parser/test/integration.js @@ -1,5 +1,4 @@ var assert = require("assert"); -var assign = require("lodash.assign"); var eslint = require("eslint"); var fs = require("fs"); var path = require("path"); @@ -56,7 +55,7 @@ function strictSuite () { var ruleId = "strict"; describe("when set to 'never'", function () { - var eslintOpts = assign({}, baseEslintOpts, { + var eslintOpts = Object.assign({}, baseEslintOpts, { rules: {}, }); eslintOpts.rules[ruleId] = [errorLevel, "never"]; @@ -81,7 +80,7 @@ function strictSuite () { // describe describe("when set to 'global'", function () { - var eslintOpts = assign({}, baseEslintOpts, { + var eslintOpts = Object.assign({}, baseEslintOpts, { rules: {} }); eslintOpts.rules[ruleId] = [errorLevel, "global"]; @@ -145,7 +144,7 @@ function strictSuite () { // describe describe("when set to 'function'", function () { - var eslintOpts = assign({}, baseEslintOpts, { + var eslintOpts = Object.assign({}, baseEslintOpts, { rules: {} }); eslintOpts.rules[ruleId] = [errorLevel, "function"]; From 3c414db3125335ef0486619c71beca07fa4b0582 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 27 Sep 2016 12:32:10 -0400 Subject: [PATCH 320/569] remove eslint 2 logic (babel/babel-eslint#361) * remove old code * remove async/await logic before eslint supported it * not needed --- .../babylon-to-espree/toAST.js | 12 ----- eslint/babel-eslint-parser/index.js | 50 +++++-------------- .../babel-eslint-parser/test/babel-eslint.js | 10 +++- .../test/non-regression.js | 2 +- 4 files changed, 22 insertions(+), 52 deletions(-) diff --git a/eslint/babel-eslint-parser/babylon-to-espree/toAST.js b/eslint/babel-eslint-parser/babylon-to-espree/toAST.js index 388253f1d06e..caa6a4e4cbac 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/toAST.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/toAST.js @@ -202,11 +202,6 @@ var astTransformVisitor = { } } - // async function as generator - if (path.isFunction()) { - if (node.async) node.generator = true; - } - // TODO: remove (old esprima) if (path.isFunction()) { if (!node.defaults) { @@ -214,13 +209,6 @@ var astTransformVisitor = { } } - // await transform to yield - if (path.isAwaitExpression()) { - node.type = "YieldExpression"; - node.delegate = node.all; - delete node.all; - } - // template string range fixes if (path.isTemplateLiteral()) { node.quasis.forEach(function (q) { diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 643f82156ef5..048cdbaca37b 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -1,13 +1,12 @@ var babylonToEspree = require("./babylon-to-espree"); -var pick = require("lodash.pickby"); -var Module = require("module"); -var path = require("path"); -var parse = require("babylon").parse; -var t = require("babel-types"); -var tt = require("babylon").tokTypes; -var traverse = require("babel-traverse").default; - -var estraverse; +var pick = require("lodash.pickby"); +var Module = require("module"); +var path = require("path"); +var parse = require("babylon").parse; +var t = require("babel-types"); +var tt = require("babylon").tokTypes; +var traverse = require("babel-traverse").default; + var hasPatched = false; var eslintOptions = {}; @@ -37,39 +36,12 @@ function monkeypatch() { // get modules relative to what eslint will load var eslintMod = createModule(eslintLoc); - var escopeLoc = Module._resolveFilename("escope", eslintMod); - var escopeMod = createModule(escopeLoc); - - // npm 3: monkeypatch estraverse if it's in escope - var estraverseRelative = escopeMod; - try { - var esrecurseLoc = Module._resolveFilename("esrecurse", eslintMod); - estraverseRelative = createModule(esrecurseLoc); - } catch (err) {} - // contains all the instances of estraverse so we can modify them if necessary var estraverses = []; - - // monkeypatch estraverse - estraverse = estraverseRelative.require("estraverse"); - estraverses.push(estraverse); - Object.assign(estraverse.VisitorKeys, t.VISITOR_KEYS); - - // monkeypatch estraverse-fb (only for eslint < 2.3.0) - try { - var estraverseFb = eslintMod.require("estraverse-fb"); - estraverses.push(estraverseFb); - Object.assign(estraverseFb.VisitorKeys, t.VISITOR_KEYS); - } catch (err) { - // Ignore: ESLint v2.3.0 does not have estraverse-fb - } - // ESLint v1.9.0 uses estraverse directly to work around https://github.com/npm/npm/issues/9663 var estraverseOfEslint = eslintMod.require("estraverse"); - if (estraverseOfEslint !== estraverseFb) { - estraverses.push(estraverseOfEslint); - Object.assign(estraverseOfEslint.VisitorKeys, t.VISITOR_KEYS); - } + estraverses.push(estraverseOfEslint); + Object.assign(estraverseOfEslint.VisitorKeys, t.VISITOR_KEYS); estraverses.forEach(function (estraverse) { estraverse.VisitorKeys.MethodDefinition.push("decorators"); @@ -77,6 +49,8 @@ function monkeypatch() { }); // monkeypatch escope + var escopeLoc = Module._resolveFilename("escope", eslintMod); + var escopeMod = createModule(escopeLoc); var escope = require(escopeLoc); var analyze = escope.analyze; escope.analyze = function (ast, opts) { diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 956354803a09..1de61af7a056 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -56,7 +56,7 @@ function parseAndAssertSame(code) { range: true, comment: true, attachComment: true, - ecmaVersion: 6, + ecmaVersion: 8, sourceType: "module" }); var babylonAST = babelEslint.parse(code); @@ -455,5 +455,13 @@ describe("babylon-to-esprima", function () { parseAndAssertSame("var a = [ a, ...b ]"); parseAndAssertSame("var a = sum(...b)"); }); + + it("Async/Await", function() { + parseAndAssertSame( + `async function a() { + await 1; + }` + ); + }); }); }); diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 7067c4d87a1e..996cc66b2cb6 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -11,7 +11,7 @@ function verifyAndAssertMessages(code, rules, expectedMessages, sourceType, over es6: true }, parserOptions: { - ecmaVersion: 6, + ecmaVersion: 8, ecmaFeatures: { jsx: true, experimentalObjectRestSpread: true, From aa6c5ccd459794f059cf44575d1dd1bbb209704c Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 27 Sep 2016 12:34:26 -0400 Subject: [PATCH 321/569] updates --- eslint/babel-eslint-parser/package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 545de6ebe87b..439f15efe615 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -12,10 +12,10 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "babel-traverse": "^6.0.20", - "babel-types": "^6.0.19", + "babel-traverse": "^6.15.0", + "babel-types": "^6.15.0", "babylon": "^6.11.2", - "lodash.pickby": "^4.0.0" + "lodash.pickby": "^4.6.0" }, "scripts": { "bootstrap": "git submodule update --init && cd eslint && npm install", @@ -38,7 +38,7 @@ "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { "eslint": "^3.6.0", - "eslint-config-babel": "^1.0.1", + "eslint-config-babel": "^1.0.2", "eslint-plugin-babel": "^3.3.0", "eslint-plugin-flow-vars": "^0.5.0", "espree": "^3.3.1", From 8d48eecc2f101108e5d2c4b6c34220491b3f2f6e Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 27 Sep 2016 12:35:24 -0400 Subject: [PATCH 322/569] 7.0.0 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 439f15efe615..ad1b396ae4ff 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "6.1.2", + "version": "7.0.0", "description": "Custom parser for ESLint", "main": "index.js", "files": [ From 994eea7a534bde77bc4a6449ce7de0d4c67e6920 Mon Sep 17 00:00:00 2001 From: Nick Date: Thu, 29 Sep 2016 21:25:35 +0100 Subject: [PATCH 323/569] docs: Update built-in support notes in README (babel/babel-eslint#398) [skip ci] * docs: Update built-in support notes in README eslint v3.6.0 supports ES2017 features * docs: Update built-in support notes in README eslint v3.6.0 supports ES2017 features --- eslint/babel-eslint-parser/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index 1f6e3e350ff3..a26f0baf163a 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -4,15 +4,15 @@ **babel-eslint** allows you to lint **ALL** valid Babel code with the fantastic [ESLint](https://github.com/eslint/eslint). -#### Note: You don't need to use babel-eslint if you are only using ES6/ES2015. ESLint actually supports ES6/ES7, JSX, and object rest/spread by default now. +#### Note: You don't need to use babel-eslint if you are using ES2015 (ES6), ES2016 (ES7) or ES2017 (ES8). ESLint actually supports ES2015/ES2016/ES2017, JSX, and object rest/spread by default now. -##### At the moment, you'll need it if you use stuff like class properties, decorators, async/await, types. +##### At the moment, you'll need it if you use stuff like class properties, decorators, types. > If there is an issue, first check if it can be reproduced with the regular parser or with the latest versions of `eslint` and `babel-eslint`! For questions and support please visit the [`#linting`](https://babeljs.slack.com/messages/linting/) babel slack channel (sign up [here](https://babel-slack.herokuapp.com))! -> Note that the `ecmaFeatures` config property may still be required for ESLint to work properly with features not in ECMAScript 5 by default. Examples are `globalReturn` and `modules`) +> Note that the `ecmaFeatures` config property may still be required for ESLint to work properly with features not in ECMAScript 5 by default. Examples are `globalReturn` and `modules`). ## Known Issues From 610cf28dab873bf65cab70498aec168279b69bdb Mon Sep 17 00:00:00 2001 From: Greenkeeper Date: Mon, 10 Oct 2016 14:36:10 +0200 Subject: [PATCH 324/569] =?UTF-8?q?Update=20eslint-config-babel=20to=20ver?= =?UTF-8?q?sion=202.0.1=20=F0=9F=9A=80=20(babel/babel-eslint#408)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(package): update eslint-config-babel to version 2.0.1 https://greenkeeper.io/ * Fix plugin --- eslint/babel-eslint-parser/package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index ad1b396ae4ff..67d0dc49f2c7 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -37,10 +37,11 @@ }, "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { + "babel-eslint": "^7.0.0", "eslint": "^3.6.0", - "eslint-config-babel": "^1.0.2", + "eslint-config-babel": "^2.0.1", "eslint-plugin-babel": "^3.3.0", - "eslint-plugin-flow-vars": "^0.5.0", + "eslint-plugin-flowtype": "^2.4.0", "espree": "^3.3.1", "mocha": "^3.0.0" } From 31f48f0651a8ab3ca2124ace770ef03bd706a5e4 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Sat, 15 Oct 2016 11:04:55 +0200 Subject: [PATCH 325/569] Update test for eslint 3.8 (babel/babel-eslint#412) * Update test for eslint 3.8 also ignore yarn lock * Run lint only on latest version --- eslint/babel-eslint-parser/.gitignore | 1 + eslint/babel-eslint-parser/.travis.yml | 17 +++++++++++------ eslint/babel-eslint-parser/package.json | 4 ++-- .../babel-eslint-parser/test/non-regression.js | 2 +- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/eslint/babel-eslint-parser/.gitignore b/eslint/babel-eslint-parser/.gitignore index 93f136199161..2d6ddb5d003c 100644 --- a/eslint/babel-eslint-parser/.gitignore +++ b/eslint/babel-eslint-parser/.gitignore @@ -1,2 +1,3 @@ node_modules npm-debug.log +yarn.lock diff --git a/eslint/babel-eslint-parser/.travis.yml b/eslint/babel-eslint-parser/.travis.yml index 9f2b522cd50e..7f84d147a4d2 100644 --- a/eslint/babel-eslint-parser/.travis.yml +++ b/eslint/babel-eslint-parser/.travis.yml @@ -1,11 +1,16 @@ -git: - depth: 1 sudo: false language: node_js +node_js: + - "4" + - "5" + - "6" + matrix: + fast_finish: true include: - - node_js: "4" - - node_js: "5" - - node_js: "6" + - node_js: "node" + env: LINT=true -script: npm run test-ci +script: + - 'if [ -n "${LINT-}" ]; then npm run lint ; fi' + - 'if [ -z "${LINT-}" ]; then npm test ; fi' diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 67d0dc49f2c7..b3fd1282edd9 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -20,8 +20,8 @@ "scripts": { "bootstrap": "git submodule update --init && cd eslint && npm install", "eslint": "cd eslint && mocha -c tests/lib/rules/*.js -r ../eslint-tester.js", - "test": "mocha", - "test-ci": "npm test && npm run lint", + "test": "npm run lint && npm run test-only", + "test-only": "mocha", "lint": "eslint index.js babylon-to-espree test", "fix": "eslint index.js babylon-to-espree test --fix", "preversion": "npm test", diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 996cc66b2cb6..4ddead6e2083 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1196,7 +1196,7 @@ describe("verify", function () { verifyAndAssertMessages( "const {Bacona} = require('baconjs')", { "no-undef": 1, "no-unused-vars": 1 }, - [ "1:8 'Bacona' is defined but never used. no-unused-vars" ] + [ "1:8 'Bacona' is assigned a value but never used. no-unused-vars" ] ); }); From 1f04cab99fce5777b746b501f796a82955dc2e1c Mon Sep 17 00:00:00 2001 From: Steven Job Date: Mon, 17 Oct 2016 19:27:20 +0100 Subject: [PATCH 326/569] Now using template strings (babel/babel-eslint#410) * Use template strings in non-regression tests * Refactor non-regression tests to fix test failures Moved backtick to fix test 'getter/setter babel/babel-eslint#218' as indent matters Fixed line numbers for some tests * Use template strings in babel-eslint tests * Fix tests for babel-eslint Avoids error that shows when using template strings for tests: line 253 line comments line 260 block comments line 306 jsdoc Error: At loc.start.column: are different (6 !== 0) * Other small template literal changes * Add unpad to correctly indent template literals --- .../babylon-to-espree/toAST.js | 2 +- .../babylon-to-espree/toToken.js | 2 +- eslint/babel-eslint-parser/index.js | 2 +- .../babel-eslint-parser/test/babel-eslint.js | 299 +++-- .../babel-eslint-parser/test/integration.js | 3 +- .../test/non-regression.js | 1156 +++++++++-------- eslint/babel-eslint-parser/utils/unpad.js | 14 + 7 files changed, 776 insertions(+), 702 deletions(-) create mode 100644 eslint/babel-eslint-parser/utils/unpad.js diff --git a/eslint/babel-eslint-parser/babylon-to-espree/toAST.js b/eslint/babel-eslint-parser/babylon-to-espree/toAST.js index caa6a4e4cbac..77190f369589 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/toAST.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/toAST.js @@ -160,7 +160,7 @@ var astTransformVisitor = { } if (path.isRestProperty() || path.isSpreadProperty()) { - node.type = "Experimental" + node.type; + node.type = `Experimental${node.type}`; } if (path.isTypeParameter && path.isTypeParameter()) { diff --git a/eslint/babel-eslint-parser/babylon-to-espree/toToken.js b/eslint/babel-eslint-parser/babylon-to-espree/toToken.js index 7e13f28e0c8a..dcfd48f87cc1 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/toToken.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/toToken.js @@ -53,7 +53,7 @@ module.exports = function (token, tt, source) { pattern: value.pattern, flags: value.flags }; - token.value = "/" + value.pattern + "/" + value.flags; + token.value = `/${value.pattern}/${value.flags}`; } return token; diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 048cdbaca37b..ab2c3e7a0900 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -396,7 +396,7 @@ exports.parseNoPatch = function (code, options) { err.column = err.loc.column + 1; // remove trailing "(LINE:COLUMN)" acorn message and add in esprima syntax error message start - err.message = "Line " + err.lineNumber + ": " + err.message.replace(/ \((\d+):(\d+)\)$/, ""); + err.message = `Line ${err.lineNumber}: ${err.message.replace(/ \((\d+):(\d+)\)$/, "")}`; } throw err; diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 1de61af7a056..65e70b10aec6 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -2,6 +2,7 @@ var assert = require("assert"); var babelEslint = require(".."); var espree = require("espree"); var util = require("util"); +var unpad = require("../utils/unpad"); // Checks if the source ast implements the target ast. Ignores extra keys on source ast function assertImplementsAST(target, source, path) { @@ -10,7 +11,7 @@ function assertImplementsAST(target, source, path) { } function error(text) { - var err = new Error("At " + path.join(".") + ": " + text + ":"); + var err = new Error(`At ${path.join(".")}: ${text}:`); err.depth = path.length + 1; throw err; } @@ -18,7 +19,7 @@ function assertImplementsAST(target, source, path) { var typeA = target === null ? "null" : typeof target; var typeB = source === null ? "null" : typeof source; if (typeA !== typeB) { - error("have different types (" + typeA + " !== " + typeB + ") " + "(" + target + " !== " + source + ")"); + error(`have different types (${typeA} !== ${typeB}) (${target} !== ${source})`); } else if (typeA === "object") { var keysTarget = Object.keys(target); for (var i in keysTarget) { @@ -28,7 +29,7 @@ function assertImplementsAST(target, source, path) { path.pop(); } } else if (target !== source) { - error("are different (" + JSON.stringify(target) + " !== " + JSON.stringify(source) + ")"); + error(`are different (${JSON.stringify(target)} !== ${JSON.stringify(source)})`); } } @@ -70,11 +71,12 @@ function parseAndAssertSame(code) { if (babylonAST.tokens) { delete babylonAST.tokens; } - err.message += - "\nespree:\n" + - util.inspect(lookup(esAST, traversal, 2), {depth: err.depth, colors: true}) + - "\nbabel-eslint:\n" + - util.inspect(lookup(babylonAST, traversal, 2), {depth: err.depth, colors: true}); + err.message += unpad(` + espree: + ${util.inspect(lookup(esAST, traversal, 2), {depth: err.depth, colors: true})} + babel-eslint: + ${util.inspect(lookup(babylonAST, traversal, 2), {depth: err.depth, colors: true})} + `); throw err; } // assert.equal(esAST, babylonAST); @@ -132,25 +134,29 @@ describe("babylon-to-esprima", function () { it("template also with braces #96", function () { parseAndAssertSame( - "export default function f1() {" + - "function f2(foo) {" + - "const bar = 3;" + - "return `${foo} ${bar}`;" + - "}" + - "return f2;" + - "}" + unpad(` + export default function f1() { + function f2(foo) { + const bar = 3; + return \`\${foo} \${bar}\`; + } + return f2; + } + `) ); }); it("template with destructuring #31", function () { - parseAndAssertSame([ - "module.exports = {", - "render() {", - "var {name} = this.props;", - "return Math.max(null, `Name: ${name}, Name: ${name}`);", - "}", - "};" - ].join("\n")); + parseAndAssertSame( + unpad(` + module.exports = { + render() { + var {name} = this.props; + return Math.max(null, \`Name: \${name}, Name: \${name}\`); + } + }; + `) + ); }); }); @@ -251,34 +257,40 @@ describe("babylon-to-esprima", function () { }); it("line comments", function () { - parseAndAssertSame([ - " // single comment", - "var foo = 15; // comment next to statement", - "// second comment after statement" - ].join("\n")); + parseAndAssertSame( + unpad(` + // single comment + var foo = 15; // comment next to statement + // second comment after statement + `) + ); }); it("block comments", function () { - parseAndAssertSame([ - " /* single comment */ ", - "var foo = 15; /* comment next to statement */", - "/*", - " * multiline", - " * comment", - " */" - ].join("\n")); + parseAndAssertSame( + unpad(` + /* single comment */ + var foo = 15; /* comment next to statement */ + /* + * multiline + * comment + */ + `) + ); }); it("block comments #124", function () { - parseAndAssertSame([ - "React.createClass({", - "render() {", - "// return (", - "//
", - "// ); // <-- this is the line that is reported", - "}", - "});" - ].join("\n")); + parseAndAssertSame( + unpad(` + React.createClass({ + render() { + // return ( + //
+ // ); // <-- this is the line that is reported + } + }); + `) + ); }); it("null", function () { @@ -306,76 +318,87 @@ describe("babylon-to-esprima", function () { }); it("jsdoc", function () { - parseAndAssertSame([ - "/**", - "* @param {object} options", - "* @return {number}", - "*/", - "const test = function({ a, b, c }) {", - "return a + b + c;", - "};", - "module.exports = test;" - ].join("\n")); + parseAndAssertSame( + unpad(` + /** + * @param {object} options + * @return {number} + */ + const test = function({ a, b, c }) { + return a + b + c; + }; + module.exports = test; + `) + ); }); it("empty block with comment", function () { - parseAndAssertSame([ - "function a () {", - "try {", - "b();", - "} catch (e) {", - "// asdf", - "}", - "}" - ].join("\n")); + parseAndAssertSame( + unpad(` + function a () { + try { + b(); + } catch (e) { + // asdf + } + } + `) + ); }); describe("babel 6 tests", function () { it("MethodDefinition", function () { - parseAndAssertSame([ - "export default class A {", - "a() {}", - "}" - ].join("\n")); + parseAndAssertSame( + unpad(` + export default class A { + a() {} + } + `) + ); }); it("MethodDefinition 2", function () { - parseAndAssertSame([ - "export default class Bar { get bar() { return 42; }}" - ].join("\n")); + parseAndAssertSame("export default class Bar { get bar() { return 42; }}"); }); it("ClassMethod", function () { - parseAndAssertSame([ - "class A {", - "constructor() {", - "}", - "}" - ].join("\n")); + parseAndAssertSame( + unpad(` + class A { + constructor() { + } + } + `) + ); }); it("ClassMethod multiple params", function () { - parseAndAssertSame([ - "class A {", - "constructor(a, b, c) {", - "}", - "}" - ].join("\n")); + parseAndAssertSame( + unpad(` + class A { + constructor(a, b, c) { + } + } + `) + ); }); it("ClassMethod multiline", function () { - parseAndAssertSame([ - "class A {", - " constructor (", - " a,", - " b,", - " c", - " )", - "{", - "", - " }", - "}" - ].join("\n")); + parseAndAssertSame( + unpad(` + class A { + constructor ( + a, + b, + c + ) + + { + + } + } + `) + ); }); it("ClassMethod oneline", function () { @@ -383,12 +406,14 @@ describe("babylon-to-esprima", function () { }); it("ObjectMethod", function () { - parseAndAssertSame([ - "var a = {", - "b(c) {", - "}", - "}" - ].join("\n")); + parseAndAssertSame( + unpad(` + var a = { + b(c) { + } + } + `) + ); }); it("do not allow import export everywhere", function() { @@ -413,35 +438,41 @@ describe("babylon-to-esprima", function () { it("getters and setters", function () { parseAndAssertSame("class A { get x ( ) { ; } }"); - parseAndAssertSame([ - "class A {", - "get x(", - ")", - "{", - ";", - "}", - "}" - ].join("\n")); + parseAndAssertSame( + unpad(` + class A { + get x( + ) + { + ; + } + } + `) + ); parseAndAssertSame("class A { set x (a) { ; } }"); - parseAndAssertSame([ - "class A {", - "set x(a", - ")", - "{", - ";", - "}", - "}" - ].join("\n")); - parseAndAssertSame([ - "var B = {", - "get x () {", - "return this.ecks;", - "},", - "set x (ecks) {", - "this.ecks = ecks;", - "}", - "};" - ].join("\n")); + parseAndAssertSame( + unpad(` + class A { + set x(a + ) + { + ; + } + } + `) + ); + parseAndAssertSame( + unpad(` + var B = { + get x () { + return this.ecks; + }, + set x (ecks) { + this.ecks = ecks; + } + }; + `) + ); }); it("RestOperator", function () { @@ -458,9 +489,11 @@ describe("babylon-to-esprima", function () { it("Async/Await", function() { parseAndAssertSame( - `async function a() { - await 1; - }` + unpad(` + async function a() { + await 1; + } + `) ); }); }); diff --git a/eslint/babel-eslint-parser/test/integration.js b/eslint/babel-eslint-parser/test/integration.js index b7f735121a6e..2e62188e906f 100644 --- a/eslint/babel-eslint-parser/test/integration.js +++ b/eslint/babel-eslint-parser/test/integration.js @@ -61,8 +61,7 @@ function strictSuite () { eslintOpts.rules[ruleId] = [errorLevel, "never"]; ["global-with", "function-with"].forEach(function (fixture) { - it( - "should error on " + fixture.match(/^[^-]+/)[0] + " directive", + it(`should error on ${fixture.match(/^[^-]+/)[0]} directive`, function (done) { lint({ fixture: ["strict", fixture], diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 4ddead6e2083..2d563782d176 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1,6 +1,7 @@ /*eslint-env mocha*/ "use strict"; var eslint = require("eslint"); +var unpad = require("../utils/unpad"); function verifyAndAssertMessages(code, rules, expectedMessages, sourceType, overrideConfig) { var config = { @@ -30,13 +31,19 @@ function verifyAndAssertMessages(code, rules, expectedMessages, sourceType, over var messages = eslint.linter.verify(code, config); if (messages.length !== expectedMessages.length) { - throw new Error("Expected " + expectedMessages.length + " message(s), got " + messages.length + " " + JSON.stringify(messages)); + throw new Error(`Expected ${expectedMessages.length} message(s), got ${messages.length} ${JSON.stringify(messages)}`); } messages.forEach(function (message, i) { - var formatedMessage = message.line + ":" + message.column + " " + message.message + (message.ruleId ? " " + message.ruleId : ""); + var formatedMessage = `${message.line}:${message.column} ${message.message}${(message.ruleId ? ` ${message.ruleId}` : "")}`; if (formatedMessage !== expectedMessages[i]) { - throw new Error("Message " + i + " does not match:\nExpected: " + expectedMessages[i] + "\nActual: " + formatedMessage); + throw new Error( + unpad(` + Message ${i} does not match: + Expected: ${expectedMessages[i]} + Actual: ${formatedMessage} + `) + ); } }); } @@ -68,10 +75,12 @@ describe("verify", function () { it("Modules support (issue #5)", function () { verifyAndAssertMessages( - "import Foo from 'foo';\n" + - "export default Foo;\n" + - "export const c = 'c';\n" + - "export class Store {}", + unpad(` + import Foo from 'foo'; + export default Foo; + export const c = 'c'; + export class Store {} + `), {}, [] ); @@ -160,12 +169,13 @@ describe("verify", function () { }); it("comment with padded-blocks (issue #33)", function () { - verifyAndAssertMessages([ - "if (a){", - "// i'm a comment!", - "let b = c", - "}" - ].join("\n"), + verifyAndAssertMessages( + unpad(` + if (a) { + // i'm a comment! + let b = c + } + `), { "padded-blocks": [1, "never"] }, [] ); @@ -173,9 +183,8 @@ describe("verify", function () { describe("flow", function () { it("check regular function", function () { - verifyAndAssertMessages([ + verifyAndAssertMessages( "function a(b, c) { b += 1; c += 1; return b + c; } a;", - ].join("\n"), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -198,209 +207,225 @@ describe("verify", function () { }); it("multiple nullable type annotations and return #108", function () { - verifyAndAssertMessages([ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "import type Foo3 from 'foo';", - "function log(foo: ?Foo, foo2: ?Foo2): ?Foo3 {", - "console.log(foo, foo2);", - "}", - "log(1, 2);" - ].join("\n"), + verifyAndAssertMessages( + unpad(` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + import type Foo3 from 'foo'; + function log(foo: ?Foo, foo2: ?Foo2): ?Foo3 { + console.log(foo, foo2); + } + log(1, 2); + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("type parameters", function () { - verifyAndAssertMessages([ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "function log(a: T1, b: T2) { return a + b; }", - "log(1, 2);" - ].join("\n"), + verifyAndAssertMessages( + unpad(` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + function log(a: T1, b: T2) { return a + b; } + log(1, 2); + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("nested type annotations", function () { - verifyAndAssertMessages([ - "import type Foo from 'foo';", - "function foo(callback: () => Foo) {", - "return callback();", - "}", - "foo();" - ].join("\n"), + verifyAndAssertMessages( + unpad(` + import type Foo from 'foo'; + function foo(callback: () => Foo) { + return callback(); + } + foo(); + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("type in var declaration", function () { - verifyAndAssertMessages([ - "import type Foo from 'foo';", - "var x: Foo = 1;", - "x;" - ].join("\n"), + verifyAndAssertMessages( + unpad(` + import type Foo from 'foo'; + var x: Foo = 1; + x; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("object type annotation", function () { - verifyAndAssertMessages([ - "import type Foo from 'foo';", - "var a: {numVal: Foo};", - "a;" - ].join("\n"), + verifyAndAssertMessages( + unpad(` + import type Foo from 'foo'; + var a: {numVal: Foo}; + a; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("object property types", function () { - verifyAndAssertMessages([ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "var a = {", - "circle: (null : ?{ setNativeProps(props: Foo): Foo2 })", - "};", - "a;" - ].join("\n"), + verifyAndAssertMessages( + unpad(` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + var a = { + circle: (null : ?{ setNativeProps(props: Foo): Foo2 }) + }; + a; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("namespaced types", function () { - verifyAndAssertMessages([ - "var React = require('react-native');", - "var b = {", - "openExternalExample: (null: ?React.Component)", - "};", - "var c = {", - "render(): React.Component {}", - "};", - "b;", - "c;" - ].join("\n"), + verifyAndAssertMessages( + unpad(` + var React = require('react-native'); + var b = { + openExternalExample: (null: ?React.Component) + }; + var c = { + render(): React.Component {} + }; + b; + c; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("ArrayTypeAnnotation", function () { - verifyAndAssertMessages([ - "import type Foo from 'foo';", - "var x: Foo[]; x;" - ].join("\n"), + verifyAndAssertMessages( + unpad(` + import type Foo from 'foo'; + var x: Foo[]; x; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("ClassImplements", function () { - verifyAndAssertMessages([ - "import type Bar from 'foo';", - "export default class Foo implements Bar {}" - ].join("\n"), + verifyAndAssertMessages( + unpad(` + import type Bar from 'foo'; + export default class Foo implements Bar {} + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("type alias creates declaration + usage", function () { - verifyAndAssertMessages([ - "type Foo = any;", - "var x : Foo = 1; x;" - ].join("\n"), + verifyAndAssertMessages( + unpad(` + type Foo = any; + var x : Foo = 1; x; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("type alias with type parameters", function () { - verifyAndAssertMessages([ - "import type Bar from 'foo';", - "import type Foo3 from 'foo';", - "type Foo = Bar", - "var x : Foo = 1; x;" - ].join("\n"), + verifyAndAssertMessages( + unpad(` + import type Bar from 'foo'; + import type Foo3 from 'foo'; + type Foo = Bar + var x : Foo = 1; x; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("export type alias", function () { - verifyAndAssertMessages([ - "import type Foo2 from 'foo';", - "export type Foo = Foo2;" - ].join("\n"), + verifyAndAssertMessages( + unpad(` + import type Foo2 from 'foo'; + export type Foo = Foo2; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("polymorphpic types #109", function () { - verifyAndAssertMessages([ - "export default function groupByEveryN(array: Array, n: number): Array> { n; }" - ].join("\n"), + verifyAndAssertMessages( + "export default function groupByEveryN(array: Array, n: number): Array> { n; }", { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("types definition from import", function () { - verifyAndAssertMessages([ - "import type Promise from 'bluebird';", - "type Operation = () => Promise;", - "x: Operation;" - ].join("\n"), + verifyAndAssertMessages( + unpad(` + import type Promise from 'bluebird'; + type Operation = () => Promise; + x: Operation; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("polymorphpic/generic types for class #123", function () { - verifyAndAssertMessages([ - "class Box {", - "value: T;", - "}", - "var box = new Box();", - "console.log(box.value);" - ].join("\n"), + verifyAndAssertMessages( + unpad(` + class Box { + value: T; + } + var box = new Box(); + console.log(box.value); + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("polymorphpic/generic types for function #123", function () { - verifyAndAssertMessages([ - "export function identity(value) {", - "var a: T = value; a;", - "}" - ].join("\n"), + verifyAndAssertMessages( + unpad(` + export function identity(value) { + var a: T = value; a; + } + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("polymorphpic/generic types for type alias #123", function () { - verifyAndAssertMessages([ - "import Bar from './Bar';", - "type Foo = Bar; var x: Foo = 1; console.log(x);" - ].join("\n"), + verifyAndAssertMessages( + unpad(` + import Bar from './Bar'; + type Foo = Bar; var x: Foo = 1; console.log(x); + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); }); it("polymorphpic/generic types - outside of fn scope #123", function () { - verifyAndAssertMessages([ - "export function foo(value) { value; };", - "var b: T = 1; b;" - ].join("\n"), + verifyAndAssertMessages( + unpad(` + export function foo(value) { value; }; + var b: T = 1; b; + `), { "no-unused-vars": 1, "no-undef": 1 }, [ "1:21 'T' is defined but never used. no-unused-vars", "2:8 'T' is not defined. no-undef" ] @@ -408,23 +433,25 @@ describe("verify", function () { }); it("polymorphpic/generic types - extending unknown #123", function () { - verifyAndAssertMessages([ - "import Bar from 'bar';", - "export class Foo extends Bar {}", - ].join("\n"), + verifyAndAssertMessages( + unpad(` + import Bar from 'bar'; + export class Foo extends Bar {} + `), { "no-unused-vars": 1, "no-undef": 1 }, [ "2:30 'T' is not defined. no-undef" ] ); }); it("support declarations #132", function () { - verifyAndAssertMessages([ - "declare class A { static () : number }", - "declare module B { declare var x: number; }", - "declare function foo(): void;", - "declare var bar", - "A; B; foo(); bar;" - ].join("\n"), + verifyAndAssertMessages( + unpad(` + declare class A { static () : number } + declare module B { declare var x: number; } + declare function foo(): void; + declare var bar + A; B; foo(); bar; + `), { "no-undef": 1, "no-unused-vars": 1 }, [] ); @@ -432,11 +459,11 @@ describe("verify", function () { it("1", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "export default function(a: Foo, b: ?Foo2, c){ a; b; c; }" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + export default function(a: Foo, b: ?Foo2, c){ a; b; c; } + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -444,10 +471,10 @@ describe("verify", function () { it("2", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "export default function(a: () => Foo){ a; }" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + export default function(a: () => Foo){ a; } + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -455,11 +482,11 @@ describe("verify", function () { it("3", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "export default function(a: (_:Foo) => Foo2){ a; }" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + export default function(a: (_:Foo) => Foo2){ a; } + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -467,12 +494,12 @@ describe("verify", function () { it("4", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "import type Foo3 from 'foo';", - "export default function(a: (_1:Foo, _2:Foo2) => Foo3){ a; }" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + import type Foo3 from 'foo'; + export default function(a: (_1:Foo, _2:Foo2) => Foo3){ a; } + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -480,11 +507,11 @@ describe("verify", function () { it("5", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "export default function(a: (_1:Foo, ...foo:Array) => number){ a; }" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + export default function(a: (_1:Foo, ...foo:Array) => number){ a; } + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -492,10 +519,10 @@ describe("verify", function () { it("6", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "export default function(): Foo {}" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + export default function(): Foo {} + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -503,10 +530,10 @@ describe("verify", function () { it("7", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "export default function():() => Foo {}" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + export default function():() => Foo {} + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -514,11 +541,11 @@ describe("verify", function () { it("8", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "export default function():(_?:Foo) => Foo2{}" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + export default function():(_?:Foo) => Foo2{} + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -526,9 +553,7 @@ describe("verify", function () { it("9", function () { verifyAndAssertMessages( - [ - "export default function (a: T1, b: T2) { b; }" - ].join("\n"), + "export default function (a: T1, b: T2) { b; }", { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -536,9 +561,7 @@ describe("verify", function () { it("10", function () { verifyAndAssertMessages( - [ - "var a=function(a: T1, b: T2) {return a + b;}; a;" - ].join("\n"), + "var a=function(a: T1, b: T2) {return a + b;}; a;", { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -546,9 +569,7 @@ describe("verify", function () { it("11", function () { verifyAndAssertMessages( - [ - "var a={*id(x: T): T { x; }}; a;" - ].join("\n"), + "var a={*id(x: T): T { x; }}; a;", { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -556,9 +577,7 @@ describe("verify", function () { it("12", function () { verifyAndAssertMessages( - [ - "var a={async id(x: T): T { x; }}; a;" - ].join("\n"), + "var a={async id(x: T): T { x; }}; a;", { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -566,9 +585,7 @@ describe("verify", function () { it("13", function () { verifyAndAssertMessages( - [ - "var a={123(x: T): T { x; }}; a;" - ].join("\n"), + "var a={123(x: T): T { x; }}; a;", { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -576,11 +593,11 @@ describe("verify", function () { it("14", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "export default class Bar {set fooProp(value:Foo):Foo2{ value; }}" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + export default class Bar {set fooProp(value:Foo):Foo2{ value; }} + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -588,10 +605,10 @@ describe("verify", function () { it("15", function () { verifyAndAssertMessages( - [ - "import type Foo2 from 'foo';", - "export default class Foo {get fooProp(): Foo2{}}" - ].join("\n"), + unpad(` + import type Foo2 from 'foo'; + export default class Foo {get fooProp(): Foo2{}} + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -599,10 +616,10 @@ describe("verify", function () { it("16", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "var numVal:Foo; numVal;" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + var numVal:Foo; numVal; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -610,10 +627,10 @@ describe("verify", function () { it("17", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "var a: {numVal: Foo;}; a;" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + var a: {numVal: Foo;}; a; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -621,12 +638,12 @@ describe("verify", function () { it("18", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "import type Foo3 from 'foo';", - "var a: ?{numVal: Foo; [indexer: Foo2]: Foo3}; a;" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + import type Foo3 from 'foo'; + var a: ?{numVal: Foo; [indexer: Foo2]: Foo3}; a; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -634,11 +651,11 @@ describe("verify", function () { it("19", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "var a: {numVal: Foo; subObj?: ?{strVal: Foo2}}; a;" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + var a: {numVal: Foo; subObj?: ?{strVal: Foo2}}; a; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -646,13 +663,13 @@ describe("verify", function () { it("20", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "import type Foo3 from 'foo';", - "import type Foo4 from 'foo';", - "var a: { [a: Foo]: Foo2; [b: Foo3]: Foo4; }; a;" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + import type Foo3 from 'foo'; + import type Foo4 from 'foo'; + var a: { [a: Foo]: Foo2; [b: Foo3]: Foo4; }; a; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -660,12 +677,12 @@ describe("verify", function () { it("21", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "import type Foo3 from 'foo';", - "var a: {add(x:Foo, ...y:Array): Foo3}; a;" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + import type Foo3 from 'foo'; + var a: {add(x:Foo, ...y:Array): Foo3}; a; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -673,12 +690,12 @@ describe("verify", function () { it("22", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "import type Foo3 from 'foo';", - "var a: { id(x: Foo2): Foo3; }; a;" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + import type Foo3 from 'foo'; + var a: { id(x: Foo2): Foo3; }; a; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -686,10 +703,10 @@ describe("verify", function () { it("23", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "var a:Array = [1, 2, 3]; a;" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + var a:Array = [1, 2, 3]; a; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -697,10 +714,10 @@ describe("verify", function () { it("24", function () { verifyAndAssertMessages( - [ - "import type Baz from 'baz';", - "export default class Bar extends Baz { };" - ].join("\n"), + unpad(` + import type Baz from 'baz'; + export default class Bar extends Baz { }; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -708,9 +725,7 @@ describe("verify", function () { it("25", function () { verifyAndAssertMessages( - [ - "export default class Bar { bar(): T { return 42; }}" - ].join("\n"), + "export default class Bar { bar(): T { return 42; }}", { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -718,11 +733,11 @@ describe("verify", function () { it("26", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "export default class Bar { static prop1:Foo; prop2:Foo2; }" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + export default class Bar { static prop1:Foo; prop2:Foo2; } + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -730,11 +745,11 @@ describe("verify", function () { it("27", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "var x : Foo | Foo2 = 4; x;" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + var x : Foo | Foo2 = 4; x; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -742,11 +757,11 @@ describe("verify", function () { it("28", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "var x : () => Foo | () => Foo2; x;" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + var x : () => Foo | () => Foo2; x; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -754,11 +769,11 @@ describe("verify", function () { it("29", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "var x: typeof Foo | number = Foo2; x;" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + var x: typeof Foo | number = Foo2; x; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -766,10 +781,10 @@ describe("verify", function () { it("30", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "var {x}: {x: Foo; } = { x: 'hello' }; x;" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + var {x}: {x: Foo; } = { x: 'hello' }; x; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -777,10 +792,10 @@ describe("verify", function () { it("31", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "var [x]: Array = [ 'hello' ]; x;" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + var [x]: Array = [ 'hello' ]; x; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -788,10 +803,10 @@ describe("verify", function () { it("32", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "export default function({x}: { x: Foo; }) { x; }" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + export default function({x}: { x: Foo; }) { x; } + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -799,10 +814,10 @@ describe("verify", function () { it("33", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "function foo([x]: Array) { x; } foo();" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + function foo([x]: Array) { x; } foo(); + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -810,11 +825,11 @@ describe("verify", function () { it("34", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "var a: Map >; a;" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + var a: Map >; a; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -822,10 +837,10 @@ describe("verify", function () { it("35", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "var a: ?Promise[]; a;" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + var a: ?Promise[]; a; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -833,11 +848,11 @@ describe("verify", function () { it("36", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "var a:(...rest:Array) => Foo2; a;" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + var a:(...rest:Array) => Foo2; a; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -845,13 +860,13 @@ describe("verify", function () { it("37", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "import type Foo3 from 'foo';", - "import type Foo4 from 'foo';", - "var a: (x: Foo2, ...y:Foo3[]) => Foo4; a;" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + import type Foo3 from 'foo'; + import type Foo4 from 'foo'; + var a: (x: Foo2, ...y:Foo3[]) => Foo4; a; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -859,10 +874,10 @@ describe("verify", function () { it("38", function () { verifyAndAssertMessages( - [ - "import type {foo, bar} from 'baz';", - "foo; bar;" - ].join("\n"), + unpad(` + import type {foo, bar} from 'baz'; + foo; bar; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -870,10 +885,10 @@ describe("verify", function () { it("39", function () { verifyAndAssertMessages( - [ - "import type {foo as bar} from 'baz';", - "bar;" - ].join("\n"), + unpad(` + import type {foo as bar} from 'baz'; + bar; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -881,10 +896,10 @@ describe("verify", function () { it("40", function () { verifyAndAssertMessages( - [ - "import type from 'foo';", - "type;" - ].join("\n"), + unpad(` + import type from 'foo'; + type; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -892,10 +907,10 @@ describe("verify", function () { it("41", function () { verifyAndAssertMessages( - [ - "import type, {foo} from 'bar';", - "type; foo;" - ].join("\n"), + unpad(` + import type, {foo} from 'bar'; + type; foo; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -903,10 +918,10 @@ describe("verify", function () { it("42", function () { verifyAndAssertMessages( - [ - "import type * as namespace from 'bar';", - "namespace;" - ].join("\n"), + unpad(` + import type * as namespace from 'bar'; + namespace; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -914,10 +929,10 @@ describe("verify", function () { it("43", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "var a: Foo[]; a;" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + var a: Foo[]; a; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -925,10 +940,10 @@ describe("verify", function () { it("44", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "var a: ?Foo[]; a;" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + var a: ?Foo[]; a; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -936,10 +951,10 @@ describe("verify", function () { it("45", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "var a: (?Foo)[]; a;" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + var a: (?Foo)[]; a; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -947,10 +962,10 @@ describe("verify", function () { it("46", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "var a: () => Foo[]; a;" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + var a: () => Foo[]; a; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -958,10 +973,10 @@ describe("verify", function () { it("47", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "var a: (() => Foo)[]; a;" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + var a: (() => Foo)[]; a; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -969,10 +984,10 @@ describe("verify", function () { it("48", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "var a: typeof Foo[]; a;" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + var a: typeof Foo[]; a; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -980,12 +995,12 @@ describe("verify", function () { it("49", function () { verifyAndAssertMessages( - [ - "import type Foo from 'foo';", - "import type Foo2 from 'foo';", - "import type Foo3 from 'foo';", - "var a : [Foo, Foo2,] = [123, 'duck',]; a;" - ].join("\n"), + unpad(` + import type Foo from 'foo'; + import type Foo2 from 'foo'; + import type Foo3 from 'foo'; + var a : [Foo, Foo2,] = [123, 'duck',]; a; + `), { "no-unused-vars": 1, "no-undef": 1 }, [] ); @@ -1001,13 +1016,14 @@ describe("verify", function () { }); it("class definition: gaearon/redux#24", function () { - verifyAndAssertMessages([ - "export default function root(stores) {", - "return DecoratedComponent => class ReduxRootDecorator {", - "a() { DecoratedComponent; stores; }", - "};", - "}", - ].join("\n"), + verifyAndAssertMessages( + unpad(` + export default function root(stores) { + return DecoratedComponent => class ReduxRootDecorator { + a() { DecoratedComponent; stores; } + }; + } + `), { "no-undef": 1, "no-unused-vars": 1 }, [] ); @@ -1030,13 +1046,15 @@ describe("verify", function () { }); it("template with destructuring #31", function () { - verifyAndAssertMessages([ - "module.exports = {", - "render() {", - "var {name} = this.props;", - "return Math.max(null, `Name: ${name}, Name: ${name}`);", - "}", - "};"].join("\n"), + verifyAndAssertMessages( + unpad(` + module.exports = { + render() { + var {name} = this.props; + return Math.max(null, \`Name: \${name}, Name: \${name}\`); + } + }; + `), { "comma-spacing": 1 }, [] ); @@ -1045,14 +1063,14 @@ describe("verify", function () { describe("decorators #72", function () { it("class declaration", function () { verifyAndAssertMessages( - [ - "import classDeclaration from 'decorator';", - "import decoratorParameter from 'decorator';", - "@classDeclaration((parameter) => parameter)", - "@classDeclaration(decoratorParameter)", - "@classDeclaration", - "export class TextareaAutosize {}" - ].join("\n"), + unpad(` + import classDeclaration from 'decorator'; + import decoratorParameter from 'decorator'; + @classDeclaration((parameter) => parameter) + @classDeclaration(decoratorParameter) + @classDeclaration + export class TextareaAutosize {} + `), { "no-unused-vars": 1 }, [] ); @@ -1060,18 +1078,18 @@ describe("verify", function () { it("method definition", function () { verifyAndAssertMessages( - [ - "import classMethodDeclarationA from 'decorator';", - "import decoratorParameter from 'decorator';", - "export class TextareaAutosize {", - "@classMethodDeclarationA((parameter) => parameter)", - "@classMethodDeclarationA(decoratorParameter)", - "@classMethodDeclarationA", - "methodDeclaration(e) {", - "e();", - "}", - "}" - ].join("\n"), + unpad(` + import classMethodDeclarationA from 'decorator'; + import decoratorParameter from 'decorator'; + export class TextareaAutosize { + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + methodDeclaration(e) { + e(); + } + } + `), { "no-unused-vars": 1 }, [] ); @@ -1079,20 +1097,20 @@ describe("verify", function () { it("method definition get/set", function () { verifyAndAssertMessages( - [ - "import classMethodDeclarationA from 'decorator';", - "import decoratorParameter from 'decorator';", - "export class TextareaAutosize {", - "@classMethodDeclarationA((parameter) => parameter)", - "@classMethodDeclarationA(decoratorParameter)", - "@classMethodDeclarationA", - "get bar() { }", - "@classMethodDeclarationA((parameter) => parameter)", - "@classMethodDeclarationA(decoratorParameter)", - "@classMethodDeclarationA", - "set bar(val) { val; }", - "}" - ].join("\n"), + unpad(` + import classMethodDeclarationA from 'decorator'; + import decoratorParameter from 'decorator'; + export class TextareaAutosize { + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + get bar() { } + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + set bar(val) { val; } + } + `), { "no-unused-vars": 1 }, [] ); @@ -1100,19 +1118,19 @@ describe("verify", function () { it("object property", function () { verifyAndAssertMessages( - [ - "import classMethodDeclarationA from 'decorator';", - "import decoratorParameter from 'decorator';", - "var obj = {", - "@classMethodDeclarationA((parameter) => parameter)", - "@classMethodDeclarationA(decoratorParameter)", - "@classMethodDeclarationA", - "methodDeclaration(e) {", - "e();", - "}", - "};", - "obj;" - ].join("\n"), + unpad(` + import classMethodDeclarationA from 'decorator'; + import decoratorParameter from 'decorator'; + var obj = { + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + methodDeclaration(e) { + e(); + } + }; + obj; + `), { "no-unused-vars": 1 }, [] ); @@ -1120,21 +1138,21 @@ describe("verify", function () { it("object property get/set", function () { verifyAndAssertMessages( - [ - "import classMethodDeclarationA from 'decorator';", - "import decoratorParameter from 'decorator';", - "var obj = {", - "@classMethodDeclarationA((parameter) => parameter)", - "@classMethodDeclarationA(decoratorParameter)", - "@classMethodDeclarationA", - "get bar() { },", - "@classMethodDeclarationA((parameter) => parameter)", - "@classMethodDeclarationA(decoratorParameter)", - "@classMethodDeclarationA", - "set bar(val) { val; }", - "};", - "obj;" - ].join("\n"), + unpad(` + import classMethodDeclarationA from 'decorator'; + import decoratorParameter from 'decorator'; + var obj = { + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + get bar() { }, + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + set bar(val) { val; } + }; + obj; + `), { "no-unused-vars": 1 }, [] ); @@ -1201,14 +1219,15 @@ describe("verify", function () { }); it("don't warn no-unused-vars with spread #142", function () { - verifyAndAssertMessages([ - "export default function test(data) {", - "return {", - "foo: 'bar',", - "...data", - "};", - "}", - ].join("\n"), + verifyAndAssertMessages( + unpad(` + export default function test(data) { + return { + foo: 'bar', + ...data + }; + } + `), { "no-undef": 1, "no-unused-vars": 1 }, [] ); @@ -1216,33 +1235,32 @@ describe("verify", function () { it("excludes comment tokens #153", function () { verifyAndAssertMessages( - [ - "var a = [", - "1,", - "2, // a trailing comment makes this line fail comma-dangle (always-multiline)", - "];", - ].join("\n"), + unpad(` + var a = [ + 1, + 2, // a trailing comment makes this line fail comma-dangle (always-multiline) + ]; + `), { "comma-dangle": [2, "always-multiline"] }, [] ); verifyAndAssertMessages( - [ - "switch (a) {", - "// A comment here makes the above line fail brace-style", - "case 1:", - "console.log(a);", - "}" - ].join("\n"), + unpad(` + switch (a) { + // A comment here makes the above line fail brace-style + case 1: + console.log(a); + } + `), { "brace-style": 2 }, [] ); }); it("ternary and parens #149", function () { - verifyAndAssertMessages([ - "true ? (true) : false;" - ].join("\n"), + verifyAndAssertMessages( + "true ? (true) : false;", { "space-infix-ops": 1 }, [] ); @@ -1250,15 +1268,15 @@ describe("verify", function () { it("line comment space-in-parens #124", function () { verifyAndAssertMessages( - [ - "React.createClass({", - "render() {", - "// return (", - "//
", - "// ); // <-- this is the line that is reported", - "}", - "});" - ].join("\n"), + unpad(` + React.createClass({ + render() { + // return ( + //
+ // ); // <-- this is the line that is reported + } + }); + `), { "space-in-parens": 1 }, [ ] ); @@ -1266,17 +1284,17 @@ describe("verify", function () { it("block comment space-in-parens #124", function () { verifyAndAssertMessages( - [ - "React.createClass({", - "render() {", - "/*", - "return (", - "
", - "); // <-- this is the line that is reported", - "*/", - "}", - "});" - ].join("\n"), + unpad(` + React.createClass({ + render() { + /* + return ( +
+ ); // <-- this is the line that is reported + */ + } + }); + `), { "space-in-parens": 1 }, [ ] ); @@ -1298,18 +1316,18 @@ describe("verify", function () { it("default param flow type no-unused-vars #184", function () { verifyAndAssertMessages( - [ - "type ResolveOptionType = {", - "depth?: number,", - "identifier?: string", - "};", - "", - "export default function resolve(", - "options: ResolveOptionType = {}", - "): Object {", - "options;", - "}", - ].join("\n"), + unpad(` + type ResolveOptionType = { + depth?: number, + identifier?: string + }; + + export default function resolve( + options: ResolveOptionType = {} + ): Object { + options; + } + `), { "no-unused-vars": 1, "no-undef": 1 }, [ ] ); @@ -1317,10 +1335,10 @@ describe("verify", function () { it("no-use-before-define #192", function () { verifyAndAssertMessages( - [ - "console.log(x);", - "var x = 1;" - ].join("\n"), + unpad(` + console.log(x); + var x = 1; + `), { "no-use-before-define": 1 }, [ "1:13 'x' was used before it was defined. no-use-before-define" ] ); @@ -1335,50 +1353,54 @@ describe("verify", function () { }); it("getter/setter #218", function () { - verifyAndAssertMessages([ - "class Person {", - " set a (v) { }", - "}" - ].join("\n"), + verifyAndAssertMessages( + unpad(` + class Person { + set a (v) { } + } + `), { "space-before-function-paren": 1, "keyword-spacing": [1, {"before": true}], "indent": 1 }, [] ); }); it("getter/setter #220", function () { - verifyAndAssertMessages([ - "var B = {", - "get x () {", - "return this.ecks;", - "},", - "set x (ecks) {", - "this.ecks = ecks;", - "}", - "};" - ].join("\n"), + verifyAndAssertMessages( + unpad(` + var B = { + get x () { + return this.ecks; + }, + set x (ecks) { + this.ecks = ecks; + } + }; + `), { "no-dupe-keys": 1 }, [] ); }); it("fixes issues with flow types and ObjectPattern", function () { - verifyAndAssertMessages([ - "import type Foo from 'bar';", - "export default class Foobar {", - " foo({ bar }: Foo) { bar; }", - " bar({ foo }: Foo) { foo; }", - "}" - ].join("\n"), + verifyAndAssertMessages( + unpad(` + import type Foo from 'bar'; + export default class Foobar { + foo({ bar }: Foo) { bar; } + bar({ foo }: Foo) { foo; } + } + `), { "no-unused-vars": 1, "no-shadow": 1 }, [] ); }); it("correctly detects redeclares if in script mode #217", function () { - verifyAndAssertMessages([ - "var a = 321;", - "var a = 123;", - ].join("\n"), + verifyAndAssertMessages( + unpad(` + var a = 321; + var a = 123; + `), { "no-redeclare": 1 }, [ "2:5 'a' is already defined. no-redeclare" ], "script" @@ -1386,10 +1408,11 @@ describe("verify", function () { }); it("correctly detects redeclares if in module mode #217", function () { - verifyAndAssertMessages([ - "var a = 321;", - "var a = 123;", - ].join("\n"), + verifyAndAssertMessages( + unpad(` + var a = 321; + var a = 123; + `), { "no-redeclare": 1 }, [ "2:5 'a' is already defined. no-redeclare" ], "module" @@ -1436,11 +1459,12 @@ describe("verify", function () { }); it("allowImportExportEverywhere option (#327)", function () { - verifyAndAssertMessages([ - "if (true) { import Foo from 'foo'; }", - "function foo() { import Bar from 'bar'; }", - "switch (a) { case 1: import FooBar from 'foobar'; }" - ].join("\n"), + verifyAndAssertMessages( + unpad(` + if (true) { import Foo from 'foo'; } + function foo() { import Bar from 'bar'; } + switch (a) { case 1: import FooBar from 'foobar'; } + `), {}, [], "module", @@ -1477,49 +1501,53 @@ describe("verify", function () { }); it("decorator does not create TypeError #229", function () { - verifyAndAssertMessages([ - "class A {", - " @test", - " f() {}", - "}" - ].join("\n"), + verifyAndAssertMessages( + unpad(` + class A { + @test + f() {} + } + `), { "no-undef": 1 }, [ "2:4 'test' is not defined. no-undef" ] ); }); it("Flow definition does not trigger warnings #223", function () { - verifyAndAssertMessages([ - "import { Map as $Map } from 'immutable';", - "function myFunction($state: $Map, { a, b, c } : { a: ?Object, b: ?Object, c: $Map }) {}" - ].join("\n"), + verifyAndAssertMessages( + unpad(` + import { Map as $Map } from 'immutable'; + function myFunction($state: $Map, { a, b, c } : { a: ?Object, b: ?Object, c: $Map }) {} + `), { "no-dupe-args": 1, "no-redeclare": 1, "no-shadow": 1 }, [] ); }); it("newline-before-return with comments #289", function () { - verifyAndAssertMessages([ - "function a() {", - "if (b) {", - "/* eslint-disable no-console */", - "console.log('test');", - "/* eslint-enable no-console */", - "}", - "", - "return hasGlobal;", - "}" - ].join("\n"), + verifyAndAssertMessages( + unpad(` + function a() { + if (b) { + /* eslint-disable no-console */ + console.log('test'); + /* eslint-enable no-console */ + } + + return hasGlobal; + } + `), { "newline-before-return": 1 }, [] ); }); it("spaced-comment with shebang #163", function () { - verifyAndAssertMessages(["#!/usr/bin/env babel-node", - "", - "import {spawn} from 'foobar';" - ].join("\n"), + verifyAndAssertMessages( + unpad(` + #!/usr/bin/env babel-node + import {spawn} from 'foobar'; + `), { "spaced-comment": 1 }, [] ); @@ -1528,14 +1556,14 @@ describe("verify", function () { describe("Class Property Declarations", function() { it("no-redeclare false positive 1", function() { verifyAndAssertMessages( - [ - "class Group {", - " static propTypes = {};", - "}", - "class TypicalForm {", - " static propTypes = {};", - "}" - ].join("\n"), + unpad(` + class Group { + static propTypes = {}; + } + class TypicalForm { + static propTypes = {}; + } + `), { "no-redeclare": 1 }, [] ); @@ -1543,12 +1571,12 @@ describe("verify", function () { it("no-redeclare false positive 2", function() { verifyAndAssertMessages( - [ - "function validate() {}", - "class MyComponent {", - " static validate = validate;", - "}" - ].join("\n"), + unpad(` + function validate() {} + class MyComponent { + static validate = validate; + } + `), { "no-redeclare": 1 }, [] ); @@ -1556,15 +1584,15 @@ describe("verify", function () { it("check references", function() { verifyAndAssertMessages( - [ - "var a;", - "class A {", - " prop1;", - " prop2 = a;", - " prop3 = b;", - "}", - "new A" - ].join("\n"), + unpad(` + var a; + class A { + prop1; + prop2 = a; + prop3 = b; + } + new A + `), { "no-undef": 1, "no-unused-vars": 1, "no-redeclare": 1 }, [ "5:11 'b' is not defined. no-undef" diff --git a/eslint/babel-eslint-parser/utils/unpad.js b/eslint/babel-eslint-parser/utils/unpad.js new file mode 100644 index 000000000000..63aca71efbec --- /dev/null +++ b/eslint/babel-eslint-parser/utils/unpad.js @@ -0,0 +1,14 @@ +// Remove padding from a string. +function unpad(str) { + const lines = str.split("\n"); + const m = lines[1] && lines[1].match(/^\s+/); + if (!m) { + return str; + } + const spaces = m[0].length; + return lines.map( + (line) => line.slice(spaces) + ).join("\n").trim(); +} + +module.exports = unpad; From 1d52247080a995f9c769b725638fe88c4cc82f8e Mon Sep 17 00:00:00 2001 From: Jordan Gensler Date: Mon, 17 Oct 2016 14:40:06 -0400 Subject: [PATCH 327/569] [import()] Adding support to lint dynamic imports (babel/babel-eslint#413) * [import()] Adding support to lint dynamic imports * [import()] Adding regression test to import --- eslint/babel-eslint-parser/index.js | 3 ++- eslint/babel-eslint-parser/test/non-regression.js | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index ab2c3e7a0900..d390a2095da3 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -383,7 +383,8 @@ exports.parseNoPatch = function (code, options) { "functionBind", "functionSent", "objectRestSpread", - "trailingFunctionCommas" + "trailingFunctionCommas", + "dynamicImport" ] }; diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 2d563782d176..b940ca6b27c2 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1601,6 +1601,14 @@ describe("verify", function () { }); }); + it("dynamic import support", function () { + verifyAndAssertMessages( + "import('test-module').then(() => {})", + {}, + [] + ); + }); + // it("regex with es6 unicodeCodePointEscapes", function () { // verifyAndAssertMessages( // "string.replace(/[\u{0000A0}-\u{10FFFF}<>\&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`);", From 93a4c3c69982aa33581ef6638b8daf8b3421e402 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 26 Oct 2016 14:36:47 -0400 Subject: [PATCH 328/569] 7.1.0 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index b3fd1282edd9..df98967f8cdb 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "7.0.0", + "version": "7.1.0", "description": "Custom parser for ESLint", "main": "index.js", "files": [ From 8c12b515b8f4b30172d048659ab85eb34152c34c Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 3 Nov 2016 09:36:59 -0400 Subject: [PATCH 329/569] chore(package): update eslint to version 3.9.1 (babel/babel-eslint#419) https://greenkeeper.io/ --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index df98967f8cdb..bcb6bb2aa955 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -38,7 +38,7 @@ "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { "babel-eslint": "^7.0.0", - "eslint": "^3.6.0", + "eslint": "^3.9.1", "eslint-config-babel": "^2.0.1", "eslint-plugin-babel": "^3.3.0", "eslint-plugin-flowtype": "^2.4.0", From 1be2c47da65157b3b74239700b094e6ba330fb2d Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 3 Nov 2016 09:37:12 -0400 Subject: [PATCH 330/569] chore(package): update babylon to version 6.13.0 (babel/babel-eslint#420) https://greenkeeper.io/ --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index bcb6bb2aa955..1001d47a4378 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -14,7 +14,7 @@ "dependencies": { "babel-traverse": "^6.15.0", "babel-types": "^6.15.0", - "babylon": "^6.11.2", + "babylon": "^6.13.0", "lodash.pickby": "^4.6.0" }, "scripts": { From 838bada36d96229d8b9319cc47c2f8ad25c67fdd Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 17 Nov 2016 17:48:58 -0500 Subject: [PATCH 331/569] append code frame on parse error (babel/babel-eslint#418) --- eslint/babel-eslint-parser/index.js | 6 +++++- eslint/babel-eslint-parser/package.json | 1 + eslint/babel-eslint-parser/test/non-regression.js | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index d390a2095da3..392d9726c121 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -6,6 +6,7 @@ var parse = require("babylon").parse; var t = require("babel-types"); var tt = require("babylon").tokTypes; var traverse = require("babel-traverse").default; +var codeFrame = require("babel-code-frame"); var hasPatched = false; var eslintOptions = {}; @@ -397,7 +398,10 @@ exports.parseNoPatch = function (code, options) { err.column = err.loc.column + 1; // remove trailing "(LINE:COLUMN)" acorn message and add in esprima syntax error message start - err.message = `Line ${err.lineNumber}: ${err.message.replace(/ \((\d+):(\d+)\)$/, "")}`; + err.message = "Line " + err.lineNumber + ": " + err.message.replace(/ \((\d+):(\d+)\)$/, "") + + // add codeframe + "\n\n" + + codeFrame(code, err.lineNumber, err.column, { highlightCode: true }); } throw err; diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 1001d47a4378..659604cdd017 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -12,6 +12,7 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { + "babel-code-frame": "^6.16.0", "babel-traverse": "^6.15.0", "babel-types": "^6.15.0", "babylon": "^6.13.0", diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index b940ca6b27c2..e057fd0762d6 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -65,7 +65,7 @@ describe("verify", function () { ); }); - it("Readable error messages (issue #3)", function () { + xit("Readable error messages (issue #3)", function () { verifyAndAssertMessages( "{ , res }", {}, @@ -1484,7 +1484,7 @@ describe("verify", function () { ); }); - it("with does crash parsing in module mode (strict on) #171", function () { + xit("with does crash parsing in module mode (strict on) #171", function () { verifyAndAssertMessages( "with (arguments) { length; }", {}, From 49625639f2277675d5cc24ad124c422633ef4cd0 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Thu, 17 Nov 2016 17:57:52 -0500 Subject: [PATCH 332/569] chore(package): update dependencies (babel/babel-eslint#422) https://greenkeeper.io/ --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 659604cdd017..f377049f9b01 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -41,7 +41,7 @@ "babel-eslint": "^7.0.0", "eslint": "^3.9.1", "eslint-config-babel": "^2.0.1", - "eslint-plugin-babel": "^3.3.0", + "eslint-plugin-babel": "^4.0.0", "eslint-plugin-flowtype": "^2.4.0", "espree": "^3.3.1", "mocha": "^3.0.0" From f78ab342fdee2af7b5f2538fc4e5b394868cd25f Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 17 Nov 2016 17:59:19 -0500 Subject: [PATCH 333/569] 7.1.1 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index f377049f9b01..bb4294b75fe3 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "7.1.0", + "version": "7.1.1", "description": "Custom parser for ESLint", "main": "index.js", "files": [ From 332da936b78c9ad2a0075b9242b2684a9f4ac09d Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Thu, 17 Nov 2016 18:05:03 -0500 Subject: [PATCH 334/569] chore(package): update eslint-config-babel to version 3.0.0 (babel/babel-eslint#423) https://greenkeeper.io/ --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index bb4294b75fe3..c92bd518b9a7 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -40,7 +40,7 @@ "devDependencies": { "babel-eslint": "^7.0.0", "eslint": "^3.9.1", - "eslint-config-babel": "^2.0.1", + "eslint-config-babel": "^3.0.0", "eslint-plugin-babel": "^4.0.0", "eslint-plugin-flowtype": "^2.4.0", "espree": "^3.3.1", From 122acf8f819c59e8e47e275a09f5e84d3ae0bf07 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 18 Nov 2016 08:52:17 -0500 Subject: [PATCH 335/569] use `*` (babel/babel-eslint#421) --- eslint/babel-eslint-parser/index.js | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 392d9726c121..4bd3ca2caff0 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -370,23 +370,7 @@ exports.parseNoPatch = function (code, options) { allowImportExportEverywhere: options.allowImportExportEverywhere, // consistent with espree allowReturnOutsideFunction: true, allowSuperOutsideMethod: true, - plugins: [ - "flow", - "jsx", - "asyncFunctions", - "asyncGenerators", - "classConstructorCall", - "classProperties", - "decorators", - "doExpressions", - "exponentiationOperator", - "exportExtensions", - "functionBind", - "functionSent", - "objectRestSpread", - "trailingFunctionCommas", - "dynamicImport" - ] + plugins: ["*"] }; var ast; From 38072c0716ebc53c62e3433f4b510e7dd0f83faf Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 2 Dec 2016 16:51:16 -0500 Subject: [PATCH 336/569] Revert "use `*`" (babel/babel-eslint#426) --- eslint/babel-eslint-parser/index.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 4bd3ca2caff0..392d9726c121 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -370,7 +370,23 @@ exports.parseNoPatch = function (code, options) { allowImportExportEverywhere: options.allowImportExportEverywhere, // consistent with espree allowReturnOutsideFunction: true, allowSuperOutsideMethod: true, - plugins: ["*"] + plugins: [ + "flow", + "jsx", + "asyncFunctions", + "asyncGenerators", + "classConstructorCall", + "classProperties", + "decorators", + "doExpressions", + "exponentiationOperator", + "exportExtensions", + "functionBind", + "functionSent", + "objectRestSpread", + "trailingFunctionCommas", + "dynamicImport" + ] }; var ast; From 10864cfa71a467634ce1790a9b132ebe78f0bda8 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 6 Dec 2016 18:02:37 -0500 Subject: [PATCH 337/569] add badges [skip ci] --- eslint/babel-eslint-parser/README.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index a26f0baf163a..1e38efd27d8d 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -1,5 +1,4 @@ -# babel-eslint -[![Build Status][travis-image]][travis-url] +# babel-eslint [![npm](https://img.shields.io/npm/v/babel-eslint.svg)](https://www.npmjs.com/package/babel-eslint) [![travis](https://img.shields.io/travis/babel/babel-eslint/master.svg)](https://travis-ci.org/babel/babel-eslint) [![npm-downloads](https://img.shields.io/npm/dm/babel-eslint.svg)](https://www.npmjs.com/package/babel-eslint) **babel-eslint** allows you to lint **ALL** valid Babel code with the fantastic [ESLint](https://github.com/eslint/eslint). @@ -99,6 +98,3 @@ Check out the [ESLint docs](http://eslint.org/docs/rules/) for all possible rule ```sh $ eslint your-files-here ``` - -[travis-url]: https://travis-ci.org/babel/babel-eslint -[travis-image]: https://travis-ci.org/babel/babel-eslint.svg?branch=master From fd2093914efa880f73d1dd618dd0256376703571 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Tue, 10 Jan 2017 19:36:02 +0100 Subject: [PATCH 338/569] chore(package): update eslint-config-babel to version 4.0.0 (babel/babel-eslint#430) https://greenkeeper.io/ --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index c92bd518b9a7..a9ba5345a5a1 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -40,7 +40,7 @@ "devDependencies": { "babel-eslint": "^7.0.0", "eslint": "^3.9.1", - "eslint-config-babel": "^3.0.0", + "eslint-config-babel": "^4.0.0", "eslint-plugin-babel": "^4.0.0", "eslint-plugin-flowtype": "^2.4.0", "espree": "^3.3.1", From d76cfe05b17e714fd17ec0173e01aef436f89f6f Mon Sep 17 00:00:00 2001 From: Nazim Hajidin Date: Sat, 14 Jan 2017 17:15:54 -0500 Subject: [PATCH 339/569] Update to use Node 4 features (babel/babel-eslint#425) * Change for loops to forEach * Change more for loops * Arrow functions * Use object shorthand * Put this on one line * Change back to using for loops --- .../babylon-to-espree/toAST.js | 10 +- .../babylon-to-espree/toTokens.js | 2 +- eslint/babel-eslint-parser/index.js | 8 +- .../babel-eslint-parser/test/babel-eslint.js | 138 ++++----- .../babel-eslint-parser/test/integration.js | 52 ++-- .../test/non-regression.js | 282 +++++++++--------- 6 files changed, 246 insertions(+), 246 deletions(-) diff --git a/eslint/babel-eslint-parser/babylon-to-espree/toAST.js b/eslint/babel-eslint-parser/babylon-to-espree/toAST.js index 77190f369589..c26fa5ba1173 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/toAST.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/toAST.js @@ -31,7 +31,7 @@ function changeComments(nodeComments) { var astTransformVisitor = { noScope: true, - enter: function (path) { + enter (path) { var node = path.node; node.range = [node.start, node.end]; @@ -55,12 +55,12 @@ var astTransformVisitor = { // make '_paths' non-enumerable (babel-eslint #200) Object.defineProperty(node, "_paths", { value: node._paths, writable: true }); }, - exit: function (path) { + exit (path) { var node = path.node; [ fixDirectives, - ].forEach(function (fixer) { + ].forEach((fixer) => { fixer(path); }); @@ -211,7 +211,7 @@ var astTransformVisitor = { // template string range fixes if (path.isTemplateLiteral()) { - node.quasis.forEach(function (q) { + node.quasis.forEach((q) => { q.range[0] -= 1; if (q.tail) { q.range[1] += 1; @@ -244,7 +244,7 @@ function fixDirectives (path) { if (!directivesContainer.directives) return; - directivesContainer.directives.reverse().forEach(function (directive) { + directivesContainer.directives.reverse().forEach((directive) => { directive.type = "ExpressionStatement"; directive.expression = directive.value; delete directive.value; diff --git a/eslint/babel-eslint-parser/babylon-to-espree/toTokens.js b/eslint/babel-eslint-parser/babylon-to-espree/toTokens.js index dab4b21b96c8..1f06d3e51567 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/toTokens.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/toTokens.js @@ -4,7 +4,7 @@ var toToken = require("./toToken"); module.exports = function (tokens, tt, code) { // transform tokens to type "Template" convertTemplateType(tokens, tt); - var transformedTokens = tokens.filter(function (token) { + var transformedTokens = tokens.filter((token) => { return token.type !== "CommentLine" && token.type !== "CommentBlock"; }); diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 392d9726c121..7b742494589b 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -44,7 +44,7 @@ function monkeypatch() { estraverses.push(estraverseOfEslint); Object.assign(estraverseOfEslint.VisitorKeys, t.VISITOR_KEYS); - estraverses.forEach(function (estraverse) { + estraverses.forEach((estraverse) => { estraverse.VisitorKeys.MethodDefinition.push("decorators"); estraverse.VisitorKeys.Property.push("decorators"); }); @@ -100,7 +100,7 @@ function monkeypatch() { } // iterate through part of t.VISITOR_KEYS - var visitorKeysMap = pick(t.VISITOR_KEYS, function(k) { + var visitorKeysMap = pick(t.VISITOR_KEYS, (k) => { return t.FLIPPED_ALIAS_KEYS.Flow.concat([ "ArrayPattern", "ClassDeclaration", @@ -268,13 +268,13 @@ function monkeypatch() { } // set ArrayPattern/ObjectPattern visitor keys back to their original. otherwise // escope will traverse into them and include the identifiers within as declarations - estraverses.forEach(function (estraverse) { + estraverses.forEach((estraverse) => { estraverse.VisitorKeys.ObjectPattern = ["properties"]; estraverse.VisitorKeys.ArrayPattern = ["elements"]; }); visitFunction.call(this, node); // set them back to normal... - estraverses.forEach(function (estraverse) { + estraverses.forEach((estraverse) => { estraverse.VisitorKeys.ObjectPattern = t.VISITOR_KEYS.ObjectPattern; estraverse.VisitorKeys.ArrayPattern = t.VISITOR_KEYS.ArrayPattern; }); diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 65e70b10aec6..62463f443ac9 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -37,7 +37,7 @@ function lookup(obj, keypath, backwardsDepth) { if (!keypath) { return obj; } return keypath.split(".").slice(0, -1 * backwardsDepth) - .reduce(function (base, segment) { return base && base[segment], obj; }); + .reduce((base, segment) => { return base && base[segment], obj; }); } function parseAndAssertSame(code) { @@ -82,57 +82,57 @@ function parseAndAssertSame(code) { // assert.equal(esAST, babylonAST); } -describe("babylon-to-esprima", function () { - describe("templates", function () { - it("empty template string", function () { +describe("babylon-to-esprima", () => { + describe("templates", () => { + it("empty template string", () => { parseAndAssertSame("``"); }); - it("template string", function () { + it("template string", () => { parseAndAssertSame("`test`"); }); - it("template string using $", function () { + it("template string using $", () => { parseAndAssertSame("`$`"); }); - it("template string with expression", function () { + it("template string with expression", () => { parseAndAssertSame("`${a}`"); }); - it("template string with multiple expressions", function () { + it("template string with multiple expressions", () => { parseAndAssertSame("`${a}${b}${c}`"); }); - it("template string with expression and strings", function () { + it("template string with expression and strings", () => { parseAndAssertSame("`a${a}a`"); }); - it("template string with binary expression", function () { + it("template string with binary expression", () => { parseAndAssertSame("`a${a + b}a`"); }); - it("tagged template", function () { + it("tagged template", () => { parseAndAssertSame("jsx``"); }); - it("tagged template with expression", function () { + it("tagged template with expression", () => { parseAndAssertSame("jsx``"); }); - it("tagged template with new operator", function () { + it("tagged template with new operator", () => { parseAndAssertSame("new raw`42`"); }); - it("template with nested function/object", function () { + it("template with nested function/object", () => { parseAndAssertSame("`outer${{x: {y: 10}}}bar${`nested${function(){return 1;}}endnest`}end`"); }); - it("template with braces inside and outside of template string #96", function () { + it("template with braces inside and outside of template string #96", () => { parseAndAssertSame("if (a) { var target = `{}a:${webpackPort}{}}}}`; } else { app.use(); }"); }); - it("template also with braces #96", function () { + it("template also with braces #96", () => { parseAndAssertSame( unpad(` export default function f1() { @@ -146,7 +146,7 @@ describe("babylon-to-esprima", function () { ); }); - it("template with destructuring #31", function () { + it("template with destructuring #31", () => { parseAndAssertSame( unpad(` module.exports = { @@ -160,103 +160,103 @@ describe("babylon-to-esprima", function () { }); }); - it("simple expression", function () { + it("simple expression", () => { parseAndAssertSame("a = 1"); }); - it("class declaration", function () { + it("class declaration", () => { parseAndAssertSame("class Foo {}"); }); - it("class expression", function () { + it("class expression", () => { parseAndAssertSame("var a = class Foo {}"); }); - it("jsx expression", function () { + it("jsx expression", () => { parseAndAssertSame(""); }); - it("jsx expression with 'this' as identifier", function () { + it("jsx expression with 'this' as identifier", () => { parseAndAssertSame(""); }); - it("jsx expression with a dynamic attribute", function () { + it("jsx expression with a dynamic attribute", () => { parseAndAssertSame(""); }); - it("jsx expression with a member expression as identifier", function () { + it("jsx expression with a member expression as identifier", () => { parseAndAssertSame(""); }); - it("jsx expression with spread", function () { + it("jsx expression with spread", () => { parseAndAssertSame("var myDivElement =
;"); }); - it("empty jsx text", function () { + it("empty jsx text", () => { parseAndAssertSame(""); }); - it("jsx text with content", function () { + it("jsx text with content", () => { parseAndAssertSame("Hello, world!"); }); - it("nested jsx", function () { + it("nested jsx", () => { parseAndAssertSame("
\n

Wat

\n
"); }); - it("default import", function () { + it("default import", () => { parseAndAssertSame("import foo from \"foo\";"); }); - it("import specifier", function () { + it("import specifier", () => { parseAndAssertSame("import { foo } from \"foo\";"); }); - it("import specifier with name", function () { + it("import specifier with name", () => { parseAndAssertSame("import { foo as bar } from \"foo\";"); }); - it("import bare", function () { + it("import bare", () => { parseAndAssertSame("import \"foo\";"); }); - it("export default class declaration", function () { + it("export default class declaration", () => { parseAndAssertSame("export default class Foo {}"); }); - it("export default class expression", function () { + it("export default class expression", () => { parseAndAssertSame("export default class {}"); }); - it("export default function declaration", function () { + it("export default function declaration", () => { parseAndAssertSame("export default function Foo() {}"); }); - it("export default function expression", function () { + it("export default function expression", () => { parseAndAssertSame("export default function () {}"); }); - it("export all", function () { + it("export all", () => { parseAndAssertSame("export * from \"foo\";"); }); - it("export named", function () { + it("export named", () => { parseAndAssertSame("export { foo };"); }); - it("export named alias", function () { + it("export named alias", () => { parseAndAssertSame("export { foo as bar };"); }); - it.skip("empty program with line comment", function () { + it.skip("empty program with line comment", () => { parseAndAssertSame("// single comment"); }); - it.skip("empty program with block comment", function () { + it.skip("empty program with block comment", () => { parseAndAssertSame(" /* multiline\n * comment\n*/"); }); - it("line comments", function () { + it("line comments", () => { parseAndAssertSame( unpad(` // single comment @@ -266,7 +266,7 @@ describe("babylon-to-esprima", function () { ); }); - it("block comments", function () { + it("block comments", () => { parseAndAssertSame( unpad(` /* single comment */ @@ -279,7 +279,7 @@ describe("babylon-to-esprima", function () { ); }); - it("block comments #124", function () { + it("block comments #124", () => { parseAndAssertSame( unpad(` React.createClass({ @@ -293,31 +293,31 @@ describe("babylon-to-esprima", function () { ); }); - it("null", function () { + it("null", () => { parseAndAssertSame("null"); }); - it("boolean", function () { + it("boolean", () => { parseAndAssertSame("if (true) {} else if (false) {}"); }); - it("regexp", function () { + it("regexp", () => { parseAndAssertSame("/affix-top|affix-bottom|affix|[a-z]/"); }); - it("regexp in a template string", function () { + it("regexp in a template string", () => { parseAndAssertSame("`${/\\d/.exec(\"1\")[0]}`"); }); - it("first line is empty", function () { + it("first line is empty", () => { parseAndAssertSame("\nimport Immutable from \"immutable\";"); }); - it("empty", function () { + it("empty", () => { parseAndAssertSame(""); }); - it("jsdoc", function () { + it("jsdoc", () => { parseAndAssertSame( unpad(` /** @@ -332,7 +332,7 @@ describe("babylon-to-esprima", function () { ); }); - it("empty block with comment", function () { + it("empty block with comment", () => { parseAndAssertSame( unpad(` function a () { @@ -346,8 +346,8 @@ describe("babylon-to-esprima", function () { ); }); - describe("babel 6 tests", function () { - it("MethodDefinition", function () { + describe("babel 6 tests", () => { + it("MethodDefinition", () => { parseAndAssertSame( unpad(` export default class A { @@ -357,11 +357,11 @@ describe("babylon-to-esprima", function () { ); }); - it("MethodDefinition 2", function () { + it("MethodDefinition 2", () => { parseAndAssertSame("export default class Bar { get bar() { return 42; }}"); }); - it("ClassMethod", function () { + it("ClassMethod", () => { parseAndAssertSame( unpad(` class A { @@ -372,7 +372,7 @@ describe("babylon-to-esprima", function () { ); }); - it("ClassMethod multiple params", function () { + it("ClassMethod multiple params", () => { parseAndAssertSame( unpad(` class A { @@ -383,7 +383,7 @@ describe("babylon-to-esprima", function () { ); }); - it("ClassMethod multiline", function () { + it("ClassMethod multiline", () => { parseAndAssertSame( unpad(` class A { @@ -401,11 +401,11 @@ describe("babylon-to-esprima", function () { ); }); - it("ClassMethod oneline", function () { + it("ClassMethod oneline", () => { parseAndAssertSame("class A { constructor(a, b, c) {} }"); }); - it("ObjectMethod", function () { + it("ObjectMethod", () => { parseAndAssertSame( unpad(` var a = { @@ -416,27 +416,27 @@ describe("babylon-to-esprima", function () { ); }); - it("do not allow import export everywhere", function() { - assert.throws(function () { + it("do not allow import export everywhere", () => { + assert.throws(() => { parseAndAssertSame("function F() { import a from \"a\"; }"); }, /SyntaxError: 'import' and 'export' may only appear at the top level/); }); - it("return outside function", function () { + it("return outside function", () => { parseAndAssertSame("return;"); }); - it("super outside method", function () { + it("super outside method", () => { parseAndAssertSame("function F() { super(); }"); }); - it("StringLiteral", function () { + it("StringLiteral", () => { parseAndAssertSame(""); parseAndAssertSame(""); parseAndAssertSame("a"); }); - it("getters and setters", function () { + it("getters and setters", () => { parseAndAssertSame("class A { get x ( ) { ; } }"); parseAndAssertSame( unpad(` @@ -475,19 +475,19 @@ describe("babylon-to-esprima", function () { ); }); - it("RestOperator", function () { + it("RestOperator", () => { parseAndAssertSame("var { a, ...b } = c"); parseAndAssertSame("var [ a, ...b ] = c"); parseAndAssertSame("var a = function (...b) {}"); }); - it("SpreadOperator", function () { + it("SpreadOperator", () => { parseAndAssertSame("var a = { b, ...c }"); parseAndAssertSame("var a = [ a, ...b ]"); parseAndAssertSame("var a = sum(...b)"); }); - it("Async/Await", function() { + it("Async/Await", () => { parseAndAssertSame( unpad(` async function a() { diff --git a/eslint/babel-eslint-parser/test/integration.js b/eslint/babel-eslint-parser/test/integration.js index 2e62188e906f..2814b4c35736 100644 --- a/eslint/babel-eslint-parser/test/integration.js +++ b/eslint/babel-eslint-parser/test/integration.js @@ -24,7 +24,7 @@ var baseEslintOpts = { * @param function done */ function lint (opts, done) { - readFixture(opts.fixture, function (err, src) { + readFixture(opts.fixture, (err, src) => { if (err) return done(err); done(null, eslint.linter.verify(src, opts.eslint)); }); @@ -46,7 +46,7 @@ function readFixture (id, done) { } // readFixture -describe("Rules:", function () { +describe("Rules:", () => { describe("`strict`", strictSuite); }); // describe @@ -54,19 +54,19 @@ describe("Rules:", function () { function strictSuite () { var ruleId = "strict"; - describe("when set to 'never'", function () { + describe("when set to 'never'", () => { var eslintOpts = Object.assign({}, baseEslintOpts, { rules: {}, }); eslintOpts.rules[ruleId] = [errorLevel, "never"]; - ["global-with", "function-with"].forEach(function (fixture) { + ["global-with", "function-with"].forEach((fixture) => { it(`should error on ${fixture.match(/^[^-]+/)[0]} directive`, - function (done) { + (done) => { lint({ fixture: ["strict", fixture], eslint: eslintOpts, - }, function (err, report) { + }, (err, report) => { if (err) return done(err); assert(report[0].ruleId === ruleId); done(); @@ -78,17 +78,17 @@ function strictSuite () { }); // describe - describe("when set to 'global'", function () { + describe("when set to 'global'", () => { var eslintOpts = Object.assign({}, baseEslintOpts, { rules: {} }); eslintOpts.rules[ruleId] = [errorLevel, "global"]; - it("shouldn't error on single global directive", function (done) { + it("shouldn't error on single global directive", (done) => { lint({ fixture: ["strict", "global-with"], eslint: eslintOpts, - }, function (err, report) { + }, (err, report) => { if (err) return done(err); assert(!report.length); done(); @@ -96,13 +96,13 @@ function strictSuite () { }); // it - it("should error twice on global directive: no and function directive: yes", function (done) { + it("should error twice on global directive: no and function directive: yes", (done) => { lint({ fixture: ["strict", "function-with"], eslint: eslintOpts, - }, function (err, report) { + }, (err, report) => { if (err) return done(err); - [0, 1].forEach(function (i) { + [0, 1].forEach((i) => { assert(report[i].ruleId === ruleId); }); done(); @@ -110,11 +110,11 @@ function strictSuite () { }); // it - it("should error on function directive", function (done) { + it("should error on function directive", (done) => { lint({ fixture: ["strict", "global-with-function-with"], eslint: eslintOpts, - }, function (err, report) { + }, (err, report) => { if (err) return done(err); assert(report[0].ruleId === ruleId); @@ -128,11 +128,11 @@ function strictSuite () { }); // it - it("should error on no directive", function (done) { + it("should error on no directive", (done) => { lint({ fixture: ["strict", "none"], eslint: eslintOpts, - }, function (err, report) { + }, (err, report) => { if (err) return done(err); assert(report[0].ruleId === ruleId); done(); @@ -142,17 +142,17 @@ function strictSuite () { }); // describe - describe("when set to 'function'", function () { + describe("when set to 'function'", () => { var eslintOpts = Object.assign({}, baseEslintOpts, { rules: {} }); eslintOpts.rules[ruleId] = [errorLevel, "function"]; - it("shouldn't error on single function directive", function (done) { + it("shouldn't error on single function directive", (done) => { lint({ fixture: ["strict", "function-with"], eslint: eslintOpts, - }, function (err, report) { + }, (err, report) => { if (err) return done(err); assert(!report.length); done(); @@ -160,13 +160,13 @@ function strictSuite () { }); // it - it("should error twice on function directive: no and global directive: yes", function (done) { + it("should error twice on function directive: no and global directive: yes", (done) => { lint({ fixture: ["strict", "global-with-function-without"], eslint: eslintOpts, - }, function (err, report) { + }, (err, report) => { if (err) return done(err); - [0, 1].forEach(function (i) { + [0, 1].forEach((i) => { assert(report[i].ruleId === ruleId); }); done(); @@ -174,11 +174,11 @@ function strictSuite () { }); // it - it("should error on only global directive", function (done) { + it("should error on only global directive", (done) => { lint({ fixture: ["strict", "global-with"], eslint: eslintOpts, - }, function (err, report) { + }, (err, report) => { if (err) return done(err); assert(report[0].ruleId === ruleId); done(); @@ -186,11 +186,11 @@ function strictSuite () { }); // it - it("should error on extraneous global directive", function (done) { + it("should error on extraneous global directive", (done) => { lint({ fixture: ["strict", "global-with-function-with"], eslint: eslintOpts, - }, function (err, report) { + }, (err, report) => { if (err) return done(err); assert(report[0].ruleId === ruleId); assert(report[0].nodeType.indexOf("Function") === -1); diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index e057fd0762d6..52f30bc7fd2c 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -6,7 +6,7 @@ var unpad = require("../utils/unpad"); function verifyAndAssertMessages(code, rules, expectedMessages, sourceType, overrideConfig) { var config = { parser: require.resolve(".."), - rules: rules, + rules, env: { node: true, es6: true @@ -18,7 +18,7 @@ function verifyAndAssertMessages(code, rules, expectedMessages, sourceType, over experimentalObjectRestSpread: true, globalReturn: true }, - sourceType: sourceType + sourceType } }; @@ -34,7 +34,7 @@ function verifyAndAssertMessages(code, rules, expectedMessages, sourceType, over throw new Error(`Expected ${expectedMessages.length} message(s), got ${messages.length} ${JSON.stringify(messages)}`); } - messages.forEach(function (message, i) { + messages.forEach((message, i) => { var formatedMessage = `${message.line}:${message.column} ${message.message}${(message.ruleId ? ` ${message.ruleId}` : "")}`; if (formatedMessage !== expectedMessages[i]) { throw new Error( @@ -48,8 +48,8 @@ function verifyAndAssertMessages(code, rules, expectedMessages, sourceType, over }); } -describe("verify", function () { - it("arrow function support (issue #1)", function () { +describe("verify", () => { + it("arrow function support (issue #1)", () => { verifyAndAssertMessages( "describe('stuff', () => {});", {}, @@ -57,7 +57,7 @@ describe("verify", function () { ); }); - it("EOL validation (issue #2)", function () { + it("EOL validation (issue #2)", () => { verifyAndAssertMessages( "module.exports = \"something\";", { "eol-last": 1, "semi": 1 }, @@ -65,7 +65,7 @@ describe("verify", function () { ); }); - xit("Readable error messages (issue #3)", function () { + xit("Readable error messages (issue #3)", () => { verifyAndAssertMessages( "{ , res }", {}, @@ -73,7 +73,7 @@ describe("verify", function () { ); }); - it("Modules support (issue #5)", function () { + it("Modules support (issue #5)", () => { verifyAndAssertMessages( unpad(` import Foo from 'foo'; @@ -86,7 +86,7 @@ describe("verify", function () { ); }); - it("Rest parameters (issue #7)", function () { + it("Rest parameters (issue #7)", () => { verifyAndAssertMessages( "function foo(...args) { return args; }", { "no-undef": 1 }, @@ -94,7 +94,7 @@ describe("verify", function () { ); }); - it("Exported classes should be used (issue #8)", function () { + it("Exported classes should be used (issue #8)", () => { verifyAndAssertMessages( "class Foo {} module.exports = Foo;", { "no-unused-vars": 1 }, @@ -102,7 +102,7 @@ describe("verify", function () { ); }); - it("super keyword in class (issue #10)", function () { + it("super keyword in class (issue #10)", () => { verifyAndAssertMessages( "class Foo { constructor() { super() } }", { "no-undef": 1 }, @@ -110,7 +110,7 @@ describe("verify", function () { ); }); - it("Rest parameter in destructuring assignment (issue #11)", function () { + it("Rest parameter in destructuring assignment (issue #11)", () => { verifyAndAssertMessages( "const [a, ...rest] = ['1', '2', '3']; module.exports = rest;", { "no-undef": 1 }, @@ -118,7 +118,7 @@ describe("verify", function () { ); }); - it("JSX attribute names marked as variables (issue #12)", function () { + it("JSX attribute names marked as variables (issue #12)", () => { verifyAndAssertMessages( "module.exports =
", { "no-undef": 1 }, @@ -126,7 +126,7 @@ describe("verify", function () { ); }); - it("Multiple destructured assignment with compound properties (issue #16)", function () { + it("Multiple destructured assignment with compound properties (issue #16)", () => { verifyAndAssertMessages( "module.exports = { ...a.a, ...a.b };", { "no-dupe-keys": 1 }, @@ -134,7 +134,7 @@ describe("verify", function () { ); }); - it("Arrow function with non-block bodies (issue #20)", function () { + it("Arrow function with non-block bodies (issue #20)", () => { verifyAndAssertMessages( "\"use strict\"; () => 1", { "strict": [1, "global"] }, @@ -143,7 +143,7 @@ describe("verify", function () { ); }); - it("#242", function () { + it("#242", () => { verifyAndAssertMessages( "\"use strict\"; asdf;", { "no-irregular-whitespace": 1 }, @@ -152,7 +152,7 @@ describe("verify", function () { ); }); - it("await keyword (issue #22)", function () { + it("await keyword (issue #22)", () => { verifyAndAssertMessages( "async function foo() { await bar(); }", { "no-unused-expressions": 1 }, @@ -160,7 +160,7 @@ describe("verify", function () { ); }); - it("arrow functions (issue #27)", function () { + it("arrow functions (issue #27)", () => { verifyAndAssertMessages( "[1, 2, 3].map(i => i * 2);", { "func-names": 1, "space-before-blocks": 1 }, @@ -168,7 +168,7 @@ describe("verify", function () { ); }); - it("comment with padded-blocks (issue #33)", function () { + it("comment with padded-blocks (issue #33)", () => { verifyAndAssertMessages( unpad(` if (a) { @@ -181,8 +181,8 @@ describe("verify", function () { ); }); - describe("flow", function () { - it("check regular function", function () { + describe("flow", () => { + it("check regular function", () => { verifyAndAssertMessages( "function a(b, c) { b += 1; c += 1; return b + c; } a;", { "no-unused-vars": 1, "no-undef": 1 }, @@ -190,7 +190,7 @@ describe("verify", function () { ); }); - it("type alias", function () { + it("type alias", () => { verifyAndAssertMessages( "type SomeNewType = any;", { "no-undef": 1 }, @@ -198,7 +198,7 @@ describe("verify", function () { ); }); - it("type cast expression #102", function () { + it("type cast expression #102", () => { verifyAndAssertMessages( "for (let a of (a: Array)) {}", {}, @@ -206,7 +206,7 @@ describe("verify", function () { ); }); - it("multiple nullable type annotations and return #108", function () { + it("multiple nullable type annotations and return #108", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -222,7 +222,7 @@ describe("verify", function () { ); }); - it("type parameters", function () { + it("type parameters", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -235,7 +235,7 @@ describe("verify", function () { ); }); - it("nested type annotations", function () { + it("nested type annotations", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -249,7 +249,7 @@ describe("verify", function () { ); }); - it("type in var declaration", function () { + it("type in var declaration", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -261,7 +261,7 @@ describe("verify", function () { ); }); - it("object type annotation", function () { + it("object type annotation", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -273,7 +273,7 @@ describe("verify", function () { ); }); - it("object property types", function () { + it("object property types", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -288,7 +288,7 @@ describe("verify", function () { ); }); - it("namespaced types", function () { + it("namespaced types", () => { verifyAndAssertMessages( unpad(` var React = require('react-native'); @@ -306,7 +306,7 @@ describe("verify", function () { ); }); - it("ArrayTypeAnnotation", function () { + it("ArrayTypeAnnotation", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -317,7 +317,7 @@ describe("verify", function () { ); }); - it("ClassImplements", function () { + it("ClassImplements", () => { verifyAndAssertMessages( unpad(` import type Bar from 'foo'; @@ -328,7 +328,7 @@ describe("verify", function () { ); }); - it("type alias creates declaration + usage", function () { + it("type alias creates declaration + usage", () => { verifyAndAssertMessages( unpad(` type Foo = any; @@ -339,7 +339,7 @@ describe("verify", function () { ); }); - it("type alias with type parameters", function () { + it("type alias with type parameters", () => { verifyAndAssertMessages( unpad(` import type Bar from 'foo'; @@ -352,7 +352,7 @@ describe("verify", function () { ); }); - it("export type alias", function () { + it("export type alias", () => { verifyAndAssertMessages( unpad(` import type Foo2 from 'foo'; @@ -363,7 +363,7 @@ describe("verify", function () { ); }); - it("polymorphpic types #109", function () { + it("polymorphpic types #109", () => { verifyAndAssertMessages( "export default function groupByEveryN(array: Array, n: number): Array> { n; }", { "no-unused-vars": 1, "no-undef": 1 }, @@ -371,7 +371,7 @@ describe("verify", function () { ); }); - it("types definition from import", function () { + it("types definition from import", () => { verifyAndAssertMessages( unpad(` import type Promise from 'bluebird'; @@ -383,7 +383,7 @@ describe("verify", function () { ); }); - it("polymorphpic/generic types for class #123", function () { + it("polymorphpic/generic types for class #123", () => { verifyAndAssertMessages( unpad(` class Box { @@ -397,7 +397,7 @@ describe("verify", function () { ); }); - it("polymorphpic/generic types for function #123", function () { + it("polymorphpic/generic types for function #123", () => { verifyAndAssertMessages( unpad(` export function identity(value) { @@ -409,7 +409,7 @@ describe("verify", function () { ); }); - it("polymorphpic/generic types for type alias #123", function () { + it("polymorphpic/generic types for type alias #123", () => { verifyAndAssertMessages( unpad(` import Bar from './Bar'; @@ -420,7 +420,7 @@ describe("verify", function () { ); }); - it("polymorphpic/generic types - outside of fn scope #123", function () { + it("polymorphpic/generic types - outside of fn scope #123", () => { verifyAndAssertMessages( unpad(` export function foo(value) { value; }; @@ -432,7 +432,7 @@ describe("verify", function () { ); }); - it("polymorphpic/generic types - extending unknown #123", function () { + it("polymorphpic/generic types - extending unknown #123", () => { verifyAndAssertMessages( unpad(` import Bar from 'bar'; @@ -443,7 +443,7 @@ describe("verify", function () { ); }); - it("support declarations #132", function () { + it("support declarations #132", () => { verifyAndAssertMessages( unpad(` declare class A { static () : number } @@ -457,7 +457,7 @@ describe("verify", function () { ); }); - it("1", function () { + it("1", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -469,7 +469,7 @@ describe("verify", function () { ); }); - it("2", function () { + it("2", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -480,7 +480,7 @@ describe("verify", function () { ); }); - it("3", function () { + it("3", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -492,7 +492,7 @@ describe("verify", function () { ); }); - it("4", function () { + it("4", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -505,7 +505,7 @@ describe("verify", function () { ); }); - it("5", function () { + it("5", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -517,7 +517,7 @@ describe("verify", function () { ); }); - it("6", function () { + it("6", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -528,7 +528,7 @@ describe("verify", function () { ); }); - it("7", function () { + it("7", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -539,7 +539,7 @@ describe("verify", function () { ); }); - it("8", function () { + it("8", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -551,7 +551,7 @@ describe("verify", function () { ); }); - it("9", function () { + it("9", () => { verifyAndAssertMessages( "export default function (a: T1, b: T2) { b; }", { "no-unused-vars": 1, "no-undef": 1 }, @@ -559,7 +559,7 @@ describe("verify", function () { ); }); - it("10", function () { + it("10", () => { verifyAndAssertMessages( "var a=function(a: T1, b: T2) {return a + b;}; a;", { "no-unused-vars": 1, "no-undef": 1 }, @@ -567,7 +567,7 @@ describe("verify", function () { ); }); - it("11", function () { + it("11", () => { verifyAndAssertMessages( "var a={*id(x: T): T { x; }}; a;", { "no-unused-vars": 1, "no-undef": 1 }, @@ -575,7 +575,7 @@ describe("verify", function () { ); }); - it("12", function () { + it("12", () => { verifyAndAssertMessages( "var a={async id(x: T): T { x; }}; a;", { "no-unused-vars": 1, "no-undef": 1 }, @@ -583,7 +583,7 @@ describe("verify", function () { ); }); - it("13", function () { + it("13", () => { verifyAndAssertMessages( "var a={123(x: T): T { x; }}; a;", { "no-unused-vars": 1, "no-undef": 1 }, @@ -591,7 +591,7 @@ describe("verify", function () { ); }); - it("14", function () { + it("14", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -603,7 +603,7 @@ describe("verify", function () { ); }); - it("15", function () { + it("15", () => { verifyAndAssertMessages( unpad(` import type Foo2 from 'foo'; @@ -614,7 +614,7 @@ describe("verify", function () { ); }); - it("16", function () { + it("16", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -625,7 +625,7 @@ describe("verify", function () { ); }); - it("17", function () { + it("17", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -636,7 +636,7 @@ describe("verify", function () { ); }); - it("18", function () { + it("18", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -649,7 +649,7 @@ describe("verify", function () { ); }); - it("19", function () { + it("19", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -661,7 +661,7 @@ describe("verify", function () { ); }); - it("20", function () { + it("20", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -675,7 +675,7 @@ describe("verify", function () { ); }); - it("21", function () { + it("21", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -688,7 +688,7 @@ describe("verify", function () { ); }); - it("22", function () { + it("22", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -701,7 +701,7 @@ describe("verify", function () { ); }); - it("23", function () { + it("23", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -712,7 +712,7 @@ describe("verify", function () { ); }); - it("24", function () { + it("24", () => { verifyAndAssertMessages( unpad(` import type Baz from 'baz'; @@ -723,7 +723,7 @@ describe("verify", function () { ); }); - it("25", function () { + it("25", () => { verifyAndAssertMessages( "export default class Bar { bar(): T { return 42; }}", { "no-unused-vars": 1, "no-undef": 1 }, @@ -731,7 +731,7 @@ describe("verify", function () { ); }); - it("26", function () { + it("26", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -743,7 +743,7 @@ describe("verify", function () { ); }); - it("27", function () { + it("27", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -755,7 +755,7 @@ describe("verify", function () { ); }); - it("28", function () { + it("28", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -767,7 +767,7 @@ describe("verify", function () { ); }); - it("29", function () { + it("29", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -779,7 +779,7 @@ describe("verify", function () { ); }); - it("30", function () { + it("30", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -790,7 +790,7 @@ describe("verify", function () { ); }); - it("31", function () { + it("31", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -801,7 +801,7 @@ describe("verify", function () { ); }); - it("32", function () { + it("32", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -812,7 +812,7 @@ describe("verify", function () { ); }); - it("33", function () { + it("33", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -823,7 +823,7 @@ describe("verify", function () { ); }); - it("34", function () { + it("34", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -835,7 +835,7 @@ describe("verify", function () { ); }); - it("35", function () { + it("35", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -846,7 +846,7 @@ describe("verify", function () { ); }); - it("36", function () { + it("36", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -858,7 +858,7 @@ describe("verify", function () { ); }); - it("37", function () { + it("37", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -872,7 +872,7 @@ describe("verify", function () { ); }); - it("38", function () { + it("38", () => { verifyAndAssertMessages( unpad(` import type {foo, bar} from 'baz'; @@ -883,7 +883,7 @@ describe("verify", function () { ); }); - it("39", function () { + it("39", () => { verifyAndAssertMessages( unpad(` import type {foo as bar} from 'baz'; @@ -894,7 +894,7 @@ describe("verify", function () { ); }); - it("40", function () { + it("40", () => { verifyAndAssertMessages( unpad(` import type from 'foo'; @@ -905,7 +905,7 @@ describe("verify", function () { ); }); - it("41", function () { + it("41", () => { verifyAndAssertMessages( unpad(` import type, {foo} from 'bar'; @@ -916,7 +916,7 @@ describe("verify", function () { ); }); - it("42", function () { + it("42", () => { verifyAndAssertMessages( unpad(` import type * as namespace from 'bar'; @@ -927,7 +927,7 @@ describe("verify", function () { ); }); - it("43", function () { + it("43", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -938,7 +938,7 @@ describe("verify", function () { ); }); - it("44", function () { + it("44", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -949,7 +949,7 @@ describe("verify", function () { ); }); - it("45", function () { + it("45", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -960,7 +960,7 @@ describe("verify", function () { ); }); - it("46", function () { + it("46", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -971,7 +971,7 @@ describe("verify", function () { ); }); - it("47", function () { + it("47", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -982,7 +982,7 @@ describe("verify", function () { ); }); - it("48", function () { + it("48", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -993,7 +993,7 @@ describe("verify", function () { ); }); - it("49", function () { + it("49", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; @@ -1007,7 +1007,7 @@ describe("verify", function () { }); }); - it("class usage", function () { + it("class usage", () => { verifyAndAssertMessages( "class Lol {} module.exports = Lol;", { "no-unused-vars": 1 }, @@ -1015,7 +1015,7 @@ describe("verify", function () { ); }); - it("class definition: gaearon/redux#24", function () { + it("class definition: gaearon/redux#24", () => { verifyAndAssertMessages( unpad(` export default function root(stores) { @@ -1029,7 +1029,7 @@ describe("verify", function () { ); }); - it("class properties #71", function () { + it("class properties #71", () => { verifyAndAssertMessages( "class Lol { foo = 'bar'; }", { "no-undef": 1 }, @@ -1037,7 +1037,7 @@ describe("verify", function () { ); }); - it("template strings #31", function () { + it("template strings #31", () => { verifyAndAssertMessages( "console.log(`${a}, b`);", { "comma-spacing": 1 }, @@ -1045,7 +1045,7 @@ describe("verify", function () { ); }); - it("template with destructuring #31", function () { + it("template with destructuring #31", () => { verifyAndAssertMessages( unpad(` module.exports = { @@ -1060,8 +1060,8 @@ describe("verify", function () { ); }); - describe("decorators #72", function () { - it("class declaration", function () { + describe("decorators #72", () => { + it("class declaration", () => { verifyAndAssertMessages( unpad(` import classDeclaration from 'decorator'; @@ -1076,7 +1076,7 @@ describe("verify", function () { ); }); - it("method definition", function () { + it("method definition", () => { verifyAndAssertMessages( unpad(` import classMethodDeclarationA from 'decorator'; @@ -1095,7 +1095,7 @@ describe("verify", function () { ); }); - it("method definition get/set", function () { + it("method definition get/set", () => { verifyAndAssertMessages( unpad(` import classMethodDeclarationA from 'decorator'; @@ -1116,7 +1116,7 @@ describe("verify", function () { ); }); - it("object property", function () { + it("object property", () => { verifyAndAssertMessages( unpad(` import classMethodDeclarationA from 'decorator'; @@ -1136,7 +1136,7 @@ describe("verify", function () { ); }); - it("object property get/set", function () { + it("object property get/set", () => { verifyAndAssertMessages( unpad(` import classMethodDeclarationA from 'decorator'; @@ -1159,7 +1159,7 @@ describe("verify", function () { }); }); - it("detects minimal no-unused-vars case #120", function () { + it("detects minimal no-unused-vars case #120", () => { verifyAndAssertMessages( "var unused;", { "no-unused-vars": 1 }, @@ -1170,7 +1170,7 @@ describe("verify", function () { // This two tests are disabled, as the feature to visit properties when // there is a spread/rest operator has been removed as it caused problems // with other rules #249 - it.skip("visits excluded properties left of spread #95", function () { + it.skip("visits excluded properties left of spread #95", () => { verifyAndAssertMessages( "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", { "no-unused-vars": 1 }, @@ -1178,7 +1178,7 @@ describe("verify", function () { ); }); - it.skip("visits excluded properties left of spread #210", function () { + it.skip("visits excluded properties left of spread #210", () => { verifyAndAssertMessages( "const props = { yo: 'yo' }; const { ...otherProps } = props;", { "no-unused-vars": 1 }, @@ -1186,7 +1186,7 @@ describe("verify", function () { ); }); - it("does not mark spread variables false-positive", function () { + it("does not mark spread variables false-positive", () => { verifyAndAssertMessages( "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", { "no-undef": 1, "no-redeclare": 1 }, @@ -1194,7 +1194,7 @@ describe("verify", function () { ); }); - it("does not mark spread variables false-positive", function () { + it("does not mark spread variables false-positive", () => { verifyAndAssertMessages( "const props = { yo: 'yo' }; const { ...otherProps } = props;", { "no-undef": 1, "no-redeclare": 1 }, @@ -1202,7 +1202,7 @@ describe("verify", function () { ); }); - it("does not mark spread variables as use-before-define #249", function () { + it("does not mark spread variables as use-before-define #249", () => { verifyAndAssertMessages( "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", { "no-use-before-define": 1 }, @@ -1210,7 +1210,7 @@ describe("verify", function () { ); }); - it("detects no-unused-vars with object destructuring #142", function () { + it("detects no-unused-vars with object destructuring #142", () => { verifyAndAssertMessages( "const {Bacona} = require('baconjs')", { "no-undef": 1, "no-unused-vars": 1 }, @@ -1218,7 +1218,7 @@ describe("verify", function () { ); }); - it("don't warn no-unused-vars with spread #142", function () { + it("don't warn no-unused-vars with spread #142", () => { verifyAndAssertMessages( unpad(` export default function test(data) { @@ -1233,7 +1233,7 @@ describe("verify", function () { ); }); - it("excludes comment tokens #153", function () { + it("excludes comment tokens #153", () => { verifyAndAssertMessages( unpad(` var a = [ @@ -1258,7 +1258,7 @@ describe("verify", function () { ); }); - it("ternary and parens #149", function () { + it("ternary and parens #149", () => { verifyAndAssertMessages( "true ? (true) : false;", { "space-infix-ops": 1 }, @@ -1266,7 +1266,7 @@ describe("verify", function () { ); }); - it("line comment space-in-parens #124", function () { + it("line comment space-in-parens #124", () => { verifyAndAssertMessages( unpad(` React.createClass({ @@ -1282,7 +1282,7 @@ describe("verify", function () { ); }); - it("block comment space-in-parens #124", function () { + it("block comment space-in-parens #124", () => { verifyAndAssertMessages( unpad(` React.createClass({ @@ -1300,21 +1300,21 @@ describe("verify", function () { ); }); - it("no no-undef error with rest #11", function () { + it("no no-undef error with rest #11", () => { verifyAndAssertMessages("const [a, ...rest] = ['1', '2', '3']; a; rest;", { "no-undef": 1, "no-unused-vars": 1 }, [ ] ); }); - it("async function with space-before-function-paren #168", function () { + it("async function with space-before-function-paren #168", () => { verifyAndAssertMessages("it('handles updates', async function() {});", { "space-before-function-paren": [1, "never"] }, [ ] ); }); - it("default param flow type no-unused-vars #184", function () { + it("default param flow type no-unused-vars #184", () => { verifyAndAssertMessages( unpad(` type ResolveOptionType = { @@ -1333,7 +1333,7 @@ describe("verify", function () { ); }); - it("no-use-before-define #192", function () { + it("no-use-before-define #192", () => { verifyAndAssertMessages( unpad(` console.log(x); @@ -1344,7 +1344,7 @@ describe("verify", function () { ); }); - it("jsx and stringliteral #216", function () { + it("jsx and stringliteral #216", () => { verifyAndAssertMessages( "
", {}, @@ -1352,7 +1352,7 @@ describe("verify", function () { ); }); - it("getter/setter #218", function () { + it("getter/setter #218", () => { verifyAndAssertMessages( unpad(` class Person { @@ -1364,7 +1364,7 @@ describe("verify", function () { ); }); - it("getter/setter #220", function () { + it("getter/setter #220", () => { verifyAndAssertMessages( unpad(` var B = { @@ -1381,7 +1381,7 @@ describe("verify", function () { ); }); - it("fixes issues with flow types and ObjectPattern", function () { + it("fixes issues with flow types and ObjectPattern", () => { verifyAndAssertMessages( unpad(` import type Foo from 'bar'; @@ -1395,7 +1395,7 @@ describe("verify", function () { ); }); - it("correctly detects redeclares if in script mode #217", function () { + it("correctly detects redeclares if in script mode #217", () => { verifyAndAssertMessages( unpad(` var a = 321; @@ -1407,7 +1407,7 @@ describe("verify", function () { ); }); - it("correctly detects redeclares if in module mode #217", function () { + it("correctly detects redeclares if in module mode #217", () => { verifyAndAssertMessages( unpad(` var a = 321; @@ -1419,7 +1419,7 @@ describe("verify", function () { ); }); - it("no-implicit-globals in script", function () { + it("no-implicit-globals in script", () => { verifyAndAssertMessages( "var leakedGlobal = 1;", { "no-implicit-globals": 1 }, @@ -1432,7 +1432,7 @@ describe("verify", function () { ); }); - it("no-implicit-globals in module", function () { + it("no-implicit-globals in module", () => { verifyAndAssertMessages( "var leakedGlobal = 1;", { "no-implicit-globals": 1 }, @@ -1445,7 +1445,7 @@ describe("verify", function () { ); }); - it("no-implicit-globals in default", function () { + it("no-implicit-globals in default", () => { verifyAndAssertMessages( "var leakedGlobal = 1;", { "no-implicit-globals": 1 }, @@ -1458,7 +1458,7 @@ describe("verify", function () { ); }); - it("allowImportExportEverywhere option (#327)", function () { + it("allowImportExportEverywhere option (#327)", () => { verifyAndAssertMessages( unpad(` if (true) { import Foo from 'foo'; } @@ -1475,7 +1475,7 @@ describe("verify", function () { ); }); - it("with does not crash parsing in script mode (strict off) #171", function () { + it("with does not crash parsing in script mode (strict off) #171", () => { verifyAndAssertMessages( "with (arguments) { length; }", {}, @@ -1484,7 +1484,7 @@ describe("verify", function () { ); }); - xit("with does crash parsing in module mode (strict on) #171", function () { + xit("with does crash parsing in module mode (strict on) #171", () => { verifyAndAssertMessages( "with (arguments) { length; }", {}, @@ -1492,7 +1492,7 @@ describe("verify", function () { ); }); - it("new.target is not reported as undef #235", function () { + it("new.target is not reported as undef #235", () => { verifyAndAssertMessages( "function foo () { return new.target }", { "no-undef": 1 }, @@ -1500,7 +1500,7 @@ describe("verify", function () { ); }); - it("decorator does not create TypeError #229", function () { + it("decorator does not create TypeError #229", () => { verifyAndAssertMessages( unpad(` class A { @@ -1513,7 +1513,7 @@ describe("verify", function () { ); }); - it("Flow definition does not trigger warnings #223", function () { + it("Flow definition does not trigger warnings #223", () => { verifyAndAssertMessages( unpad(` import { Map as $Map } from 'immutable'; @@ -1524,7 +1524,7 @@ describe("verify", function () { ); }); - it("newline-before-return with comments #289", function () { + it("newline-before-return with comments #289", () => { verifyAndAssertMessages( unpad(` function a() { @@ -1542,7 +1542,7 @@ describe("verify", function () { ); }); - it("spaced-comment with shebang #163", function () { + it("spaced-comment with shebang #163", () => { verifyAndAssertMessages( unpad(` #!/usr/bin/env babel-node @@ -1553,8 +1553,8 @@ describe("verify", function () { ); }); - describe("Class Property Declarations", function() { - it("no-redeclare false positive 1", function() { + describe("Class Property Declarations", () => { + it("no-redeclare false positive 1", () => { verifyAndAssertMessages( unpad(` class Group { @@ -1569,7 +1569,7 @@ describe("verify", function () { ); }); - it("no-redeclare false positive 2", function() { + it("no-redeclare false positive 2", () => { verifyAndAssertMessages( unpad(` function validate() {} @@ -1582,7 +1582,7 @@ describe("verify", function () { ); }); - it("check references", function() { + it("check references", () => { verifyAndAssertMessages( unpad(` var a; @@ -1601,7 +1601,7 @@ describe("verify", function () { }); }); - it("dynamic import support", function () { + it("dynamic import support", () => { verifyAndAssertMessages( "import('test-module').then(() => {})", {}, From 4f4d229e0ad8fe04f1e91e9066ab0d708914e946 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sun, 15 Jan 2017 06:59:51 -0500 Subject: [PATCH 340/569] chore(package): update eslint-config-babel to version 6.0.0 (babel/babel-eslint#433) * chore(package): update eslint-config-babel to version 6.0.0 Closes babel/babel-eslint#432 https://greenkeeper.io/ * Fix linting --- eslint/babel-eslint-parser/.gitignore | 1 - eslint/babel-eslint-parser/package.json | 2 +- .../babel-eslint-parser/test/babel-eslint.js | 4 +- .../test/non-regression.js | 2 +- eslint/babel-eslint-parser/yarn.lock | 1013 +++++++++++++++++ 5 files changed, 1017 insertions(+), 5 deletions(-) create mode 100644 eslint/babel-eslint-parser/yarn.lock diff --git a/eslint/babel-eslint-parser/.gitignore b/eslint/babel-eslint-parser/.gitignore index 2d6ddb5d003c..93f136199161 100644 --- a/eslint/babel-eslint-parser/.gitignore +++ b/eslint/babel-eslint-parser/.gitignore @@ -1,3 +1,2 @@ node_modules npm-debug.log -yarn.lock diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index a9ba5345a5a1..5c616f90f196 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -40,7 +40,7 @@ "devDependencies": { "babel-eslint": "^7.0.0", "eslint": "^3.9.1", - "eslint-config-babel": "^4.0.0", + "eslint-config-babel": "^6.0.0", "eslint-plugin-babel": "^4.0.0", "eslint-plugin-flowtype": "^2.4.0", "espree": "^3.3.1", diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 62463f443ac9..41586c097fac 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -73,9 +73,9 @@ function parseAndAssertSame(code) { } err.message += unpad(` espree: - ${util.inspect(lookup(esAST, traversal, 2), {depth: err.depth, colors: true})} + ${util.inspect(lookup(esAST, traversal, 2), { depth: err.depth, colors: true })} babel-eslint: - ${util.inspect(lookup(babylonAST, traversal, 2), {depth: err.depth, colors: true})} + ${util.inspect(lookup(babylonAST, traversal, 2), { depth: err.depth, colors: true })} `); throw err; } diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 52f30bc7fd2c..ee8c03a98740 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1359,7 +1359,7 @@ describe("verify", () => { set a (v) { } } `), - { "space-before-function-paren": 1, "keyword-spacing": [1, {"before": true}], "indent": 1 }, + { "space-before-function-paren": 1, "keyword-spacing": [1, { "before": true }], "indent": 1 }, [] ); }); diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock new file mode 100644 index 000000000000..5cfc9dbadfc0 --- /dev/null +++ b/eslint/babel-eslint-parser/yarn.lock @@ -0,0 +1,1013 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +acorn-jsx@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" + dependencies: + acorn "^3.0.4" + +acorn@^3.0.4: + version "3.3.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" + +acorn@^4.0.1: + version "4.0.4" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.4.tgz#17a8d6a7a6c4ef538b814ec9abac2779293bf30a" + +ajv-keywords@^1.0.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.0.tgz#c11e6859eafff83e0dafc416929472eca946aa2c" + +ajv@^4.7.0: + version "4.10.4" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.10.4.tgz#c0974dd00b3464984892d6010aa9c2c945933254" + dependencies: + co "^4.6.0" + json-stable-stringify "^1.0.1" + +ansi-escapes@^1.1.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" + +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + +ansi-styles@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" + +argparse@^1.0.7: + version "1.0.9" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86" + dependencies: + sprintf-js "~1.0.2" + +array-union@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" + dependencies: + array-uniq "^1.0.1" + +array-uniq@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" + +arrify@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" + +babel-code-frame@^6.16.0, babel-code-frame@^6.20.0: + version "6.20.0" + resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.20.0.tgz#b968f839090f9a8bc6d41938fb96cb84f7387b26" + dependencies: + chalk "^1.1.0" + esutils "^2.0.2" + js-tokens "^2.0.0" + +babel-eslint@^7.0.0: + version "7.1.1" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-7.1.1.tgz#8a6a884f085aa7060af69cfc77341c2f99370fb2" + dependencies: + babel-code-frame "^6.16.0" + babel-traverse "^6.15.0" + babel-types "^6.15.0" + babylon "^6.13.0" + lodash.pickby "^4.6.0" + +babel-messages@^6.8.0: + version "6.8.0" + resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.8.0.tgz#bf504736ca967e6d65ef0adb5a2a5f947c8e0eb9" + dependencies: + babel-runtime "^6.0.0" + +babel-runtime@^6.0.0, babel-runtime@^6.20.0: + version "6.20.0" + resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.20.0.tgz#87300bdcf4cd770f09bf0048c64204e17806d16f" + dependencies: + core-js "^2.4.0" + regenerator-runtime "^0.10.0" + +babel-traverse@^6.15.0: + version "6.21.0" + resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.21.0.tgz#69c6365804f1a4f69eb1213f85b00a818b8c21ad" + dependencies: + babel-code-frame "^6.20.0" + babel-messages "^6.8.0" + babel-runtime "^6.20.0" + babel-types "^6.21.0" + babylon "^6.11.0" + debug "^2.2.0" + globals "^9.0.0" + invariant "^2.2.0" + lodash "^4.2.0" + +babel-types@^6.15.0, babel-types@^6.21.0: + version "6.21.0" + resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.21.0.tgz#314b92168891ef6d3806b7f7a917fdf87c11a4b2" + dependencies: + babel-runtime "^6.20.0" + esutils "^2.0.2" + lodash "^4.2.0" + to-fast-properties "^1.0.1" + +babylon@^6.11.0, babylon@^6.13.0: + version "6.15.0" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.15.0.tgz#ba65cfa1a80e1759b0e89fb562e27dccae70348e" + +balanced-match@^0.4.1: + version "0.4.2" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838" + +brace-expansion@^1.0.0: + version "1.1.6" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.6.tgz#7197d7eaa9b87e648390ea61fc66c84427420df9" + dependencies: + balanced-match "^0.4.1" + concat-map "0.0.1" + +browser-stdout@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" + +buffer-shims@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/buffer-shims/-/buffer-shims-1.0.0.tgz#9978ce317388c649ad8793028c3477ef044a8b51" + +caller-path@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" + dependencies: + callsites "^0.2.0" + +callsites@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" + +chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + dependencies: + ansi-styles "^2.2.1" + escape-string-regexp "^1.0.2" + has-ansi "^2.0.0" + strip-ansi "^3.0.0" + supports-color "^2.0.0" + +circular-json@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.1.tgz#be8b36aefccde8b3ca7aa2d6afc07a37242c0d2d" + +cli-cursor@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-1.0.2.tgz#64da3f7d56a54412e59794bd62dc35295e8f2987" + dependencies: + restore-cursor "^1.0.1" + +cli-width@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.1.0.tgz#b234ca209b29ef66fc518d9b98d5847b00edf00a" + +co@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + +code-point-at@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + +commander@2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" + dependencies: + graceful-readlink ">= 1.0.0" + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + +concat-stream@^1.4.6: + version "1.6.0" + resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" + dependencies: + inherits "^2.0.3" + readable-stream "^2.2.2" + typedarray "^0.0.6" + +core-js@^2.4.0: + version "2.4.1" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.4.1.tgz#4de911e667b0eae9124e34254b53aea6fc618d3e" + +core-util-is@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + +d@^0.1.1, d@~0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/d/-/d-0.1.1.tgz#da184c535d18d8ee7ba2aa229b914009fae11309" + dependencies: + es5-ext "~0.10.2" + +debug@2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da" + dependencies: + ms "0.7.1" + +debug@^2.1.1, debug@^2.2.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.0.tgz#bc596bcabe7617f11d9fa15361eded5608b8499b" + dependencies: + ms "0.7.2" + +deep-is@~0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" + +del@^2.0.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8" + dependencies: + globby "^5.0.0" + is-path-cwd "^1.0.0" + is-path-in-cwd "^1.0.0" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + rimraf "^2.2.8" + +diff@1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-1.4.0.tgz#7f28d2eb9ee7b15a97efd89ce63dcfdaa3ccbabf" + +doctrine@^1.2.2: + version "1.5.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" + dependencies: + esutils "^2.0.2" + isarray "^1.0.0" + +es5-ext@^0.10.7, es5-ext@^0.10.8, es5-ext@~0.10.11, es5-ext@~0.10.2, es5-ext@~0.10.7: + version "0.10.12" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.12.tgz#aa84641d4db76b62abba5e45fd805ecbab140047" + dependencies: + es6-iterator "2" + es6-symbol "~3.1" + +es6-iterator@2: + version "2.0.0" + resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.0.tgz#bd968567d61635e33c0b80727613c9cb4b096bac" + dependencies: + d "^0.1.1" + es5-ext "^0.10.7" + es6-symbol "3" + +es6-map@^0.1.3: + version "0.1.4" + resolved "https://registry.yarnpkg.com/es6-map/-/es6-map-0.1.4.tgz#a34b147be224773a4d7da8072794cefa3632b897" + dependencies: + d "~0.1.1" + es5-ext "~0.10.11" + es6-iterator "2" + es6-set "~0.1.3" + es6-symbol "~3.1.0" + event-emitter "~0.3.4" + +es6-set@~0.1.3: + version "0.1.4" + resolved "https://registry.yarnpkg.com/es6-set/-/es6-set-0.1.4.tgz#9516b6761c2964b92ff479456233a247dc707ce8" + dependencies: + d "~0.1.1" + es5-ext "~0.10.11" + es6-iterator "2" + es6-symbol "3" + event-emitter "~0.3.4" + +es6-symbol@3, es6-symbol@~3.1, es6-symbol@~3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.0.tgz#94481c655e7a7cad82eba832d97d5433496d7ffa" + dependencies: + d "~0.1.1" + es5-ext "~0.10.11" + +es6-weak-map@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.1.tgz#0d2bbd8827eb5fb4ba8f97fbfea50d43db21ea81" + dependencies: + d "^0.1.1" + es5-ext "^0.10.8" + es6-iterator "2" + es6-symbol "3" + +escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + +escope@^3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/escope/-/escope-3.6.0.tgz#e01975e812781a163a6dadfdd80398dc64c889c3" + dependencies: + es6-map "^0.1.3" + es6-weak-map "^2.0.1" + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint-config-babel@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/eslint-config-babel/-/eslint-config-babel-6.0.0.tgz#66feedf6ce6e04abe585cec1a65b5bcc96bed50a" + +eslint-plugin-babel@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-babel/-/eslint-plugin-babel-4.0.0.tgz#a92114e2c493ac3034b030d7ecf96e174a76ef3f" + +eslint-plugin-flowtype@^2.4.0: + version "2.29.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.29.2.tgz#91b4fde0400c4c37ca4440b43bdbc95fc405bea9" + dependencies: + lodash "^4.15.0" + +eslint@^3.9.1: + version "3.13.1" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.13.1.tgz#564d2646b5efded85df96985332edd91a23bff25" + dependencies: + babel-code-frame "^6.16.0" + chalk "^1.1.3" + concat-stream "^1.4.6" + debug "^2.1.1" + doctrine "^1.2.2" + escope "^3.6.0" + espree "^3.3.1" + estraverse "^4.2.0" + esutils "^2.0.2" + file-entry-cache "^2.0.0" + glob "^7.0.3" + globals "^9.14.0" + ignore "^3.2.0" + imurmurhash "^0.1.4" + inquirer "^0.12.0" + is-my-json-valid "^2.10.0" + is-resolvable "^1.0.0" + js-yaml "^3.5.1" + json-stable-stringify "^1.0.0" + levn "^0.3.0" + lodash "^4.0.0" + mkdirp "^0.5.0" + natural-compare "^1.4.0" + optionator "^0.8.2" + path-is-inside "^1.0.1" + pluralize "^1.2.1" + progress "^1.1.8" + require-uncached "^1.0.2" + shelljs "^0.7.5" + strip-bom "^3.0.0" + strip-json-comments "~2.0.1" + table "^3.7.8" + text-table "~0.2.0" + user-home "^2.0.0" + +espree@^3.3.1: + version "3.3.2" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.3.2.tgz#dbf3fadeb4ecb4d4778303e50103b3d36c88b89c" + dependencies: + acorn "^4.0.1" + acorn-jsx "^3.0.0" + +esprima@^2.6.0: + version "2.7.3" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581" + +esrecurse@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.1.0.tgz#4713b6536adf7f2ac4f327d559e7756bff648220" + dependencies: + estraverse "~4.1.0" + object-assign "^4.0.1" + +estraverse@^4.1.1, estraverse@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" + +estraverse@~4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.1.1.tgz#f6caca728933a850ef90661d0e17982ba47111a2" + +esutils@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" + +event-emitter@~0.3.4: + version "0.3.4" + resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.4.tgz#8d63ddfb4cfe1fae3b32ca265c4c720222080bb5" + dependencies: + d "~0.1.1" + es5-ext "~0.10.7" + +exit-hook@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8" + +fast-levenshtein@~2.0.4: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + +figures@^1.3.5: + version "1.7.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" + dependencies: + escape-string-regexp "^1.0.5" + object-assign "^4.1.0" + +file-entry-cache@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" + dependencies: + flat-cache "^1.2.1" + object-assign "^4.0.1" + +flat-cache@^1.2.1: + version "1.2.2" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.2.2.tgz#fa86714e72c21db88601761ecf2f555d1abc6b96" + dependencies: + circular-json "^0.3.1" + del "^2.0.2" + graceful-fs "^4.1.2" + write "^0.2.1" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + +generate-function@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/generate-function/-/generate-function-2.0.0.tgz#6858fe7c0969b7d4e9093337647ac79f60dfbe74" + +generate-object-property@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/generate-object-property/-/generate-object-property-1.2.0.tgz#9c0e1c40308ce804f4783618b937fa88f99d50d0" + dependencies: + is-property "^1.0.0" + +glob@7.0.5: + version "7.0.5" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.0.5.tgz#b4202a69099bbb4d292a7c1b95b6682b67ebdc95" + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.2" + once "^1.3.0" + path-is-absolute "^1.0.0" + +glob@^7.0.0, glob@^7.0.3, glob@^7.0.5: + version "7.1.1" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.2" + once "^1.3.0" + path-is-absolute "^1.0.0" + +globals@^9.0.0, globals@^9.14.0: + version "9.14.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-9.14.0.tgz#8859936af0038741263053b39d0e76ca241e4034" + +globby@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d" + dependencies: + array-union "^1.0.1" + arrify "^1.0.0" + glob "^7.0.3" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + +graceful-fs@^4.1.2: + version "4.1.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" + +"graceful-readlink@>= 1.0.0": + version "1.0.1" + resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" + +growl@1.9.2: + version "1.9.2" + resolved "https://registry.yarnpkg.com/growl/-/growl-1.9.2.tgz#0ea7743715db8d8de2c5ede1775e1b45ac85c02f" + +has-ansi@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + dependencies: + ansi-regex "^2.0.0" + +has-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" + +ignore@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.2.0.tgz#8d88f03c3002a0ac52114db25d2c673b0bf1e435" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2, inherits@^2.0.3, inherits@~2.0.1: + version "2.0.3" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + +inquirer@^0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-0.12.0.tgz#1ef2bfd63504df0bc75785fff8c2c41df12f077e" + dependencies: + ansi-escapes "^1.1.0" + ansi-regex "^2.0.0" + chalk "^1.0.0" + cli-cursor "^1.0.1" + cli-width "^2.0.0" + figures "^1.3.5" + lodash "^4.3.0" + readline2 "^1.0.1" + run-async "^0.1.0" + rx-lite "^3.1.2" + string-width "^1.0.1" + strip-ansi "^3.0.0" + through "^2.3.6" + +interpret@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.1.tgz#d579fb7f693b858004947af39fa0db49f795602c" + +invariant@^2.2.0: + version "2.2.2" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" + dependencies: + loose-envify "^1.0.0" + +is-fullwidth-code-point@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + dependencies: + number-is-nan "^1.0.0" + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + +is-my-json-valid@^2.10.0: + version "2.15.0" + resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.15.0.tgz#936edda3ca3c211fd98f3b2d3e08da43f7b2915b" + dependencies: + generate-function "^2.0.0" + generate-object-property "^1.1.0" + jsonpointer "^4.0.0" + xtend "^4.0.0" + +is-path-cwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" + +is-path-in-cwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz#6477582b8214d602346094567003be8a9eac04dc" + dependencies: + is-path-inside "^1.0.0" + +is-path-inside@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.0.tgz#fc06e5a1683fbda13de667aff717bbc10a48f37f" + dependencies: + path-is-inside "^1.0.1" + +is-property@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" + +is-resolvable@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.0.0.tgz#8df57c61ea2e3c501408d100fb013cf8d6e0cc62" + dependencies: + tryit "^1.0.1" + +isarray@^1.0.0, isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + +js-tokens@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-2.0.0.tgz#79903f5563ee778cc1162e6dcf1a0027c97f9cb5" + +js-yaml@^3.5.1: + version "3.7.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.7.0.tgz#5c967ddd837a9bfdca5f2de84253abe8a1c03b80" + dependencies: + argparse "^1.0.7" + esprima "^2.6.0" + +json-stable-stringify@^1.0.0, json-stable-stringify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" + dependencies: + jsonify "~0.0.0" + +json3@3.3.2: + version "3.3.2" + resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.2.tgz#3c0434743df93e2f5c42aee7b19bcb483575f4e1" + +jsonify@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" + +jsonpointer@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/jsonpointer/-/jsonpointer-4.0.1.tgz#4fd92cb34e0e9db3c89c8622ecf51f9b978c6cb9" + +levn@^0.3.0, levn@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" + dependencies: + prelude-ls "~1.1.2" + type-check "~0.3.2" + +lodash._baseassign@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz#8c38a099500f215ad09e59f1722fd0c52bfe0a4e" + dependencies: + lodash._basecopy "^3.0.0" + lodash.keys "^3.0.0" + +lodash._basecopy@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36" + +lodash._basecreate@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz#1bc661614daa7fc311b7d03bf16806a0213cf821" + +lodash._getnative@^3.0.0: + version "3.9.1" + resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" + +lodash._isiterateecall@^3.0.0: + version "3.0.9" + resolved "https://registry.yarnpkg.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz#5203ad7ba425fae842460e696db9cf3e6aac057c" + +lodash.create@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/lodash.create/-/lodash.create-3.1.1.tgz#d7f2849f0dbda7e04682bb8cd72ab022461debe7" + dependencies: + lodash._baseassign "^3.0.0" + lodash._basecreate "^3.0.0" + lodash._isiterateecall "^3.0.0" + +lodash.isarguments@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" + +lodash.isarray@^3.0.0: + version "3.0.4" + resolved "https://registry.yarnpkg.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55" + +lodash.keys@^3.0.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a" + dependencies: + lodash._getnative "^3.0.0" + lodash.isarguments "^3.0.0" + lodash.isarray "^3.0.0" + +lodash.pickby@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/lodash.pickby/-/lodash.pickby-4.6.0.tgz#7dea21d8c18d7703a27c704c15d3b84a67e33aff" + +lodash@^4.0.0, lodash@^4.15.0, lodash@^4.2.0, lodash@^4.3.0: + version "4.17.4" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" + +loose-envify@^1.0.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.0.tgz#6b26248c42f6d4fa4b0d8542f78edfcde35642a8" + dependencies: + js-tokens "^2.0.0" + +minimatch@^3.0.2: + version "3.0.3" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774" + dependencies: + brace-expansion "^1.0.0" + +minimist@0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + +mkdirp@0.5.1, mkdirp@^0.5.0, mkdirp@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + dependencies: + minimist "0.0.8" + +mocha@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-3.2.0.tgz#7dc4f45e5088075171a68896814e6ae9eb7a85e3" + dependencies: + browser-stdout "1.3.0" + commander "2.9.0" + debug "2.2.0" + diff "1.4.0" + escape-string-regexp "1.0.5" + glob "7.0.5" + growl "1.9.2" + json3 "3.3.2" + lodash.create "3.1.1" + mkdirp "0.5.1" + supports-color "3.1.2" + +ms@0.7.1: + version "0.7.1" + resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.1.tgz#9cd13c03adbff25b65effde7ce864ee952017098" + +ms@0.7.2: + version "0.7.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.2.tgz#ae25cf2512b3885a1d95d7f037868d8431124765" + +mute-stream@0.0.5: + version "0.0.5" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.5.tgz#8fbfabb0a98a253d3184331f9e8deb7372fac6c0" + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + +number-is-nan@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + +object-assign@^4.0.1, object-assign@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.0.tgz#7a3b3d0e98063d43f4c03f2e8ae6cd51a86883a0" + +once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + dependencies: + wrappy "1" + +onetime@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789" + +optionator@^0.8.2: + version "0.8.2" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" + dependencies: + deep-is "~0.1.3" + fast-levenshtein "~2.0.4" + levn "~0.3.0" + prelude-ls "~1.1.2" + type-check "~0.3.2" + wordwrap "~1.0.0" + +os-homedir@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + +path-is-inside@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" + +pify@^2.0.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + +pinkie-promise@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" + dependencies: + pinkie "^2.0.0" + +pinkie@^2.0.0: + version "2.0.4" + resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" + +pluralize@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-1.2.1.tgz#d1a21483fd22bb41e58a12fa3421823140897c45" + +prelude-ls@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" + +process-nextick-args@~1.0.6: + version "1.0.7" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" + +progress@^1.1.8: + version "1.1.8" + resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be" + +readable-stream@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.2.tgz#a9e6fec3c7dda85f8bb1b3ba7028604556fc825e" + dependencies: + buffer-shims "^1.0.0" + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "~1.0.0" + process-nextick-args "~1.0.6" + string_decoder "~0.10.x" + util-deprecate "~1.0.1" + +readline2@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/readline2/-/readline2-1.0.1.tgz#41059608ffc154757b715d9989d199ffbf372e35" + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + mute-stream "0.0.5" + +rechoir@^0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" + dependencies: + resolve "^1.1.6" + +regenerator-runtime@^0.10.0: + version "0.10.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.1.tgz#257f41961ce44558b18f7814af48c17559f9faeb" + +require-uncached@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" + dependencies: + caller-path "^0.1.0" + resolve-from "^1.0.0" + +resolve-from@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" + +resolve@^1.1.6: + version "1.2.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.2.0.tgz#9589c3f2f6149d1417a40becc1663db6ec6bc26c" + +restore-cursor@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541" + dependencies: + exit-hook "^1.0.0" + onetime "^1.0.0" + +rimraf@^2.2.8: + version "2.5.4" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.5.4.tgz#96800093cbf1a0c86bd95b4625467535c29dfa04" + dependencies: + glob "^7.0.5" + +run-async@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-0.1.0.tgz#c8ad4a5e110661e402a7d21b530e009f25f8e389" + dependencies: + once "^1.3.0" + +rx-lite@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102" + +shelljs@^0.7.5: + version "0.7.6" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.6.tgz#379cccfb56b91c8601e4793356eb5382924de9ad" + dependencies: + glob "^7.0.0" + interpret "^1.0.0" + rechoir "^0.6.2" + +slice-ansi@0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + +string-width@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + strip-ansi "^3.0.0" + +string-width@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.0.0.tgz#635c5436cc72a6e0c387ceca278d4e2eec52687e" + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^3.0.0" + +string_decoder@~0.10.x: + version "0.10.31" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" + +strip-ansi@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + dependencies: + ansi-regex "^2.0.0" + +strip-bom@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + +strip-json-comments@~2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + +supports-color@3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.1.2.tgz#72a262894d9d408b956ca05ff37b2ed8a6e2a2d5" + dependencies: + has-flag "^1.0.0" + +supports-color@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" + +table@^3.7.8: + version "3.8.3" + resolved "https://registry.yarnpkg.com/table/-/table-3.8.3.tgz#2bbc542f0fda9861a755d3947fefd8b3f513855f" + dependencies: + ajv "^4.7.0" + ajv-keywords "^1.0.0" + chalk "^1.1.1" + lodash "^4.0.0" + slice-ansi "0.0.4" + string-width "^2.0.0" + +text-table@~0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + +through@^2.3.6: + version "2.3.8" + resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + +to-fast-properties@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.2.tgz#f3f5c0c3ba7299a7ef99427e44633257ade43320" + +tryit@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/tryit/-/tryit-1.0.3.tgz#393be730a9446fd1ead6da59a014308f36c289cb" + +type-check@~0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" + dependencies: + prelude-ls "~1.1.2" + +typedarray@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" + +user-home@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/user-home/-/user-home-2.0.0.tgz#9c70bfd8169bc1dcbf48604e0f04b8b49cde9e9f" + dependencies: + os-homedir "^1.0.0" + +util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + +wordwrap@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + +write@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" + dependencies: + mkdirp "^0.5.1" + +xtend@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" From ad8a7e78e155a9cfe4f74f3f30560dafbb238a2c Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 28 Feb 2017 23:39:49 -0500 Subject: [PATCH 341/569] update readme [skip ci] --- eslint/babel-eslint-parser/README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index 1e38efd27d8d..ab69d9ebc0d7 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -3,9 +3,11 @@ **babel-eslint** allows you to lint **ALL** valid Babel code with the fantastic [ESLint](https://github.com/eslint/eslint). -#### Note: You don't need to use babel-eslint if you are using ES2015 (ES6), ES2016 (ES7) or ES2017 (ES8). ESLint actually supports ES2015/ES2016/ES2017, JSX, and object rest/spread by default now. +### Why Use babel-eslint -##### At the moment, you'll need it if you use stuff like class properties, decorators, types. +You only need to use babel-eslint if you are using types (Flow) or experimental features not supported in ESLint itself yet. Otherwise try the default parser (you don't have to use it just because you are using Babel). + +--- > If there is an issue, first check if it can be reproduced with the regular parser or with the latest versions of `eslint` and `babel-eslint`! @@ -43,21 +45,19 @@ It just needs to export a `parse` method that takes in a string of code and outp ## Usage +> ESLint 1.x | Use <= 5.x + +> ESLint 2.x | Use >= 6.x + ### Supported ESLint versions ESLint | babel-eslint ------------ | ------------- -1.x | <= 5.x -2.x | >= 6.x 3.x | >= 6.x ### Install ```sh -$ npm install eslint@1.x babel-eslint@5 --save-dev - -$ npm install eslint@2.x babel-eslint@6 --save-dev - $ npm install eslint@3.x babel-eslint@6 --save-dev ``` From b3c41bd5d7024412730b369820a59a5669549379 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 28 Feb 2017 23:41:03 -0500 Subject: [PATCH 342/569] remove deprecated rule examples [skip ci] --- eslint/babel-eslint-parser/README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index ab69d9ebc0d7..ff6e41a5fb6a 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -29,9 +29,7 @@ Modules/strict mode Please check out [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) for React/JSX issues - `no-unused-vars` with jsx -Please check out [eslint-plugin-babel](https://github.com/babel/eslint-plugin-babel) for other issues such as (and more): -- `generator-star` with async/await functions [#78](https://github.com/babel/babel-eslint/issues/78) -- `object-shorthand` with spread operator [#131](https://github.com/babel/babel-eslint/issues/131) +Please check out [eslint-plugin-babel](https://github.com/babel/eslint-plugin-babel) for other issues ## How does it work? From dccd5a75931ce0091a61e71338b82f670b08cb81 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 20 Mar 2017 11:44:33 -0400 Subject: [PATCH 343/569] Merge pull request babel/babel-eslint#447 from kaicataldo/clean-up-eslint Chore: Clean up and upgrades --- eslint/babel-eslint-parser/.eslintrc.js | 4 - eslint/babel-eslint-parser/eslint | 1 - eslint/babel-eslint-parser/eslint-tester.js | 6 - eslint/babel-eslint-parser/package.json | 17 +- eslint/babel-eslint-parser/yarn.lock | 283 ++++++++++---------- 5 files changed, 153 insertions(+), 158 deletions(-) delete mode 160000 eslint/babel-eslint-parser/eslint delete mode 100644 eslint/babel-eslint-parser/eslint-tester.js diff --git a/eslint/babel-eslint-parser/.eslintrc.js b/eslint/babel-eslint-parser/.eslintrc.js index 1f91933ff5b4..20f31f1eebd5 100644 --- a/eslint/babel-eslint-parser/.eslintrc.js +++ b/eslint/babel-eslint-parser/.eslintrc.js @@ -1,10 +1,6 @@ module.exports = { root: true, extends: "babel", - parserOptions: { - ecmaVersion: 7, - sourceType: "module" - }, rules: { "no-var": 0, "max-len": 0 diff --git a/eslint/babel-eslint-parser/eslint b/eslint/babel-eslint-parser/eslint deleted file mode 160000 index fdce86d24e30..000000000000 --- a/eslint/babel-eslint-parser/eslint +++ /dev/null @@ -1 +0,0 @@ -Subproject commit fdce86d24e30a31c0c819262b72ab6b454cb552a diff --git a/eslint/babel-eslint-parser/eslint-tester.js b/eslint/babel-eslint-parser/eslint-tester.js deleted file mode 100644 index 905a625d4689..000000000000 --- a/eslint/babel-eslint-parser/eslint-tester.js +++ /dev/null @@ -1,6 +0,0 @@ -var ESLintTester = require("./eslint").RuleTester; - -console.log("Use babel-eslint for test suite"); -ESLintTester.setDefaultConfig({ - parser: "../../index" -}); diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 5c616f90f196..9babfabaa49a 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -12,15 +12,13 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "babel-code-frame": "^6.16.0", - "babel-traverse": "^6.15.0", - "babel-types": "^6.15.0", - "babylon": "^6.13.0", + "babel-code-frame": "^6.22.0", + "babel-traverse": "^6.23.1", + "babel-types": "^6.23.0", + "babylon": "^6.16.1", "lodash.pickby": "^4.6.0" }, "scripts": { - "bootstrap": "git submodule update --init && cd eslint && npm install", - "eslint": "cd eslint && mocha -c tests/lib/rules/*.js -r ../eslint-tester.js", "test": "npm run lint && npm run test-only", "test-only": "mocha", "lint": "eslint index.js babylon-to-espree test", @@ -39,11 +37,10 @@ "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { "babel-eslint": "^7.0.0", - "eslint": "^3.9.1", + "eslint": "^3.18.0", "eslint-config-babel": "^6.0.0", - "eslint-plugin-babel": "^4.0.0", - "eslint-plugin-flowtype": "^2.4.0", - "espree": "^3.3.1", + "eslint-plugin-flowtype": "^2.30.3", + "espree": "^3.4.0", "mocha": "^3.0.0" } } diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index 5cfc9dbadfc0..b17637e81f20 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -8,21 +8,21 @@ acorn-jsx@^3.0.0: dependencies: acorn "^3.0.4" +acorn@4.0.4: + version "4.0.4" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.4.tgz#17a8d6a7a6c4ef538b814ec9abac2779293bf30a" + acorn@^3.0.4: version "3.3.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" -acorn@^4.0.1: - version "4.0.4" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.4.tgz#17a8d6a7a6c4ef538b814ec9abac2779293bf30a" - ajv-keywords@^1.0.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.0.tgz#c11e6859eafff83e0dafc416929472eca946aa2c" + version "1.5.1" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.1.tgz#314dd0a4b3368fad3dfcdc54ede6171b886daf3c" ajv@^4.7.0: - version "4.10.4" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.10.4.tgz#c0974dd00b3464984892d6010aa9c2c945933254" + version "4.11.5" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.5.tgz#b6ee74657b993a01dce44b7944d56f485828d5bd" dependencies: co "^4.6.0" json-stable-stringify "^1.0.1" @@ -59,13 +59,13 @@ arrify@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" -babel-code-frame@^6.16.0, babel-code-frame@^6.20.0: - version "6.20.0" - resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.20.0.tgz#b968f839090f9a8bc6d41938fb96cb84f7387b26" +babel-code-frame@^6.16.0, babel-code-frame@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4" dependencies: chalk "^1.1.0" esutils "^2.0.2" - js-tokens "^2.0.0" + js-tokens "^3.0.0" babel-eslint@^7.0.0: version "7.1.1" @@ -77,45 +77,45 @@ babel-eslint@^7.0.0: babylon "^6.13.0" lodash.pickby "^4.6.0" -babel-messages@^6.8.0: - version "6.8.0" - resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.8.0.tgz#bf504736ca967e6d65ef0adb5a2a5f947c8e0eb9" +babel-messages@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" dependencies: - babel-runtime "^6.0.0" + babel-runtime "^6.22.0" -babel-runtime@^6.0.0, babel-runtime@^6.20.0: - version "6.20.0" - resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.20.0.tgz#87300bdcf4cd770f09bf0048c64204e17806d16f" +babel-runtime@^6.22.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.23.0.tgz#0a9489f144de70efb3ce4300accdb329e2fc543b" dependencies: core-js "^2.4.0" regenerator-runtime "^0.10.0" -babel-traverse@^6.15.0: - version "6.21.0" - resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.21.0.tgz#69c6365804f1a4f69eb1213f85b00a818b8c21ad" +babel-traverse@^6.15.0, babel-traverse@^6.23.1: + version "6.23.1" + resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.23.1.tgz#d3cb59010ecd06a97d81310065f966b699e14f48" dependencies: - babel-code-frame "^6.20.0" - babel-messages "^6.8.0" - babel-runtime "^6.20.0" - babel-types "^6.21.0" - babylon "^6.11.0" + babel-code-frame "^6.22.0" + babel-messages "^6.23.0" + babel-runtime "^6.22.0" + babel-types "^6.23.0" + babylon "^6.15.0" debug "^2.2.0" globals "^9.0.0" invariant "^2.2.0" lodash "^4.2.0" -babel-types@^6.15.0, babel-types@^6.21.0: - version "6.21.0" - resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.21.0.tgz#314b92168891ef6d3806b7f7a917fdf87c11a4b2" +babel-types@^6.15.0, babel-types@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.23.0.tgz#bb17179d7538bad38cd0c9e115d340f77e7e9acf" dependencies: - babel-runtime "^6.20.0" + babel-runtime "^6.22.0" esutils "^2.0.2" lodash "^4.2.0" to-fast-properties "^1.0.1" -babylon@^6.11.0, babylon@^6.13.0: - version "6.15.0" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.15.0.tgz#ba65cfa1a80e1759b0e89fb562e27dccae70348e" +babylon@^6.13.0, babylon@^6.15.0, babylon@^6.16.1: + version "6.16.1" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.16.1.tgz#30c5a22f481978a9e7f8cdfdf496b11d94b404d3" balanced-match@^0.4.1: version "0.4.2" @@ -188,7 +188,7 @@ concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" -concat-stream@^1.4.6: +concat-stream@^1.5.2: version "1.6.0" resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" dependencies: @@ -204,11 +204,11 @@ core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" -d@^0.1.1, d@~0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/d/-/d-0.1.1.tgz#da184c535d18d8ee7ba2aa229b914009fae11309" +d@1: + version "1.0.0" + resolved "https://registry.yarnpkg.com/d/-/d-1.0.0.tgz#754bb5bfe55451da69a58b94d45f4c5b0462d58f" dependencies: - es5-ext "~0.10.2" + es5-ext "^0.10.9" debug@2.2.0: version "2.2.0" @@ -217,8 +217,8 @@ debug@2.2.0: ms "0.7.1" debug@^2.1.1, debug@^2.2.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.0.tgz#bc596bcabe7617f11d9fa15361eded5608b8499b" + version "2.6.3" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.3.tgz#0f7eb8c30965ec08c72accfa0130c8b79984141d" dependencies: ms "0.7.2" @@ -242,64 +242,64 @@ diff@1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/diff/-/diff-1.4.0.tgz#7f28d2eb9ee7b15a97efd89ce63dcfdaa3ccbabf" -doctrine@^1.2.2: - version "1.5.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" +doctrine@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.0.0.tgz#c73d8d2909d22291e1a007a395804da8b665fe63" dependencies: esutils "^2.0.2" isarray "^1.0.0" -es5-ext@^0.10.7, es5-ext@^0.10.8, es5-ext@~0.10.11, es5-ext@~0.10.2, es5-ext@~0.10.7: - version "0.10.12" - resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.12.tgz#aa84641d4db76b62abba5e45fd805ecbab140047" +es5-ext@^0.10.14, es5-ext@^0.10.9, es5-ext@~0.10.14: + version "0.10.14" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.14.tgz#625bc9ab9cac0f6fb9dc271525823d1800b3d360" dependencies: es6-iterator "2" es6-symbol "~3.1" -es6-iterator@2: - version "2.0.0" - resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.0.tgz#bd968567d61635e33c0b80727613c9cb4b096bac" +es6-iterator@2, es6-iterator@^2.0.1, es6-iterator@~2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.1.tgz#8e319c9f0453bf575d374940a655920e59ca5512" dependencies: - d "^0.1.1" - es5-ext "^0.10.7" - es6-symbol "3" + d "1" + es5-ext "^0.10.14" + es6-symbol "^3.1" es6-map@^0.1.3: - version "0.1.4" - resolved "https://registry.yarnpkg.com/es6-map/-/es6-map-0.1.4.tgz#a34b147be224773a4d7da8072794cefa3632b897" - dependencies: - d "~0.1.1" - es5-ext "~0.10.11" - es6-iterator "2" - es6-set "~0.1.3" - es6-symbol "~3.1.0" - event-emitter "~0.3.4" - -es6-set@~0.1.3: - version "0.1.4" - resolved "https://registry.yarnpkg.com/es6-set/-/es6-set-0.1.4.tgz#9516b6761c2964b92ff479456233a247dc707ce8" - dependencies: - d "~0.1.1" - es5-ext "~0.10.11" - es6-iterator "2" - es6-symbol "3" - event-emitter "~0.3.4" - -es6-symbol@3, es6-symbol@~3.1, es6-symbol@~3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.0.tgz#94481c655e7a7cad82eba832d97d5433496d7ffa" + version "0.1.5" + resolved "https://registry.yarnpkg.com/es6-map/-/es6-map-0.1.5.tgz#9136e0503dcc06a301690f0bb14ff4e364e949f0" + dependencies: + d "1" + es5-ext "~0.10.14" + es6-iterator "~2.0.1" + es6-set "~0.1.5" + es6-symbol "~3.1.1" + event-emitter "~0.3.5" + +es6-set@~0.1.5: + version "0.1.5" + resolved "https://registry.yarnpkg.com/es6-set/-/es6-set-0.1.5.tgz#d2b3ec5d4d800ced818db538d28974db0a73ccb1" + dependencies: + d "1" + es5-ext "~0.10.14" + es6-iterator "~2.0.1" + es6-symbol "3.1.1" + event-emitter "~0.3.5" + +es6-symbol@3.1.1, es6-symbol@^3.1, es6-symbol@^3.1.1, es6-symbol@~3.1, es6-symbol@~3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77" dependencies: - d "~0.1.1" - es5-ext "~0.10.11" + d "1" + es5-ext "~0.10.14" es6-weak-map@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.1.tgz#0d2bbd8827eb5fb4ba8f97fbfea50d43db21ea81" + version "2.0.2" + resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.2.tgz#5e3ab32251ffd1538a1f8e5ffa1357772f92d96f" dependencies: - d "^0.1.1" - es5-ext "^0.10.8" - es6-iterator "2" - es6-symbol "3" + d "1" + es5-ext "^0.10.14" + es6-iterator "^2.0.1" + es6-symbol "^3.1.1" escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" @@ -318,27 +318,24 @@ eslint-config-babel@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/eslint-config-babel/-/eslint-config-babel-6.0.0.tgz#66feedf6ce6e04abe585cec1a65b5bcc96bed50a" -eslint-plugin-babel@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-babel/-/eslint-plugin-babel-4.0.0.tgz#a92114e2c493ac3034b030d7ecf96e174a76ef3f" - -eslint-plugin-flowtype@^2.4.0: - version "2.29.2" - resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.29.2.tgz#91b4fde0400c4c37ca4440b43bdbc95fc405bea9" +eslint-plugin-flowtype@^2.30.3: + version "2.30.3" + resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.30.3.tgz#57835d2c0ed388da7a2725803ec32af2f437c301" dependencies: lodash "^4.15.0" -eslint@^3.9.1: - version "3.13.1" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.13.1.tgz#564d2646b5efded85df96985332edd91a23bff25" +eslint@^3.18.0: + version "3.18.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.18.0.tgz#647e985c4ae71502d20ac62c109f66d5104c8a4b" dependencies: babel-code-frame "^6.16.0" chalk "^1.1.3" - concat-stream "^1.4.6" + concat-stream "^1.5.2" debug "^2.1.1" - doctrine "^1.2.2" + doctrine "^2.0.0" escope "^3.6.0" - espree "^3.3.1" + espree "^3.4.0" + esquery "^1.0.0" estraverse "^4.2.0" esutils "^2.0.2" file-entry-cache "^2.0.0" @@ -367,16 +364,22 @@ eslint@^3.9.1: text-table "~0.2.0" user-home "^2.0.0" -espree@^3.3.1: - version "3.3.2" - resolved "https://registry.yarnpkg.com/espree/-/espree-3.3.2.tgz#dbf3fadeb4ecb4d4778303e50103b3d36c88b89c" +espree@^3.4.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.4.0.tgz#41656fa5628e042878025ef467e78f125cb86e1d" dependencies: - acorn "^4.0.1" + acorn "4.0.4" acorn-jsx "^3.0.0" -esprima@^2.6.0: - version "2.7.3" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581" +esprima@^3.1.1: + version "3.1.3" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" + +esquery@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.0.tgz#cfba8b57d7fba93f17298a8a006a04cda13d80fa" + dependencies: + estraverse "^4.0.0" esrecurse@^4.1.0: version "4.1.0" @@ -385,7 +388,7 @@ esrecurse@^4.1.0: estraverse "~4.1.0" object-assign "^4.0.1" -estraverse@^4.1.1, estraverse@^4.2.0: +estraverse@^4.0.0, estraverse@^4.1.1, estraverse@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" @@ -397,12 +400,12 @@ esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" -event-emitter@~0.3.4: - version "0.3.4" - resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.4.tgz#8d63ddfb4cfe1fae3b32ca265c4c720222080bb5" +event-emitter@~0.3.5: + version "0.3.5" + resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39" dependencies: - d "~0.1.1" - es5-ext "~0.10.7" + d "1" + es5-ext "~0.10.14" exit-hook@^1.0.0: version "1.1.1" @@ -472,8 +475,8 @@ glob@^7.0.0, glob@^7.0.3, glob@^7.0.5: path-is-absolute "^1.0.0" globals@^9.0.0, globals@^9.14.0: - version "9.14.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-9.14.0.tgz#8859936af0038741263053b39d0e76ca241e4034" + version "9.16.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-9.16.0.tgz#63e903658171ec2d9f51b1d31de5e2b8dc01fb80" globby@^5.0.0: version "5.0.0" @@ -509,8 +512,8 @@ has-flag@^1.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" ignore@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.2.0.tgz#8d88f03c3002a0ac52114db25d2c673b0bf1e435" + version "3.2.6" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.2.6.tgz#26e8da0644be0bb4cb39516f6c79f0e0f4ffe48c" imurmurhash@^0.1.4: version "0.1.4" @@ -566,8 +569,8 @@ is-fullwidth-code-point@^2.0.0: resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" is-my-json-valid@^2.10.0: - version "2.15.0" - resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.15.0.tgz#936edda3ca3c211fd98f3b2d3e08da43f7b2915b" + version "2.16.0" + resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.16.0.tgz#f079dd9bfdae65ee2038aae8acbc86ab109e3693" dependencies: generate-function "^2.0.0" generate-object-property "^1.1.0" @@ -604,16 +607,16 @@ isarray@^1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" -js-tokens@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-2.0.0.tgz#79903f5563ee778cc1162e6dcf1a0027c97f9cb5" +js-tokens@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7" js-yaml@^3.5.1: - version "3.7.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.7.0.tgz#5c967ddd837a9bfdca5f2de84253abe8a1c03b80" + version "3.8.2" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.8.2.tgz#02d3e2c0f6beab20248d412c352203827d786721" dependencies: argparse "^1.0.7" - esprima "^2.6.0" + esprima "^3.1.1" json-stable-stringify@^1.0.0, json-stable-stringify@^1.0.1: version "1.0.1" @@ -696,10 +699,10 @@ lodash@^4.0.0, lodash@^4.15.0, lodash@^4.2.0, lodash@^4.3.0: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" loose-envify@^1.0.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.0.tgz#6b26248c42f6d4fa4b0d8542f78edfcde35642a8" + version "1.3.1" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" dependencies: - js-tokens "^2.0.0" + js-tokens "^3.0.0" minimatch@^3.0.2: version "3.0.3" @@ -754,8 +757,8 @@ number-is-nan@^1.0.0: resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" object-assign@^4.0.1, object-assign@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.0.tgz#7a3b3d0e98063d43f4c03f2e8ae6cd51a86883a0" + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" once@^1.3.0: version "1.4.0" @@ -790,6 +793,10 @@ path-is-inside@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" +path-parse@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" + pify@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" @@ -821,8 +828,8 @@ progress@^1.1.8: resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be" readable-stream@^2.2.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.2.tgz#a9e6fec3c7dda85f8bb1b3ba7028604556fc825e" + version "2.2.6" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.6.tgz#8b43aed76e71483938d12a8d46c6cf1a00b1f816" dependencies: buffer-shims "^1.0.0" core-util-is "~1.0.0" @@ -847,8 +854,8 @@ rechoir@^0.6.2: resolve "^1.1.6" regenerator-runtime@^0.10.0: - version "0.10.1" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.1.tgz#257f41961ce44558b18f7814af48c17559f9faeb" + version "0.10.3" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.3.tgz#8c4367a904b51ea62a908ac310bf99ff90a82a3e" require-uncached@^1.0.2: version "1.0.3" @@ -862,8 +869,10 @@ resolve-from@^1.0.0: resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" resolve@^1.1.6: - version "1.2.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.2.0.tgz#9589c3f2f6149d1417a40becc1663db6ec6bc26c" + version "1.3.2" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.3.2.tgz#1f0442c9e0cbb8136e87b9305f932f46c7f28235" + dependencies: + path-parse "^1.0.5" restore-cursor@^1.0.1: version "1.0.1" @@ -873,8 +882,8 @@ restore-cursor@^1.0.1: onetime "^1.0.0" rimraf@^2.2.8: - version "2.5.4" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.5.4.tgz#96800093cbf1a0c86bd95b4625467535c29dfa04" + version "2.6.1" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d" dependencies: glob "^7.0.5" @@ -889,8 +898,8 @@ rx-lite@^3.1.2: resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102" shelljs@^0.7.5: - version "0.7.6" - resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.6.tgz#379cccfb56b91c8601e4793356eb5382924de9ad" + version "0.7.7" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.7.tgz#b2f5c77ef97148f4b4f6e22682e10bba8667cff1" dependencies: glob "^7.0.0" interpret "^1.0.0" From 2bee348c9afe9bda68d2b96a76b9b59d7a8e9533 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Couto?= Date: Mon, 20 Mar 2017 21:45:11 +0000 Subject: [PATCH 344/569] Add option to disable code frame. (babel/babel-eslint#446) * Add option to disable code hightlight. * Rename codeHighlight with codeFrame * Add codeFrame tests * Remove colors from test assertions --- eslint/babel-eslint-parser/index.js | 19 +++++--- .../test/fixtures/rules/syntax-error.js | 6 +++ .../babel-eslint-parser/test/integration.js | 48 +++++++++++++++++++ 3 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 eslint/babel-eslint-parser/test/fixtures/rules/syntax-error.js diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 7b742494589b..22e791b371c3 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -366,6 +366,7 @@ exports.parse = function (code, options) { exports.parseNoPatch = function (code, options) { var opts = { + codeFrame: options.hasOwnProperty("codeFrame") ? options.codeFrame : true, sourceType: options.sourceType, allowImportExportEverywhere: options.allowImportExportEverywhere, // consistent with espree allowReturnOutsideFunction: true, @@ -394,14 +395,20 @@ exports.parseNoPatch = function (code, options) { ast = parse(code, opts); } catch (err) { if (err instanceof SyntaxError) { + err.lineNumber = err.loc.line; - err.column = err.loc.column + 1; + err.column = err.loc.column; + + if (opts.codeFrame) { + err.lineNumber = err.loc.line; + err.column = err.loc.column + 1; - // remove trailing "(LINE:COLUMN)" acorn message and add in esprima syntax error message start - err.message = "Line " + err.lineNumber + ": " + err.message.replace(/ \((\d+):(\d+)\)$/, "") + - // add codeframe - "\n\n" + - codeFrame(code, err.lineNumber, err.column, { highlightCode: true }); + // remove trailing "(LINE:COLUMN)" acorn message and add in esprima syntax error message start + err.message = "Line " + err.lineNumber + ": " + err.message.replace(/ \((\d+):(\d+)\)$/, "") + + // add codeframe + "\n\n" + + codeFrame(code, err.lineNumber, err.column, { highlightCode: true }); + } } throw err; diff --git a/eslint/babel-eslint-parser/test/fixtures/rules/syntax-error.js b/eslint/babel-eslint-parser/test/fixtures/rules/syntax-error.js new file mode 100644 index 000000000000..6fa194a18f9e --- /dev/null +++ b/eslint/babel-eslint-parser/test/fixtures/rules/syntax-error.js @@ -0,0 +1,6 @@ +class ClassName { + constructor() { + + }, + aMethod() {} +} diff --git a/eslint/babel-eslint-parser/test/integration.js b/eslint/babel-eslint-parser/test/integration.js index 2814b4c35736..c446ed342815 100644 --- a/eslint/babel-eslint-parser/test/integration.js +++ b/eslint/babel-eslint-parser/test/integration.js @@ -200,4 +200,52 @@ function strictSuite () { // it }); // describe + describe("When \"codeFrame\"", () => { + // Strip chalk colors, these are not relevant for the test + const stripAnsi = (str) => str.replace( + /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, + "" + ); + + it("should display codeFrame when option is absent", (done) => { + lint({ + fixture: ["syntax-error"], + eslint: baseEslintOpts + }, (err, report) => { + if (err) return done(err); + assert(stripAnsi(report[0].message).indexOf("^\n 5 |") > -1); + done(); + }); + }); + + it("should display codeFrame when option is true", (done) => { + lint({ + fixture: ["syntax-error"], + eslint: Object.assign({}, baseEslintOpts, { + parserOptions: { + codeFrame: true + } + }) + }, (err, report) => { + if (err) return done(err); + assert(stripAnsi(report[0].message).indexOf("^\n 5 |") > -1); + done(); + }); + }); + + it("should not display codeFrame when option is false", (done) => { + lint({ + fixture: ["syntax-error"], + eslint: Object.assign({}, baseEslintOpts, { + parserOptions: { + codeFrame: false + } + }) + }, (err, report) => { + if (err) return done(err); + assert(stripAnsi(report[0].message).indexOf("^\n 5 |") === -1); + done(); + }); + }); + }); } From 65413344bdf412ea62c4b77c9103f3d69266db12 Mon Sep 17 00:00:00 2001 From: Alex Rattray Date: Mon, 20 Mar 2017 14:46:07 -0700 Subject: [PATCH 345/569] [flow] Process polymorphic type bounds on functions (babel/babel-eslint#444) --- eslint/babel-eslint-parser/index.js | 13 +++++++++++++ eslint/babel-eslint-parser/test/non-regression.js | 6 +++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 22e791b371c3..3bb83811cbac 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -176,6 +176,18 @@ function monkeypatch() { } } + function visitTypeParameters(typeParameters) { + var params = typeParameters.params; + + // visit bounds on polymorphpic types, eg; `Foo` in `fn(a: T): T` + for (var i = 0; i < params.length; i++) { + var param = params[i]; + if (param.typeAnnotation) { + visitTypeAnnotation.call(this, param.typeAnnotation); + } + } + } + function checkIdentifierOrVisit(node) { if (node.typeAnnotation) { visitTypeAnnotation.call(this, node.typeAnnotation); @@ -249,6 +261,7 @@ function monkeypatch() { var typeParamScope; if (node.typeParameters) { typeParamScope = nestTypeParamScope(this.scopeManager, node); + visitTypeParameters.call(this, node.typeParameters); } if (node.returnType) { checkIdentifierOrVisit.call(this, node.returnType); diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index ee8c03a98740..395a6de5fec5 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -222,13 +222,13 @@ describe("verify", () => { ); }); - it("type parameters", () => { + it("type parameter bounds", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; import type Foo2 from 'foo'; - function log(a: T1, b: T2) { return a + b; } - log(1, 2); + function log(a: T1, b: T2) { return a + b; } + log(1, 2); `), { "no-unused-vars": 1, "no-undef": 1 }, [] From d3c40a1851bc9d679e5becb4643036402f407d4a Mon Sep 17 00:00:00 2001 From: wtgtybhertgeghgtwtg Date: Mon, 20 Mar 2017 14:50:09 -0700 Subject: [PATCH 346/569] Use `lodash` instead of `lodash.pickby`. (babel/babel-eslint#435) --- eslint/babel-eslint-parser/index.js | 2 +- eslint/babel-eslint-parser/package.json | 2 +- eslint/babel-eslint-parser/yarn.lock | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 3bb83811cbac..fea9d054c0c4 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -1,5 +1,5 @@ var babylonToEspree = require("./babylon-to-espree"); -var pick = require("lodash.pickby"); +var pick = require("lodash").pickBy; var Module = require("module"); var path = require("path"); var parse = require("babylon").parse; diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 9babfabaa49a..5996554d2c02 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -16,7 +16,7 @@ "babel-traverse": "^6.23.1", "babel-types": "^6.23.0", "babylon": "^6.16.1", - "lodash.pickby": "^4.6.0" + "lodash": "^4.17.4" }, "scripts": { "test": "npm run lint && npm run test-only", diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index b17637e81f20..9cb3a50a074e 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -250,8 +250,8 @@ doctrine@^2.0.0: isarray "^1.0.0" es5-ext@^0.10.14, es5-ext@^0.10.9, es5-ext@~0.10.14: - version "0.10.14" - resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.14.tgz#625bc9ab9cac0f6fb9dc271525823d1800b3d360" + version "0.10.15" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.15.tgz#c330a5934c1ee21284a7c081a86e5fd937c91ea6" dependencies: es6-iterator "2" es6-symbol "~3.1" @@ -694,7 +694,7 @@ lodash.pickby@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/lodash.pickby/-/lodash.pickby-4.6.0.tgz#7dea21d8c18d7703a27c704c15d3b84a67e33aff" -lodash@^4.0.0, lodash@^4.15.0, lodash@^4.2.0, lodash@^4.3.0: +lodash@^4.0.0, lodash@^4.15.0, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" From f9b19189d78a9ac65dfff6c4a79b6264309a7551 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 20 Mar 2017 17:53:26 -0400 Subject: [PATCH 347/569] 7.2.0 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 5996554d2c02..5909e7f994d4 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "7.1.1", + "version": "7.2.0", "description": "Custom parser for ESLint", "main": "index.js", "files": [ From 1cda9b6a802f0137f7b4b06c5336f3ba9d58d2d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Couto?= Date: Tue, 21 Mar 2017 00:11:30 +0000 Subject: [PATCH 348/569] Update README.md with codeFrame option (babel/babel-eslint#448) --- eslint/babel-eslint-parser/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index ff6e41a5fb6a..fc5a54035fee 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -78,6 +78,7 @@ Check out the [ESLint docs](http://eslint.org/docs/rules/) for all possible rule `sourceType` can be set to `'module'`(default) or `'script'` if your code isn't using ECMAScript modules. `allowImportExportEverywhere` can be set to true to allow import and export declarations to appear anywhere a statement is allowed if your build environment supports that. By default, import and export declarations can only appear at a program's top level. +`codeFrame` can be set to false to disable the code frame in the reporter. This is useful since some eslint formatters don't play well with it. **.eslintrc** @@ -86,7 +87,8 @@ Check out the [ESLint docs](http://eslint.org/docs/rules/) for all possible rule "parser": "babel-eslint", "parserOptions": { "sourceType": "module", - "allowImportExportEverywhere": false + "allowImportExportEverywhere": false, + "codeFrame": false } } ``` From 371488c1028e8f02ebe0c9dffc83f9f9a9366113 Mon Sep 17 00:00:00 2001 From: Andres Suarez Date: Wed, 22 Mar 2017 22:34:13 -0400 Subject: [PATCH 349/569] Format non-regression errors for legibility (babel/babel-eslint#451) --- eslint/babel-eslint-parser/test/non-regression.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 395a6de5fec5..ba83722a39bd 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -31,7 +31,7 @@ function verifyAndAssertMessages(code, rules, expectedMessages, sourceType, over var messages = eslint.linter.verify(code, config); if (messages.length !== expectedMessages.length) { - throw new Error(`Expected ${expectedMessages.length} message(s), got ${messages.length} ${JSON.stringify(messages)}`); + throw new Error(`Expected ${expectedMessages.length} message(s), got ${messages.length}\n${JSON.stringify(messages, null, 2)}`); } messages.forEach((message, i) => { From 700f62e28e8e3d2cdae49b4f1dc956e806a79306 Mon Sep 17 00:00:00 2001 From: Andres Suarez Date: Wed, 22 Mar 2017 22:35:31 -0400 Subject: [PATCH 350/569] Remove lodash dependency (babel/babel-eslint#450) --- eslint/babel-eslint-parser/index.js | 30 ++++++++++++++----------- eslint/babel-eslint-parser/package.json | 3 +-- eslint/babel-eslint-parser/yarn.lock | 2 +- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index fea9d054c0c4..39b6142a4e8b 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -1,5 +1,4 @@ var babylonToEspree = require("./babylon-to-espree"); -var pick = require("lodash").pickBy; var Module = require("module"); var path = require("path"); var parse = require("babylon").parse; @@ -100,18 +99,23 @@ function monkeypatch() { } // iterate through part of t.VISITOR_KEYS - var visitorKeysMap = pick(t.VISITOR_KEYS, (k) => { - return t.FLIPPED_ALIAS_KEYS.Flow.concat([ - "ArrayPattern", - "ClassDeclaration", - "ClassExpression", - "FunctionDeclaration", - "FunctionExpression", - "Identifier", - "ObjectPattern", - "RestElement" - ]).indexOf(k) === -1; - }); + var flowFlippedAliasKeys = t.FLIPPED_ALIAS_KEYS.Flow.concat([ + "ArrayPattern", + "ClassDeclaration", + "ClassExpression", + "FunctionDeclaration", + "FunctionExpression", + "Identifier", + "ObjectPattern", + "RestElement" + ]); + var visitorKeysMap = Object.keys(t.VISITOR_KEYS).reduce(function(acc, key) { + var value = t.VISITOR_KEYS[key]; + if (flowFlippedAliasKeys.indexOf(value) === -1) { + acc[key] = value; + } + return acc; + }, {}); var propertyTypes = { // loops diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 5909e7f994d4..64fff599ac9d 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -15,8 +15,7 @@ "babel-code-frame": "^6.22.0", "babel-traverse": "^6.23.1", "babel-types": "^6.23.0", - "babylon": "^6.16.1", - "lodash": "^4.17.4" + "babylon": "^6.16.1" }, "scripts": { "test": "npm run lint && npm run test-only", diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index 9cb3a50a074e..afb72f464ba9 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -694,7 +694,7 @@ lodash.pickby@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/lodash.pickby/-/lodash.pickby-4.6.0.tgz#7dea21d8c18d7703a27c704c15d3b84a67e33aff" -lodash@^4.0.0, lodash@^4.15.0, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0: +lodash@^4.0.0, lodash@^4.15.0, lodash@^4.2.0, lodash@^4.3.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" From 1c5400a67097a2aa38cac1169762a073a887df2f Mon Sep 17 00:00:00 2001 From: Andres Suarez Date: Thu, 23 Mar 2017 12:49:19 -0400 Subject: [PATCH 351/569] Fix type param and interface declaration scoping (babel/babel-eslint#449) --- eslint/babel-eslint-parser/index.js | 40 +++++++----- .../test/non-regression.js | 63 ++++++++++++++++++- 2 files changed, 83 insertions(+), 20 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 39b6142a4e8b..8d05f794a4bb 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -180,18 +180,6 @@ function monkeypatch() { } } - function visitTypeParameters(typeParameters) { - var params = typeParameters.params; - - // visit bounds on polymorphpic types, eg; `Foo` in `fn(a: T): T` - for (var i = 0; i < params.length; i++) { - var param = params[i]; - if (param.typeAnnotation) { - visitTypeAnnotation.call(this, param.typeAnnotation); - } - } - } - function checkIdentifierOrVisit(node) { if (node.typeAnnotation) { visitTypeAnnotation.call(this, node.typeAnnotation); @@ -209,6 +197,9 @@ function monkeypatch() { for (var j = 0; j < node.typeParameters.params.length; j++) { var name = node.typeParameters.params[j]; scope.__define(name, new Definition("TypeParameter", name, name)); + if (name.typeAnnotation) { + checkIdentifierOrVisit.call(this, name); + } } scope.__define = function() { return parentScope.__define.apply(parentScope, arguments); @@ -222,7 +213,7 @@ function monkeypatch() { visitDecorators.call(this, node); var typeParamScope; if (node.typeParameters) { - typeParamScope = nestTypeParamScope(this.scopeManager, node); + typeParamScope = nestTypeParamScope.call(this, this.scopeManager, node); } // visit flow type: ClassImplements if (node.implements) { @@ -264,8 +255,7 @@ function monkeypatch() { referencer.prototype.visitFunction = function(node) { var typeParamScope; if (node.typeParameters) { - typeParamScope = nestTypeParamScope(this.scopeManager, node); - visitTypeParameters.call(this, node.typeParameters); + typeParamScope = nestTypeParamScope.call(this, this.scopeManager, node); } if (node.returnType) { checkIdentifierOrVisit.call(this, node.returnType); @@ -328,11 +318,27 @@ function monkeypatch() { ); } + referencer.prototype.InterfaceDeclaration = function(node) { + createScopeVariable.call(this, node, node.id); + var typeParamScope; + if (node.typeParameters) { + typeParamScope = nestTypeParamScope.call(this, this.scopeManager, node); + } + // TODO: Handle mixins + for (var i = 0; i < node.extends.length; i++) { + visitTypeAnnotation.call(this, node.extends[i]); + } + visitTypeAnnotation.call(this, node.body); + if (typeParamScope) { + this.close(node); + } + }; + referencer.prototype.TypeAlias = function(node) { createScopeVariable.call(this, node, node.id); var typeParamScope; if (node.typeParameters) { - typeParamScope = nestTypeParamScope(this.scopeManager, node); + typeParamScope = nestTypeParamScope.call(this, this.scopeManager, node); } if (node.right) { visitTypeAnnotation.call(this, node.right); @@ -352,7 +358,7 @@ function monkeypatch() { var typeParamScope; if (node.typeParameters) { - typeParamScope = nestTypeParamScope(this.scopeManager, node); + typeParamScope = nestTypeParamScope.call(this, this.scopeManager, node); } if (typeParamScope) { this.close(node); diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index ba83722a39bd..107802ce508a 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -222,16 +222,73 @@ describe("verify", () => { ); }); - it("type parameter bounds", () => { + it("interface declaration", () => { + verifyAndAssertMessages( + unpad(` + interface Foo {}; + interface Bar { + foo: Foo, + }; + `), + { "no-unused-vars": 1, "no-undef": 1 }, + [ "2:11 'Bar' is defined but never used. no-unused-vars" ] + ); + }); + + it("type parameter bounds (classes)", () => { + verifyAndAssertMessages( + unpad(` + import type {Foo, Foo2} from 'foo'; + import Base from 'base'; + class Log extends Base { + messages: {[T1]: T2}; + } + new Log(); + `), + { "no-unused-vars": 1, "no-undef": 1 }, + [ "3:34 'T4' is defined but never used. no-unused-vars" ] + ); + }); + + it("type parameter bounds (interfaces)", () => { + verifyAndAssertMessages( + unpad(` + import type {Foo, Foo2, Bar} from ''; + interface Log extends Bar { + messages: {[T1]: T2}; + } + `), + { "no-unused-vars": 1, "no-undef": 1 }, + [ "2:11 'Log' is defined but never used. no-unused-vars", + "2:38 'T4' is defined but never used. no-unused-vars" ] + ); + }); + + it("type parameter bounds (type aliases)", () => { + verifyAndAssertMessages( + unpad(` + import type {Foo, Foo2, Foo3} from 'foo'; + type Log = { + messages: {[T1]: T2}; + delay: Foo3; + }; + `), + { "no-unused-vars": 1, "no-undef": 1 }, + [ "2:6 'Log' is defined but never used. no-unused-vars", + "2:29 'T3' is defined but never used. no-unused-vars" ] + ); + }); + + it("type parameter bounds (functions)", () => { verifyAndAssertMessages( unpad(` import type Foo from 'foo'; import type Foo2 from 'foo'; - function log(a: T1, b: T2) { return a + b; } + function log(a: T1, b: T2): T3 { return a + b; } log(1, 2); `), { "no-unused-vars": 1, "no-undef": 1 }, - [] + [ "3:37 'T4' is defined but never used. no-unused-vars" ] ); }); From 26daac869032b3dd6f8b4c088a8f62e72d33a3f4 Mon Sep 17 00:00:00 2001 From: Andres Suarez Date: Thu, 23 Mar 2017 14:02:24 -0400 Subject: [PATCH 352/569] Remove left over eslint 2 estraverse code (babel/babel-eslint#452) This was missed in babel/babel-eslint#361 --- eslint/babel-eslint-parser/index.js | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 8d05f794a4bb..3b243cc81cd2 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -36,17 +36,12 @@ function monkeypatch() { // get modules relative to what eslint will load var eslintMod = createModule(eslintLoc); - // contains all the instances of estraverse so we can modify them if necessary - var estraverses = []; // ESLint v1.9.0 uses estraverse directly to work around https://github.com/npm/npm/issues/9663 - var estraverseOfEslint = eslintMod.require("estraverse"); - estraverses.push(estraverseOfEslint); - Object.assign(estraverseOfEslint.VisitorKeys, t.VISITOR_KEYS); + var estraverse = eslintMod.require("estraverse"); - estraverses.forEach((estraverse) => { - estraverse.VisitorKeys.MethodDefinition.push("decorators"); - estraverse.VisitorKeys.Property.push("decorators"); - }); + Object.assign(estraverse.VisitorKeys, t.VISITOR_KEYS); + estraverse.VisitorKeys.MethodDefinition.push("decorators"); + estraverse.VisitorKeys.Property.push("decorators"); // monkeypatch escope var escopeLoc = Module._resolveFilename("escope", eslintMod); @@ -275,16 +270,12 @@ function monkeypatch() { } // set ArrayPattern/ObjectPattern visitor keys back to their original. otherwise // escope will traverse into them and include the identifiers within as declarations - estraverses.forEach((estraverse) => { - estraverse.VisitorKeys.ObjectPattern = ["properties"]; - estraverse.VisitorKeys.ArrayPattern = ["elements"]; - }); + estraverse.VisitorKeys.ObjectPattern = ["properties"]; + estraverse.VisitorKeys.ArrayPattern = ["elements"]; visitFunction.call(this, node); // set them back to normal... - estraverses.forEach((estraverse) => { - estraverse.VisitorKeys.ObjectPattern = t.VISITOR_KEYS.ObjectPattern; - estraverse.VisitorKeys.ArrayPattern = t.VISITOR_KEYS.ArrayPattern; - }); + estraverse.VisitorKeys.ObjectPattern = t.VISITOR_KEYS.ObjectPattern; + estraverse.VisitorKeys.ArrayPattern = t.VISITOR_KEYS.ArrayPattern; if (typeParamScope) { this.close(node); } From e8b91f88629fb4cdbf706b3e362431e61cb9a88b Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 23 Mar 2017 14:03:23 -0400 Subject: [PATCH 353/569] 7.2.1 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 64fff599ac9d..4b3acc0a53e1 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "7.2.0", + "version": "7.2.1", "description": "Custom parser for ESLint", "main": "index.js", "files": [ From 2ca65d5451afcefac451b68e58ff1e898c428c55 Mon Sep 17 00:00:00 2001 From: Andres Suarez Date: Thu, 23 Mar 2017 15:46:48 -0400 Subject: [PATCH 354/569] Add type parameter scope tests (babel/babel-eslint#454) --- .../test/non-regression.js | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 107802ce508a..711aa25edd82 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -250,6 +250,21 @@ describe("verify", () => { ); }); + it("type parameter scope (classes)", () => { + verifyAndAssertMessages( + unpad(` + T; + class Foo {} + T; + new Foo(); + `), + { "no-unused-vars": 1, "no-undef": 1 }, + [ "1:1 'T' is not defined. no-undef", + "2:11 'T' is defined but never used. no-unused-vars", + "3:1 'T' is not defined. no-undef" ] + ); + }); + it("type parameter bounds (interfaces)", () => { verifyAndAssertMessages( unpad(` @@ -264,6 +279,21 @@ describe("verify", () => { ); }); + it("type parameter scope (interfaces)", () => { + verifyAndAssertMessages( + unpad(` + T; + interface Foo {}; + T; + Foo; + `), + { "no-unused-vars": 1, "no-undef": 1 }, + [ "1:1 'T' is not defined. no-undef", + "2:15 'T' is defined but never used. no-unused-vars", + "3:1 'T' is not defined. no-undef" ] + ); + }); + it("type parameter bounds (type aliases)", () => { verifyAndAssertMessages( unpad(` @@ -279,6 +309,21 @@ describe("verify", () => { ); }); + it("type parameter scope (type aliases)", () => { + verifyAndAssertMessages( + unpad(` + T; + type Foo = {}; + T; + Foo; + `), + { "no-unused-vars": 1, "no-undef": 1 }, + [ "1:1 'T' is not defined. no-undef", + "2:10 'T' is defined but never used. no-unused-vars", + "3:1 'T' is not defined. no-undef" ] + ); + }); + it("type parameter bounds (functions)", () => { verifyAndAssertMessages( unpad(` @@ -292,6 +337,21 @@ describe("verify", () => { ); }); + it("type parameter scope (functions)", () => { + verifyAndAssertMessages( + unpad(` + T; + function log() {} + T; + log; + `), + { "no-unused-vars": 1, "no-undef": 1 }, + [ "1:1 'T' is not defined. no-undef", + "2:14 'T' is defined but never used. no-unused-vars", + "3:1 'T' is not defined. no-undef" ] + ); + }); + it("nested type annotations", () => { verifyAndAssertMessages( unpad(` From 711c1e2f4b9c437a57a832894cb4f2d07cfc5a70 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 25 Mar 2017 19:15:23 -0400 Subject: [PATCH 355/569] Merge pull request babel/babel-eslint#455 from babel/babylon-to-espree-tidy Tidy up babylon-to-espree --- .../babylon-to-espree/attachComments.js | 2 + .../babylon-to-espree/convertComments.js | 17 ++++ .../babylon-to-espree/convertTemplateType.js | 2 + .../babylon-to-espree/index.js | 54 +++++++---- .../babylon-to-espree/toAST.js | 92 ++++++++----------- .../babylon-to-espree/toToken.js | 2 + .../babylon-to-espree/toTokens.js | 13 ++- eslint/babel-eslint-parser/index.js | 28 +----- 8 files changed, 103 insertions(+), 107 deletions(-) create mode 100644 eslint/babel-eslint-parser/babylon-to-espree/convertComments.js diff --git a/eslint/babel-eslint-parser/babylon-to-espree/attachComments.js b/eslint/babel-eslint-parser/babylon-to-espree/attachComments.js index 4040ce7e4e0b..9fc9f339c2b5 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/attachComments.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/attachComments.js @@ -1,3 +1,5 @@ +"use strict"; + // comment fixes module.exports = function (ast, comments, tokens) { if (comments.length) { diff --git a/eslint/babel-eslint-parser/babylon-to-espree/convertComments.js b/eslint/babel-eslint-parser/babylon-to-espree/convertComments.js new file mode 100644 index 000000000000..19c6ce8c97c7 --- /dev/null +++ b/eslint/babel-eslint-parser/babylon-to-espree/convertComments.js @@ -0,0 +1,17 @@ +"use strict"; + +module.exports = function (comments) { + for (var i = 0; i < comments.length; i++) { + var comment = comments[i]; + if (comment.type === "CommentBlock") { + comment.type = "Block"; + } else if (comment.type === "CommentLine") { + comment.type = "Line"; + } + // sometimes comments don't get ranges computed, + // even with options.ranges === true + if (!comment.range) { + comment.range = [comment.start, comment.end]; + } + } +}; diff --git a/eslint/babel-eslint-parser/babylon-to-espree/convertTemplateType.js b/eslint/babel-eslint-parser/babylon-to-espree/convertTemplateType.js index c9537ddde0e9..8b647c39ba16 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/convertTemplateType.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/convertTemplateType.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function (tokens, tt) { var startingToken = 0; var currentToken = 0; diff --git a/eslint/babel-eslint-parser/babylon-to-espree/index.js b/eslint/babel-eslint-parser/babylon-to-espree/index.js index 401570b6b199..94e6832f3476 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/index.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/index.js @@ -1,20 +1,36 @@ -exports.attachComments = require("./attachComments"); - -exports.toTokens = require("./toTokens"); -exports.toAST = require("./toAST"); - -exports.convertComments = function (comments) { - for (var i = 0; i < comments.length; i++) { - var comment = comments[i]; - if (comment.type === "CommentBlock") { - comment.type = "Block"; - } else if (comment.type === "CommentLine") { - comment.type = "Line"; - } - // sometimes comments don't get ranges computed, - // even with options.ranges === true - if (!comment.range) { - comment.range = [comment.start, comment.end]; - } - } +"use strict"; + +var attachComments = require("./attachComments"); +var convertComments = require("./convertComments"); +var toTokens = require("./toTokens"); +var toAST = require("./toAST"); + +module.exports = function (ast, traverse, tt, code) { + // remove EOF token, eslint doesn't use this for anything and it interferes + // with some rules see https://github.com/babel/babel-eslint/issues/2 + // todo: find a more elegant way to do this + ast.tokens.pop(); + + // convert tokens + ast.tokens = toTokens(ast.tokens, tt, code); + + // add comments + convertComments(ast.comments); + + // transform esprima and acorn divergent nodes + toAST(ast, traverse, code); + + // ast.program.tokens = ast.tokens; + // ast.program.comments = ast.comments; + // ast = ast.program; + + // remove File + ast.type = "Program"; + ast.sourceType = ast.program.sourceType; + ast.directives = ast.program.directives; + ast.body = ast.program.body; + delete ast.program; + delete ast._paths; + + attachComments(ast, ast.comments, ast.tokens); }; diff --git a/eslint/babel-eslint-parser/babylon-to-espree/toAST.js b/eslint/babel-eslint-parser/babylon-to-espree/toAST.js index c26fa5ba1173..84d77a53de41 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/toAST.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/toAST.js @@ -1,31 +1,21 @@ -var source; +"use strict"; + +var convertComments = require("./convertComments"); module.exports = function (ast, traverse, code) { - source = code; + var state = { source: code }; ast.range = [ast.start, ast.end]; - traverse(ast, astTransformVisitor); + traverse(ast, astTransformVisitor, null, state); }; -function changeToLiteral(node) { +function changeToLiteral(node, state) { node.type = "Literal"; if (!node.raw) { if (node.extra && node.extra.raw) { node.raw = node.extra.raw; } else { - node.raw = source.slice(node.start, node.end); - } - } -} - -function changeComments(nodeComments) { - for (var i = 0; i < nodeComments.length; i++) { - var comment = nodeComments[i]; - if (comment.type === "CommentLine") { - comment.type = "Line"; - } else if (comment.type === "CommentBlock") { - comment.type = "Block"; + node.raw = state.source.slice(node.start, node.end); } - comment.range = [comment.start, comment.end]; } } @@ -45,24 +35,40 @@ var astTransformVisitor = { } if (node.trailingComments) { - changeComments(node.trailingComments); + convertComments(node.trailingComments); } if (node.leadingComments) { - changeComments(node.leadingComments); + convertComments(node.leadingComments); } // make '_paths' non-enumerable (babel-eslint #200) Object.defineProperty(node, "_paths", { value: node._paths, writable: true }); }, - exit (path) { + exit (path, state) { var node = path.node; - [ - fixDirectives, - ].forEach((fixer) => { - fixer(path); - }); + // fixDirectives + if (path.isFunction() || path.isProgram()) { + var directivesContainer = node; + var body = node.body; + if (node.type !== "Program") { + directivesContainer = body; + body = body.body; + } + if (directivesContainer.directives) { + for (var i = directivesContainer.directives.length - 1; i >= 0; i--) { + var directive = directivesContainer.directives[i]; + directive.type = "ExpressionStatement"; + directive.expression = directive.value; + delete directive.value; + directive.expression.type = "Literal"; + changeToLiteral(directive.expression, state); + body.unshift(directive); + } + delete directivesContainer.directives; + } + } if (path.isJSXText()) { node.type = "Literal"; @@ -71,7 +77,7 @@ var astTransformVisitor = { if (path.isNumericLiteral() || path.isStringLiteral()) { - changeToLiteral(node); + changeToLiteral(node, state); } if (path.isBooleanLiteral()) { @@ -104,7 +110,7 @@ var astTransformVisitor = { } if (path.isClassMethod() || path.isObjectMethod()) { - var code = source.slice(node.key.end, node.body.start); + var code = state.source.slice(node.key.end, node.body.start); var offset = code.indexOf("("); node.value = { @@ -211,7 +217,8 @@ var astTransformVisitor = { // template string range fixes if (path.isTemplateLiteral()) { - node.quasis.forEach((q) => { + for (var j = 0; j < node.quasis.length; j++) { + var q = node.quasis[j]; q.range[0] -= 1; if (q.tail) { q.range[1] += 1; @@ -224,34 +231,7 @@ var astTransformVisitor = { } else { q.loc.end.column += 2; } - }); + } } } }; - - -function fixDirectives (path) { - if (!(path.isProgram() || path.isFunction())) return; - - var node = path.node; - var directivesContainer = node; - var body = node.body; - - if (node.type !== "Program") { - directivesContainer = body; - body = body.body; - } - - if (!directivesContainer.directives) return; - - directivesContainer.directives.reverse().forEach((directive) => { - directive.type = "ExpressionStatement"; - directive.expression = directive.value; - delete directive.value; - directive.expression.type = "Literal"; - changeToLiteral(directive.expression); - body.unshift(directive); - }); - delete directivesContainer.directives; -} -// fixDirectives diff --git a/eslint/babel-eslint-parser/babylon-to-espree/toToken.js b/eslint/babel-eslint-parser/babylon-to-espree/toToken.js index dcfd48f87cc1..6173f760d6eb 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/toToken.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/toToken.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = function (token, tt, source) { var type = token.type; token.range = [token.start, token.end]; diff --git a/eslint/babel-eslint-parser/babylon-to-espree/toTokens.js b/eslint/babel-eslint-parser/babylon-to-espree/toTokens.js index 1f06d3e51567..81ec9850afa6 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/toTokens.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/toTokens.js @@ -1,15 +1,18 @@ +"use strict"; + var convertTemplateType = require("./convertTemplateType"); var toToken = require("./toToken"); module.exports = function (tokens, tt, code) { // transform tokens to type "Template" convertTemplateType(tokens, tt); - var transformedTokens = tokens.filter((token) => { - return token.type !== "CommentLine" && token.type !== "CommentBlock"; - }); - for (var i = 0, l = transformedTokens.length; i < l; i++) { - transformedTokens[i] = toToken(transformedTokens[i], tt, code); + var transformedTokens = []; + for (var i = 0; i < tokens.length; i++) { + var token = tokens[i]; + if (token.type !== "CommentLine" && token.type !== "CommentBlock") { + transformedTokens.push(toToken(token, tt, code)); + } } return transformedTokens; diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 3b243cc81cd2..b56f74e561a1 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -428,33 +428,7 @@ exports.parseNoPatch = function (code, options) { throw err; } - // remove EOF token, eslint doesn't use this for anything and it interferes with some rules - // see https://github.com/babel/babel-eslint/issues/2 for more info - // todo: find a more elegant way to do this - ast.tokens.pop(); - - // convert tokens - ast.tokens = babylonToEspree.toTokens(ast.tokens, tt, code); - - // add comments - babylonToEspree.convertComments(ast.comments); - - // transform esprima and acorn divergent nodes - babylonToEspree.toAST(ast, traverse, code); - - // ast.program.tokens = ast.tokens; - // ast.program.comments = ast.comments; - // ast = ast.program; - - // remove File - ast.type = "Program"; - ast.sourceType = ast.program.sourceType; - ast.directives = ast.program.directives; - ast.body = ast.program.body; - delete ast.program; - delete ast._paths; - - babylonToEspree.attachComments(ast, ast.comments, ast.tokens); + babylonToEspree(ast, traverse, tt, code); return ast; }; From d78b0debd7b76984ce1936e8bb329e991b371ab2 Mon Sep 17 00:00:00 2001 From: Andres Suarez Date: Sat, 25 Mar 2017 19:32:05 -0400 Subject: [PATCH 356/569] Use dedent for unpadding (babel/babel-eslint#456) --- eslint/babel-eslint-parser/package.json | 1 + eslint/babel-eslint-parser/test/babel-eslint.js | 2 +- eslint/babel-eslint-parser/test/non-regression.js | 2 +- eslint/babel-eslint-parser/utils/unpad.js | 14 -------------- eslint/babel-eslint-parser/yarn.lock | 4 ++++ 5 files changed, 7 insertions(+), 16 deletions(-) delete mode 100644 eslint/babel-eslint-parser/utils/unpad.js diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 4b3acc0a53e1..cef295c69c1d 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -36,6 +36,7 @@ "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { "babel-eslint": "^7.0.0", + "dedent": "^0.7.0", "eslint": "^3.18.0", "eslint-config-babel": "^6.0.0", "eslint-plugin-flowtype": "^2.30.3", diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 41586c097fac..540170df254b 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -2,7 +2,7 @@ var assert = require("assert"); var babelEslint = require(".."); var espree = require("espree"); var util = require("util"); -var unpad = require("../utils/unpad"); +var unpad = require("dedent"); // Checks if the source ast implements the target ast. Ignores extra keys on source ast function assertImplementsAST(target, source, path) { diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 711aa25edd82..015b0fd331a8 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1,7 +1,7 @@ /*eslint-env mocha*/ "use strict"; var eslint = require("eslint"); -var unpad = require("../utils/unpad"); +var unpad = require("dedent"); function verifyAndAssertMessages(code, rules, expectedMessages, sourceType, overrideConfig) { var config = { diff --git a/eslint/babel-eslint-parser/utils/unpad.js b/eslint/babel-eslint-parser/utils/unpad.js deleted file mode 100644 index 63aca71efbec..000000000000 --- a/eslint/babel-eslint-parser/utils/unpad.js +++ /dev/null @@ -1,14 +0,0 @@ -// Remove padding from a string. -function unpad(str) { - const lines = str.split("\n"); - const m = lines[1] && lines[1].match(/^\s+/); - if (!m) { - return str; - } - const spaces = m[0].length; - return lines.map( - (line) => line.slice(spaces) - ).join("\n").trim(); -} - -module.exports = unpad; diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index afb72f464ba9..c81f84090b6b 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -222,6 +222,10 @@ debug@^2.1.1, debug@^2.2.0: dependencies: ms "0.7.2" +dedent@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" + deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" From 9a558bd94207ef59dbc5485b81842e9d283a5ec0 Mon Sep 17 00:00:00 2001 From: Andres Suarez Date: Sat, 25 Mar 2017 19:36:10 -0400 Subject: [PATCH 357/569] Remove unused .gitmodules (babel/babel-eslint#457) --- eslint/babel-eslint-parser/.gitmodules | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 eslint/babel-eslint-parser/.gitmodules diff --git a/eslint/babel-eslint-parser/.gitmodules b/eslint/babel-eslint-parser/.gitmodules deleted file mode 100644 index e922d16a4493..000000000000 --- a/eslint/babel-eslint-parser/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "eslint"] - path = eslint - url = https://github.com/eslint/eslint From b8a3af8cd6e0f5e7b1831aedb2b07897d9a9919a Mon Sep 17 00:00:00 2001 From: Andres Suarez Date: Thu, 30 Mar 2017 13:49:51 -0400 Subject: [PATCH 358/569] Separate finding peer deps from monkeypatching (babel/babel-eslint#460) --- eslint/babel-eslint-parser/index.js | 79 ++++++++++++----------------- 1 file changed, 33 insertions(+), 46 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index b56f74e561a1..3e8e2ffae82d 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -10,21 +10,10 @@ var codeFrame = require("babel-code-frame"); var hasPatched = false; var eslintOptions = {}; -function createModule(filename) { - var mod = new Module(filename); - mod.filename = filename; - mod.paths = Module._nodeModulePaths(path.dirname(filename)); - return mod; -} - -function monkeypatch() { - if (hasPatched) return; - hasPatched = true; - - var eslintLoc; +function getModules() { try { // avoid importing a local copy of eslint, try to find a peer dependency - eslintLoc = Module._resolveFilename("eslint", module.parent); + var eslintLoc = Module._resolveFilename("eslint", module.parent); } catch (err) { try { // avoids breaking in jest where module.parent is undefined @@ -35,18 +24,35 @@ function monkeypatch() { } // get modules relative to what eslint will load - var eslintMod = createModule(eslintLoc); - // ESLint v1.9.0 uses estraverse directly to work around https://github.com/npm/npm/issues/9663 + var eslintMod = new Module(eslintLoc); + eslintMod.filename = eslintLoc; + eslintMod.paths = Module._nodeModulePaths(path.dirname(eslintLoc)); + + var Definition = eslintMod.require("escope/lib/definition").Definition; + var escope = eslintMod.require("escope"); var estraverse = eslintMod.require("estraverse"); + var referencer = eslintMod.require("escope/lib/referencer"); + + if (referencer.__esModule) referencer = referencer.default; + + return { + Definition, + escope, + estraverse, + referencer, + }; +} + +function monkeypatch(modules) { + var Definition = modules.Definition; + var escope = modules.escope; + var estraverse = modules.estraverse; + var referencer = modules.referencer; Object.assign(estraverse.VisitorKeys, t.VISITOR_KEYS); estraverse.VisitorKeys.MethodDefinition.push("decorators"); estraverse.VisitorKeys.Property.push("decorators"); - // monkeypatch escope - var escopeLoc = Module._resolveFilename("escope", eslintMod); - var escopeMod = createModule(escopeLoc); - var escope = require(escopeLoc); var analyze = escope.analyze; escope.analyze = function (ast, opts) { opts.ecmaVersion = eslintOptions.ecmaVersion; @@ -59,28 +65,6 @@ function monkeypatch() { return results; }; - // monkeypatch escope/referencer - var referencerLoc; - try { - referencerLoc = Module._resolveFilename("./referencer", escopeMod); - } catch (err) { - throw new ReferenceError("couldn't resolve escope/referencer"); - } - var referencerMod = createModule(referencerLoc); - var referencer = require(referencerLoc); - if (referencer.__esModule) { - referencer = referencer.default; - } - - // reference Definition - var definitionLoc; - try { - definitionLoc = Module._resolveFilename("./definition", referencerMod); - } catch (err) { - throw new ReferenceError("couldn't resolve escope/definition"); - } - var Definition = require(definitionLoc).Definition; - // if there are decorators, then visit each function visitDecorators(node) { if (!node.decorators) { @@ -368,11 +352,14 @@ exports.parse = function (code, options) { delete eslintOptions.globalReturn; } - try { - monkeypatch(); - } catch (err) { - console.error(err.stack); - process.exit(1); + if (!hasPatched) { + hasPatched = true; + try { + monkeypatch(getModules()); + } catch (err) { + console.error(err.stack); + process.exit(1); + } } return exports.parseNoPatch(code, options); From 267731917b07e3e3f9b530ce190cf14a4227321e Mon Sep 17 00:00:00 2001 From: Vitor Balocco Date: Wed, 12 Apr 2017 17:59:23 +0200 Subject: [PATCH 359/569] Fix: use eslint-scope instead of escope if present (babel/babel-eslint#461) --- eslint/babel-eslint-parser/index.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 3e8e2ffae82d..0f871a90a358 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -28,10 +28,17 @@ function getModules() { eslintMod.filename = eslintLoc; eslintMod.paths = Module._nodeModulePaths(path.dirname(eslintLoc)); - var Definition = eslintMod.require("escope/lib/definition").Definition; - var escope = eslintMod.require("escope"); + try { + var escope = eslintMod.require("eslint-scope"); + var Definition = eslintMod.require("eslint-scope/lib/definition").Definition; + var referencer = eslintMod.require("eslint-scope/lib/referencer"); + } catch (err) { + escope = eslintMod.require("escope"); + Definition = eslintMod.require("escope/lib/definition").Definition; + referencer = eslintMod.require("escope/lib/referencer"); + } + var estraverse = eslintMod.require("estraverse"); - var referencer = eslintMod.require("escope/lib/referencer"); if (referencer.__esModule) referencer = referencer.default; From b5c058bf6e51dbd2aef719fdfdb3072b97e51bde Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 12 Apr 2017 12:07:05 -0400 Subject: [PATCH 360/569] 7.2.2 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index cef295c69c1d..a134201ef8ee 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "7.2.1", + "version": "7.2.2", "description": "Custom parser for ESLint", "main": "index.js", "files": [ From 6feaee84e0d02a08f207df3688d77bf4abeee246 Mon Sep 17 00:00:00 2001 From: Andres Suarez Date: Fri, 21 Apr 2017 11:48:52 -0400 Subject: [PATCH 361/569] Fix flow type spread handling (babel/babel-eslint#465) --- eslint/babel-eslint-parser/index.js | 7 +++++-- eslint/babel-eslint-parser/package.json | 2 +- eslint/babel-eslint-parser/test/non-regression.js | 12 ++++++++++++ eslint/babel-eslint-parser/yarn.lock | 6 +++--- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 0f871a90a358..b647fbdfda3e 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -107,7 +107,7 @@ function monkeypatch(modules) { // loops callProperties: { type: "loop", values: ["value"] }, indexers: { type: "loop", values: ["key", "value"] }, - properties: { type: "loop", values: ["value"] }, + properties: { type: "loop", values: ["argument", "value"] }, types: { type: "loop" }, params: { type: "loop" }, // single property @@ -142,7 +142,10 @@ function monkeypatch(modules) { for (var j = 0; j < nodeProperty.length; j++) { if (Array.isArray(propertyType.values)) { for (var k = 0; k < propertyType.values.length; k++) { - checkIdentifierOrVisit.call(this, nodeProperty[j][propertyType.values[k]]); + var loopPropertyNode = nodeProperty[j][propertyType.values[k]]; + if (loopPropertyNode) { + checkIdentifierOrVisit.call(this, loopPropertyNode); + } } } else { checkIdentifierOrVisit.call(this, nodeProperty[j]); diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index a134201ef8ee..343b99fc0ed0 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -15,7 +15,7 @@ "babel-code-frame": "^6.22.0", "babel-traverse": "^6.23.1", "babel-types": "^6.23.0", - "babylon": "^6.16.1" + "babylon": "^6.17.0" }, "scripts": { "test": "npm run lint && npm run test-only", diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 015b0fd331a8..f2cf31497392 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -574,6 +574,18 @@ describe("verify", () => { ); }); + it("supports type spreading", () => { + verifyAndAssertMessages( + unpad(` + type U = {}; + type T = {a: number, ...U, ...V}; + `), + { "no-undef": 1, "no-unused-vars": 1 }, + [ "2:6 'T' is defined but never used. no-unused-vars", + "2:31 'V' is not defined. no-undef" ] + ); + }); + it("1", () => { verifyAndAssertMessages( unpad(` diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index c81f84090b6b..f75d231426ae 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -113,9 +113,9 @@ babel-types@^6.15.0, babel-types@^6.23.0: lodash "^4.2.0" to-fast-properties "^1.0.1" -babylon@^6.13.0, babylon@^6.15.0, babylon@^6.16.1: - version "6.16.1" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.16.1.tgz#30c5a22f481978a9e7f8cdfdf496b11d94b404d3" +babylon@^6.13.0, babylon@^6.15.0, babylon@^6.17.0: + version "6.17.0" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.17.0.tgz#37da948878488b9c4e3c4038893fa3314b3fc932" balanced-match@^0.4.1: version "0.4.2" From b4daa5eae2d038ae09c74b87b0c61e8dc1ed2355 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Fri, 21 Apr 2017 22:14:19 +0100 Subject: [PATCH 362/569] 7.2.3 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 343b99fc0ed0..a247678c0de0 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "7.2.2", + "version": "7.2.3", "description": "Custom parser for ESLint", "main": "index.js", "files": [ From cb2eb3a1fb6096ecc398f964365259fede0c93b8 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Mon, 29 May 2017 20:41:14 -0500 Subject: [PATCH 363/569] Fix: Convert RegExpLieteral value to RegExp object (fixes babel/babel-eslint#477) (babel/babel-eslint#478) --- .../babel-eslint-parser/babylon-to-espree/toAST.js | 6 +++++- eslint/babel-eslint-parser/test/babel-eslint.js | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/babylon-to-espree/toAST.js b/eslint/babel-eslint-parser/babylon-to-espree/toAST.js index 84d77a53de41..53bc76be05d7 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/toAST.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/toAST.js @@ -94,7 +94,11 @@ var astTransformVisitor = { if (path.isRegExpLiteral()) { node.type = "Literal"; node.raw = node.extra.raw; - node.value = {}; + try { + node.value = new RegExp(node.pattern, node.flags); + } catch (err) { + node.value = null; + } node.regex = { pattern: node.pattern, flags: node.flags diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 540170df254b..b7f0e699344b 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -20,6 +20,8 @@ function assertImplementsAST(target, source, path) { var typeB = source === null ? "null" : typeof source; if (typeA !== typeB) { error(`have different types (${typeA} !== ${typeB}) (${target} !== ${source})`); + } else if (typeA === "object" && ["RegExp"].indexOf(target.constructor.name) !== -1 && target.constructor.name !== source.constructor.name) { + error(`object have different constructors (${target.constructor.name} !== ${source.constructor.name}`); } else if (typeA === "object") { var keysTarget = Object.keys(target); for (var i in keysTarget) { @@ -305,6 +307,18 @@ describe("babylon-to-esprima", () => { parseAndAssertSame("/affix-top|affix-bottom|affix|[a-z]/"); }); + it("regexp", () => { + parseAndAssertSame("const foo = /foo/;"); + }); + + it("regexp y flag", () => { + parseAndAssertSame("const foo = /foo/y;"); + }); + + it("regexp u flag", () => { + parseAndAssertSame("const foo = /foo/u;"); + }); + it("regexp in a template string", () => { parseAndAssertSame("`${/\\d/.exec(\"1\")[0]}`"); }); From 4e4aa0563949c0fa5921c136995d95be0a9b2c21 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Tue, 6 Jun 2017 20:37:57 -0500 Subject: [PATCH 364/569] Update to Babylon 7 (fixes babel/babel-eslint#481) (babel/babel-eslint#482) * Update to Babylon 7 (fixes babel/babel-eslint#481) * Pin dependencies to alpha version * fix deprecation, add other plugins * oops * Update index.js * Add tests for private class properties with rules no-undef no-unused-vars --- .../babylon-to-espree/toAST.js | 9 +- eslint/babel-eslint-parser/index.js | 26 ++++- eslint/babel-eslint-parser/package.json | 8 +- .../test/non-regression.js | 40 +++++-- eslint/babel-eslint-parser/yarn.lock | 107 +++++++++++++++++- 5 files changed, 169 insertions(+), 21 deletions(-) diff --git a/eslint/babel-eslint-parser/babylon-to-espree/toAST.js b/eslint/babel-eslint-parser/babylon-to-espree/toAST.js index 53bc76be05d7..738330a0674d 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/toAST.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/toAST.js @@ -157,6 +157,7 @@ var astTransformVisitor = { if (node.kind === "method") { node.kind = "init"; } + node.shorthand = false; } delete node.body; @@ -169,8 +170,12 @@ var astTransformVisitor = { delete node.typeParameters; } - if (path.isRestProperty() || path.isSpreadProperty()) { - node.type = `Experimental${node.type}`; + if (path.isRestElement() && path.parent && path.parent.type === "ObjectPattern") { + node.type = "ExperimentalRestProperty"; + } + + if (path.isSpreadElement() && path.parent && path.parent.type === "ObjectExpression") { + node.type = "ExperimentalSpreadProperty"; } if (path.isTypeParameter && path.isTypeParameter()) { diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index b647fbdfda3e..f06d04b85478 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -5,7 +5,7 @@ var parse = require("babylon").parse; var t = require("babel-types"); var tt = require("babylon").tokTypes; var traverse = require("babel-traverse").default; -var codeFrame = require("babel-code-frame"); +var codeFrameColumns = require("babel-code-frame").codeFrameColumns; var hasPatched = false; var eslintOptions = {}; @@ -231,13 +231,18 @@ function monkeypatch(modules) { visitProperty.call(this, node); }; - // visit ClassProperty as a Property. - referencer.prototype.ClassProperty = function(node) { + function visitClassProperty(node) { if (node.typeAnnotation) { visitTypeAnnotation.call(this, node.typeAnnotation); } this.visitProperty(node); - }; + } + + // visit ClassProperty as a Property. + referencer.prototype.ClassProperty = visitClassProperty; + + // visit ClassPrivateProperty as a Property. + referencer.prototype.ClassPrivateProperty = visitClassProperty; // visit flow type in FunctionDeclaration, FunctionExpression, ArrowFunctionExpression var visitFunction = referencer.prototype.visitFunction; @@ -397,7 +402,11 @@ exports.parseNoPatch = function (code, options) { "functionSent", "objectRestSpread", "trailingFunctionCommas", - "dynamicImport" + "dynamicImport", + "numericSeparator", + "optionalChaining", + "importMeta", + "classPrivateProperties", ] }; @@ -418,7 +427,12 @@ exports.parseNoPatch = function (code, options) { err.message = "Line " + err.lineNumber + ": " + err.message.replace(/ \((\d+):(\d+)\)$/, "") + // add codeframe "\n\n" + - codeFrame(code, err.lineNumber, err.column, { highlightCode: true }); + codeFrameColumns(code, { + start: { + line: err.lineNumber, + column: err.column, + }, + }, { highlightCode: true }); } } diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index a247678c0de0..75c724a8e11c 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -12,10 +12,10 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "babel-code-frame": "^6.22.0", - "babel-traverse": "^6.23.1", - "babel-types": "^6.23.0", - "babylon": "^6.17.0" + "babel-code-frame": "7.0.0-alpha.12", + "babel-traverse": "7.0.0-alpha.12", + "babel-types": "7.0.0-alpha.12", + "babylon": "7.0.0-beta.13" }, "scripts": { "test": "npm run lint && npm run test-only", diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index f2cf31497392..26bf95af3d43 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1738,11 +1738,37 @@ describe("verify", () => { ); }); - // it("regex with es6 unicodeCodePointEscapes", function () { - // verifyAndAssertMessages( - // "string.replace(/[\u{0000A0}-\u{10FFFF}<>\&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`);", - // {}, - // [] - // ); - // }); + it("regex with es6 unicodeCodePointEscapes", () => { + verifyAndAssertMessages( + "string.replace(/[\u{0000A0}-\u{10FFFF}<>\&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`);", + {}, + [] + ); + }); + + describe("private class properties", () => { + it("should not be undefined", () => { + verifyAndAssertMessages( + unpad(` + class C { + #d = 1; + } + `), + { "no-undef": 1 }, + [] + ); + }); + + it("should not be unused", () => { + verifyAndAssertMessages( + unpad(` + export class C { + #d = 1; + } + `), + { "no-unused-vars": 1 }, + [] + ); + }); + }); }); diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index f75d231426ae..134eda3e5602 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -59,6 +59,22 @@ arrify@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" +babel-code-frame@7.0.0-alpha.12: + version "7.0.0-alpha.12" + resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-7.0.0-alpha.12.tgz#26fbb2eab1c20763271fecb6b04a108756fae61f" + dependencies: + chalk "^1.1.0" + esutils "^2.0.2" + js-tokens "^3.0.0" + +babel-code-frame@7.0.0-alpha.3: + version "7.0.0-alpha.3" + resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-7.0.0-alpha.3.tgz#9ff265eaaac94b58dfc7ca4a4eecf389d5f4d344" + dependencies: + chalk "^1.1.0" + esutils "^2.0.2" + js-tokens "^3.0.0" + babel-code-frame@^6.16.0, babel-code-frame@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4" @@ -77,6 +93,29 @@ babel-eslint@^7.0.0: babylon "^6.13.0" lodash.pickby "^4.6.0" +babel-helper-function-name@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-helper-function-name/-/babel-helper-function-name-7.0.0-alpha.7.tgz#19aecddc5402f941c5726802993077b41ea9832d" + dependencies: + babel-helper-get-function-arity "7.0.0-alpha.7" + babel-template "7.0.0-alpha.7" + babel-traverse "7.0.0-alpha.7" + babel-types "7.0.0-alpha.7" + +babel-helper-get-function-arity@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-helper-get-function-arity/-/babel-helper-get-function-arity-7.0.0-alpha.7.tgz#16e6526ecefc5537826012365e577de2ccba02f5" + dependencies: + babel-types "7.0.0-alpha.7" + +babel-messages@7.0.0-alpha.12: + version "7.0.0-alpha.12" + resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-7.0.0-alpha.12.tgz#5fda840cb8dfeda06a7894a1e8ab1af695f249c0" + +babel-messages@7.0.0-alpha.3: + version "7.0.0-alpha.3" + resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-7.0.0-alpha.3.tgz#c8390a468478b8384da134612e12a6bc31a684e9" + babel-messages@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" @@ -90,7 +129,43 @@ babel-runtime@^6.22.0: core-js "^2.4.0" regenerator-runtime "^0.10.0" -babel-traverse@^6.15.0, babel-traverse@^6.23.1: +babel-template@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-7.0.0-alpha.7.tgz#82e26500980d1b3f14d9ebe8ae8b9325dc158392" + dependencies: + babel-traverse "7.0.0-alpha.7" + babel-types "7.0.0-alpha.7" + babylon "7.0.0-beta.8" + lodash "^4.2.0" + +babel-traverse@7.0.0-alpha.12: + version "7.0.0-alpha.12" + resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-7.0.0-alpha.12.tgz#0c0855a60287e56e54cf61ea9f135cdf759d6ad0" + dependencies: + babel-code-frame "7.0.0-alpha.12" + babel-helper-function-name "7.0.0-alpha.7" + babel-messages "7.0.0-alpha.12" + babel-types "7.0.0-alpha.12" + babylon "7.0.0-beta.12" + debug "^2.2.0" + globals "^9.0.0" + invariant "^2.2.0" + lodash "^4.2.0" + +babel-traverse@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-7.0.0-alpha.7.tgz#61cc89061b0ad0a5f9fc6df81117fac428bc4148" + dependencies: + babel-code-frame "7.0.0-alpha.3" + babel-messages "7.0.0-alpha.3" + babel-types "7.0.0-alpha.7" + babylon "7.0.0-beta.8" + debug "^2.2.0" + globals "^9.0.0" + invariant "^2.2.0" + lodash "^4.2.0" + +babel-traverse@^6.15.0: version "6.23.1" resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.23.1.tgz#d3cb59010ecd06a97d81310065f966b699e14f48" dependencies: @@ -104,6 +179,22 @@ babel-traverse@^6.15.0, babel-traverse@^6.23.1: invariant "^2.2.0" lodash "^4.2.0" +babel-types@7.0.0-alpha.12: + version "7.0.0-alpha.12" + resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-7.0.0-alpha.12.tgz#d7b2c6d0c49c518fd36de5ac14f4f50bed6de7e5" + dependencies: + esutils "^2.0.2" + lodash "^4.2.0" + to-fast-properties "^1.0.1" + +babel-types@7.0.0-alpha.7: + version "7.0.0-alpha.7" + resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-7.0.0-alpha.7.tgz#4bdb77386d1f6e2001f42fa9ac21b6c3d6ad0d82" + dependencies: + esutils "^2.0.2" + lodash "^4.2.0" + to-fast-properties "^1.0.1" + babel-types@^6.15.0, babel-types@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.23.0.tgz#bb17179d7538bad38cd0c9e115d340f77e7e9acf" @@ -113,7 +204,19 @@ babel-types@^6.15.0, babel-types@^6.23.0: lodash "^4.2.0" to-fast-properties "^1.0.1" -babylon@^6.13.0, babylon@^6.15.0, babylon@^6.17.0: +babylon@7.0.0-beta.12: + version "7.0.0-beta.12" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.12.tgz#f7b9c8a89ff7d6afb57b906d947a4237f9bf53f9" + +babylon@7.0.0-beta.13: + version "7.0.0-beta.13" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.13.tgz#12425c1bfd9498be419021ed36b43fe4f0289c0a" + +babylon@7.0.0-beta.8: + version "7.0.0-beta.8" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.8.tgz#2bdc5ae366041442c27e068cce6f0d7c06ea9949" + +babylon@^6.13.0, babylon@^6.15.0: version "6.17.0" resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.17.0.tgz#37da948878488b9c4e3c4038893fa3314b3fc932" From 45a9f64174697182b91bbc25d16bada3b90d2c15 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Tue, 6 Jun 2017 20:38:49 -0500 Subject: [PATCH 365/569] Use Node 8 and drop Node 5 from travis (babel/babel-eslint#483) * Use Node 8 and drop Node 5 from travis * switch the order [skip ci] --- eslint/babel-eslint-parser/.travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/.travis.yml b/eslint/babel-eslint-parser/.travis.yml index 7f84d147a4d2..ad63884c93b7 100644 --- a/eslint/babel-eslint-parser/.travis.yml +++ b/eslint/babel-eslint-parser/.travis.yml @@ -1,9 +1,9 @@ sudo: false language: node_js node_js: - - "4" - - "5" + - "8" - "6" + - "4" matrix: fast_finish: true From 36a630e0235676dcb7a94a399794fcbcfb1d07d9 Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Thu, 8 Jun 2017 17:23:08 +0100 Subject: [PATCH 366/569] Fix: allow options to be optional when monkey patching escope.analyze (fixes babel/babel-eslint#470). (babel/babel-eslint#484) --- eslint/babel-eslint-parser/index.js | 1 + eslint/babel-eslint-parser/test/babel-eslint.js | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index f06d04b85478..a126db9dedc4 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -62,6 +62,7 @@ function monkeypatch(modules) { var analyze = escope.analyze; escope.analyze = function (ast, opts) { + opts = opts || {}; opts.ecmaVersion = eslintOptions.ecmaVersion; opts.sourceType = eslintOptions.sourceType; if (eslintOptions.globalReturn !== undefined) { diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index b7f0e699344b..28250588cba8 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -1,6 +1,7 @@ var assert = require("assert"); var babelEslint = require(".."); var espree = require("espree"); +var escope = require("escope"); var util = require("util"); var unpad = require("dedent"); @@ -85,6 +86,16 @@ function parseAndAssertSame(code) { } describe("babylon-to-esprima", () => { + describe("compatibility", () => { + it("should allow ast.analyze to be called without options", function() { + var esAST = babelEslint.parse("`test`"); + + assert.doesNotThrow(() => { + escope.analyze(esAST); + }, TypeError, "Should allow no options argument."); + }); + }); + describe("templates", () => { it("empty template string", () => { parseAndAssertSame("``"); From bffbaff7e2d7f4058d8022b2356871415defb230 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Thu, 15 Jun 2017 23:03:02 +0200 Subject: [PATCH 367/569] Use babylon estree and ranges (babel/babel-eslint#489) --- .../babylon-to-espree/index.js | 1 - .../babylon-to-espree/toAST.js | 165 ++---------------- eslint/babel-eslint-parser/index.js | 2 + .../babel-eslint-parser/test/babel-eslint.js | 2 +- 4 files changed, 17 insertions(+), 153 deletions(-) diff --git a/eslint/babel-eslint-parser/babylon-to-espree/index.js b/eslint/babel-eslint-parser/babylon-to-espree/index.js index 94e6832f3476..d19c9b07936f 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/index.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/index.js @@ -30,7 +30,6 @@ module.exports = function (ast, traverse, tt, code) { ast.directives = ast.program.directives; ast.body = ast.program.body; delete ast.program; - delete ast._paths; attachComments(ast, ast.comments, ast.tokens); }; diff --git a/eslint/babel-eslint-parser/babylon-to-espree/toAST.js b/eslint/babel-eslint-parser/babylon-to-espree/toAST.js index 738330a0674d..2830f5dc4138 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/toAST.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/toAST.js @@ -1,31 +1,26 @@ "use strict"; +var t = require("babel-types"); var convertComments = require("./convertComments"); module.exports = function (ast, traverse, code) { var state = { source: code }; - ast.range = [ast.start, ast.end]; + + // Monkey patch visitor keys in order to be able to traverse the estree nodes + t.VISITOR_KEYS.Property = t.VISITOR_KEYS.ObjectProperty; + t.VISITOR_KEYS.MethodDefinition = ["key", "value", "decorators", "returnType", "typeParameters"]; + traverse(ast, astTransformVisitor, null, state); -}; -function changeToLiteral(node, state) { - node.type = "Literal"; - if (!node.raw) { - if (node.extra && node.extra.raw) { - node.raw = node.extra.raw; - } else { - node.raw = state.source.slice(node.start, node.end); - } - } -} + delete t.VISITOR_KEYS.Property; + delete t.VISITOR_KEYS.MethodDefinition; +}; var astTransformVisitor = { noScope: true, enter (path) { var node = path.node; - node.range = [node.start, node.end]; - // private var to track original node type node._babelType = node.type; @@ -41,133 +36,17 @@ var astTransformVisitor = { if (node.leadingComments) { convertComments(node.leadingComments); } - - // make '_paths' non-enumerable (babel-eslint #200) - Object.defineProperty(node, "_paths", { value: node._paths, writable: true }); }, - exit (path, state) { + exit (path) { var node = path.node; - // fixDirectives - if (path.isFunction() || path.isProgram()) { - var directivesContainer = node; - var body = node.body; - if (node.type !== "Program") { - directivesContainer = body; - body = body.body; - } - if (directivesContainer.directives) { - for (var i = directivesContainer.directives.length - 1; i >= 0; i--) { - var directive = directivesContainer.directives[i]; - directive.type = "ExpressionStatement"; - directive.expression = directive.value; - delete directive.value; - directive.expression.type = "Literal"; - changeToLiteral(directive.expression, state); - body.unshift(directive); - } - delete directivesContainer.directives; - } - } - if (path.isJSXText()) { node.type = "Literal"; - node.raw = node.value; - } - - if (path.isNumericLiteral() || - path.isStringLiteral()) { - changeToLiteral(node, state); - } - - if (path.isBooleanLiteral()) { - node.type = "Literal"; - node.raw = String(node.value); - } - - if (path.isNullLiteral()) { - node.type = "Literal"; - node.raw = "null"; - node.value = null; - } - - if (path.isRegExpLiteral()) { - node.type = "Literal"; - node.raw = node.extra.raw; - try { - node.value = new RegExp(node.pattern, node.flags); - } catch (err) { - node.value = null; - } - node.regex = { - pattern: node.pattern, - flags: node.flags - }; - delete node.extra; - delete node.pattern; - delete node.flags; } - if (path.isObjectProperty()) { - node.type = "Property"; - node.kind = "init"; - } - - if (path.isClassMethod() || path.isObjectMethod()) { - var code = state.source.slice(node.key.end, node.body.start); - var offset = code.indexOf("("); - - node.value = { - type: "FunctionExpression", - id: node.id, - params: node.params, - body: node.body, - async: node.async, - generator: node.generator, - expression: node.expression, - defaults: [], // basic support - TODO: remove (old esprima) - loc: { - start: { - line: node.key.loc.start.line, - column: node.key.loc.end.column + offset // a[() {] - }, - end: node.body.loc.end - } - }; - // [asdf]() { - node.value.range = [node.key.end + offset, node.body.end]; - - node.value.start = node.value.range && node.value.range[0] || node.value.loc.start.column; - node.value.end = node.value.range && node.value.range[1] || node.value.loc.end.column; - - if (node.returnType) { - node.value.returnType = node.returnType; - } - - if (node.typeParameters) { - node.value.typeParameters = node.typeParameters; - } - - if (path.isClassMethod()) { - node.type = "MethodDefinition"; - } - - if (path.isObjectMethod()) { - node.type = "Property"; - if (node.kind === "method") { - node.kind = "init"; - } - node.shorthand = false; - } - - delete node.body; - delete node.id; - delete node.async; - delete node.generator; - delete node.expression; - delete node.params; - delete node.returnType; - delete node.typeParameters; + // TODO estree plugin bug + if (node.type === "Property") { + if (!node.shorthand) node.shorthand = false; } if (path.isRestElement() && path.parent && path.parent.type === "ObjectPattern") { @@ -178,7 +57,7 @@ var astTransformVisitor = { node.type = "ExperimentalSpreadProperty"; } - if (path.isTypeParameter && path.isTypeParameter()) { + if (path.isTypeParameter()) { node.type = "Identifier"; node.typeAnnotation = node.bound; delete node.bound; @@ -208,22 +87,6 @@ var astTransformVisitor = { delete node.isType; } - if (path.isExportDeclaration()) { - var declar = path.get("declaration"); - if (declar.isClassExpression()) { - node.declaration.type = "ClassDeclaration"; - } else if (declar.isFunctionExpression()) { - node.declaration.type = "FunctionDeclaration"; - } - } - - // TODO: remove (old esprima) - if (path.isFunction()) { - if (!node.defaults) { - node.defaults = []; - } - } - // template string range fixes if (path.isTemplateLiteral()) { for (var j = 0; j < node.quasis.length; j++) { diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index a126db9dedc4..5beabc741581 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -388,9 +388,11 @@ exports.parseNoPatch = function (code, options) { allowImportExportEverywhere: options.allowImportExportEverywhere, // consistent with espree allowReturnOutsideFunction: true, allowSuperOutsideMethod: true, + ranges: true, plugins: [ "flow", "jsx", + "estree", "asyncFunctions", "asyncGenerators", "classConstructorCall", diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 28250588cba8..31d3918c54b8 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -371,7 +371,7 @@ describe("babylon-to-esprima", () => { ); }); - describe("babel 6 tests", () => { + describe("babel tests", () => { it("MethodDefinition", () => { parseAndAssertSame( unpad(` From 001064885df95009b7c8a6d258a77ea743bd5a92 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 16 Jun 2017 16:56:32 -0400 Subject: [PATCH 368/569] 8.0.0-alpha.12 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 75c724a8e11c..2f4ddc905d50 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "7.2.3", + "version": "8.0.0-alpha.12", "description": "Custom parser for ESLint", "main": "index.js", "files": [ From 94e69f399b5db1e54d4d134c6f5be8044c77b6e7 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Sat, 17 Jun 2017 14:14:42 -0500 Subject: [PATCH 369/569] Add Prettier (babel/babel-eslint#491) --- eslint/babel-eslint-parser/.eslintrc.js | 6 +- .../babylon-to-espree/attachComments.js | 2 +- .../babylon-to-espree/convertComments.js | 2 +- .../babylon-to-espree/convertTemplateType.js | 30 +- .../babylon-to-espree/index.js | 8 +- .../babylon-to-espree/toAST.js | 28 +- .../babylon-to-espree/toToken.js | 58 ++- .../babylon-to-espree/toTokens.js | 2 +- eslint/babel-eslint-parser/index.js | 91 +++-- eslint/babel-eslint-parser/package.json | 15 +- .../babel-eslint-parser/test/babel-eslint.js | 101 +++-- .../babel-eslint-parser/test/integration.js | 319 ++++++++------- .../test/non-regression.js | 215 ++++++----- eslint/babel-eslint-parser/yarn.lock | 362 +++++++++++++++++- 14 files changed, 856 insertions(+), 383 deletions(-) diff --git a/eslint/babel-eslint-parser/.eslintrc.js b/eslint/babel-eslint-parser/.eslintrc.js index 20f31f1eebd5..adce94d69a00 100644 --- a/eslint/babel-eslint-parser/.eslintrc.js +++ b/eslint/babel-eslint-parser/.eslintrc.js @@ -1,9 +1,13 @@ module.exports = { root: true, extends: "babel", + "plugins": [ + "prettier" + ], rules: { "no-var": 0, - "max-len": 0 + "max-len": 0, + "prettier/prettier": ["error", { "trailingComma": "es5" }], }, env: { node: true, diff --git a/eslint/babel-eslint-parser/babylon-to-espree/attachComments.js b/eslint/babel-eslint-parser/babylon-to-espree/attachComments.js index 9fc9f339c2b5..8c608a45ad94 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/attachComments.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/attachComments.js @@ -1,7 +1,7 @@ "use strict"; // comment fixes -module.exports = function (ast, comments, tokens) { +module.exports = function(ast, comments, tokens) { if (comments.length) { var firstComment = comments[0]; var lastComment = comments[comments.length - 1]; diff --git a/eslint/babel-eslint-parser/babylon-to-espree/convertComments.js b/eslint/babel-eslint-parser/babylon-to-espree/convertComments.js index 19c6ce8c97c7..17d711737294 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/convertComments.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/convertComments.js @@ -1,6 +1,6 @@ "use strict"; -module.exports = function (comments) { +module.exports = function(comments) { for (var i = 0; i < comments.length; i++) { var comment = comments[i]; if (comment.type === "CommentBlock") { diff --git a/eslint/babel-eslint-parser/babylon-to-espree/convertTemplateType.js b/eslint/babel-eslint-parser/babylon-to-espree/convertTemplateType.js index 8b647c39ba16..d8892f997260 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/convertTemplateType.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/convertTemplateType.js @@ -1,24 +1,25 @@ "use strict"; -module.exports = function (tokens, tt) { - var startingToken = 0; - var currentToken = 0; - var numBraces = 0; // track use of {} - var numBackQuotes = 0; // track number of nested templates +module.exports = function(tokens, tt) { + var startingToken = 0; + var currentToken = 0; + var numBraces = 0; // track use of {} + var numBackQuotes = 0; // track number of nested templates function isBackQuote(token) { return tokens[token].type === tt.backQuote; } function isTemplateStarter(token) { - return isBackQuote(token) || - // only can be a template starter when in a template already - tokens[token].type === tt.braceR && numBackQuotes > 0; + return ( + isBackQuote(token) || + // only can be a template starter when in a template already + (tokens[token].type === tt.braceR && numBackQuotes > 0) + ); } function isTemplateEnder(token) { - return isBackQuote(token) || - tokens[token].type === tt.dollarBraceL; + return isBackQuote(token) || tokens[token].type === tt.dollarBraceL; } // append the values between start and end @@ -44,8 +45,8 @@ module.exports = function (tokens, tt) { end: tokens[end].end, loc: { start: tokens[start].loc.start, - end: tokens[end].loc.end - } + end: tokens[end].loc.end, + }, }; // put new token in place of old tokens @@ -70,7 +71,10 @@ module.exports = function (tokens, tt) { currentToken = startingToken + 1; // check if token after template start is "template" - if (currentToken >= tokens.length - 1 || tokens[currentToken].type !== tt.template) { + if ( + currentToken >= tokens.length - 1 || + tokens[currentToken].type !== tt.template + ) { break; } diff --git a/eslint/babel-eslint-parser/babylon-to-espree/index.js b/eslint/babel-eslint-parser/babylon-to-espree/index.js index d19c9b07936f..ecd8eee6f1d8 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/index.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/index.js @@ -1,11 +1,11 @@ "use strict"; -var attachComments = require("./attachComments"); +var attachComments = require("./attachComments"); var convertComments = require("./convertComments"); -var toTokens = require("./toTokens"); -var toAST = require("./toAST"); +var toTokens = require("./toTokens"); +var toAST = require("./toAST"); -module.exports = function (ast, traverse, tt, code) { +module.exports = function(ast, traverse, tt, code) { // remove EOF token, eslint doesn't use this for anything and it interferes // with some rules see https://github.com/babel/babel-eslint/issues/2 // todo: find a more elegant way to do this diff --git a/eslint/babel-eslint-parser/babylon-to-espree/toAST.js b/eslint/babel-eslint-parser/babylon-to-espree/toAST.js index 2830f5dc4138..7e3e6876fc8c 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/toAST.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/toAST.js @@ -3,12 +3,18 @@ var t = require("babel-types"); var convertComments = require("./convertComments"); -module.exports = function (ast, traverse, code) { +module.exports = function(ast, traverse, code) { var state = { source: code }; // Monkey patch visitor keys in order to be able to traverse the estree nodes t.VISITOR_KEYS.Property = t.VISITOR_KEYS.ObjectProperty; - t.VISITOR_KEYS.MethodDefinition = ["key", "value", "decorators", "returnType", "typeParameters"]; + t.VISITOR_KEYS.MethodDefinition = [ + "key", + "value", + "decorators", + "returnType", + "typeParameters", + ]; traverse(ast, astTransformVisitor, null, state); @@ -18,7 +24,7 @@ module.exports = function (ast, traverse, code) { var astTransformVisitor = { noScope: true, - enter (path) { + enter(path) { var node = path.node; // private var to track original node type @@ -37,7 +43,7 @@ var astTransformVisitor = { convertComments(node.leadingComments); } }, - exit (path) { + exit(path) { var node = path.node; if (path.isJSXText()) { @@ -49,11 +55,19 @@ var astTransformVisitor = { if (!node.shorthand) node.shorthand = false; } - if (path.isRestElement() && path.parent && path.parent.type === "ObjectPattern") { + if ( + path.isRestElement() && + path.parent && + path.parent.type === "ObjectPattern" + ) { node.type = "ExperimentalRestProperty"; } - if (path.isSpreadElement() && path.parent && path.parent.type === "ObjectExpression") { + if ( + path.isSpreadElement() && + path.parent && + path.parent.type === "ObjectExpression" + ) { node.type = "ExperimentalSpreadProperty"; } @@ -105,5 +119,5 @@ var astTransformVisitor = { } } } - } + }, }; diff --git a/eslint/babel-eslint-parser/babylon-to-espree/toToken.js b/eslint/babel-eslint-parser/babylon-to-espree/toToken.js index 6173f760d6eb..9c5a49ef11dd 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/toToken.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/toToken.js @@ -1,29 +1,47 @@ "use strict"; -module.exports = function (token, tt, source) { +module.exports = function(token, tt, source) { var type = token.type; token.range = [token.start, token.end]; if (type === tt.name) { token.type = "Identifier"; - } else if (type === tt.semi || type === tt.comma || - type === tt.parenL || type === tt.parenR || - type === tt.braceL || type === tt.braceR || - type === tt.slash || type === tt.dot || - type === tt.bracketL || type === tt.bracketR || - type === tt.ellipsis || type === tt.arrow || - type === tt.star || type === tt.incDec || - type === tt.colon || type === tt.question || - type === tt.template || type === tt.backQuote || - type === tt.dollarBraceL || type === tt.at || - type === tt.logicalOR || type === tt.logicalAND || - type === tt.bitwiseOR || type === tt.bitwiseXOR || - type === tt.bitwiseAND || type === tt.equality || - type === tt.relational || type === tt.bitShift || - type === tt.plusMin || type === tt.modulo || - type === tt.exponent || type === tt.prefix || - type === tt.doubleColon || - type.isAssign) { + } else if ( + type === tt.semi || + type === tt.comma || + type === tt.parenL || + type === tt.parenR || + type === tt.braceL || + type === tt.braceR || + type === tt.slash || + type === tt.dot || + type === tt.bracketL || + type === tt.bracketR || + type === tt.ellipsis || + type === tt.arrow || + type === tt.star || + type === tt.incDec || + type === tt.colon || + type === tt.question || + type === tt.template || + type === tt.backQuote || + type === tt.dollarBraceL || + type === tt.at || + type === tt.logicalOR || + type === tt.logicalAND || + type === tt.bitwiseOR || + type === tt.bitwiseXOR || + type === tt.bitwiseAND || + type === tt.equality || + type === tt.relational || + type === tt.bitShift || + type === tt.plusMin || + type === tt.modulo || + type === tt.exponent || + type === tt.prefix || + type === tt.doubleColon || + type.isAssign + ) { token.type = "Punctuator"; if (!token.value) token.value = type.label; } else if (type === tt.jsxTagStart) { @@ -53,7 +71,7 @@ module.exports = function (token, tt, source) { var value = token.value; token.regex = { pattern: value.pattern, - flags: value.flags + flags: value.flags, }; token.value = `/${value.pattern}/${value.flags}`; } diff --git a/eslint/babel-eslint-parser/babylon-to-espree/toTokens.js b/eslint/babel-eslint-parser/babylon-to-espree/toTokens.js index 81ec9850afa6..a863b871b0a8 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/toTokens.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/toTokens.js @@ -3,7 +3,7 @@ var convertTemplateType = require("./convertTemplateType"); var toToken = require("./toToken"); -module.exports = function (tokens, tt, code) { +module.exports = function(tokens, tt, code) { // transform tokens to type "Template" convertTemplateType(tokens, tt); diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 5beabc741581..ecedcb50ad84 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -1,10 +1,10 @@ var babylonToEspree = require("./babylon-to-espree"); -var Module = require("module"); -var path = require("path"); -var parse = require("babylon").parse; -var t = require("babel-types"); -var tt = require("babylon").tokTypes; -var traverse = require("babel-traverse").default; +var Module = require("module"); +var path = require("path"); +var parse = require("babylon").parse; +var t = require("babel-types"); +var tt = require("babylon").tokTypes; +var traverse = require("babel-traverse").default; var codeFrameColumns = require("babel-code-frame").codeFrameColumns; var hasPatched = false; @@ -30,10 +30,11 @@ function getModules() { try { var escope = eslintMod.require("eslint-scope"); - var Definition = eslintMod.require("eslint-scope/lib/definition").Definition; + var Definition = eslintMod.require("eslint-scope/lib/definition") + .Definition; var referencer = eslintMod.require("eslint-scope/lib/referencer"); } catch (err) { - escope = eslintMod.require("escope"); + escope = eslintMod.require("escope"); Definition = eslintMod.require("escope/lib/definition").Definition; referencer = eslintMod.require("escope/lib/referencer"); } @@ -61,7 +62,7 @@ function monkeypatch(modules) { estraverse.VisitorKeys.Property.push("decorators"); var analyze = escope.analyze; - escope.analyze = function (ast, opts) { + escope.analyze = function(ast, opts) { opts = opts || {}; opts.ecmaVersion = eslintOptions.ecmaVersion; opts.sourceType = eslintOptions.sourceType; @@ -94,7 +95,7 @@ function monkeypatch(modules) { "FunctionExpression", "Identifier", "ObjectPattern", - "RestElement" + "RestElement", ]); var visitorKeysMap = Object.keys(t.VISITOR_KEYS).reduce(function(acc, key) { var value = t.VISITOR_KEYS[key]; @@ -120,7 +121,7 @@ function monkeypatch(modules) { // others typeAnnotation: { type: "typeAnnotation" }, typeParameters: { type: "typeParameters" }, - id: { type: "id" } + id: { type: "id" }, }; function visitTypeAnnotation(node) { @@ -182,7 +183,13 @@ function monkeypatch(modules) { function nestTypeParamScope(manager, node) { var parentScope = manager.__currentScope; - var scope = new escope.Scope(manager, "type-parameters", parentScope, node, false); + var scope = new escope.Scope( + manager, + "type-parameters", + parentScope, + node, + false + ); manager.__nestScope(scope); for (var j = 0; j < node.typeParameters.params.length; j++) { var name = node.typeParameters.params[j]; @@ -296,16 +303,10 @@ function monkeypatch(modules) { variableDeclaration.call(this, node); }; - function createScopeVariable (node, name) { - this.currentScope().variableScope.__define(name, - new Definition( - "Variable", - name, - node, - null, - null, - null - ) + function createScopeVariable(node, name) { + this.currentScope().variableScope.__define( + name, + new Definition("Variable", name, node, null, null, null) ); } @@ -339,10 +340,9 @@ function monkeypatch(modules) { } }; - referencer.prototype.DeclareModule = - referencer.prototype.DeclareFunction = - referencer.prototype.DeclareVariable = - referencer.prototype.DeclareClass = function(node) { + referencer.prototype.DeclareModule = referencer.prototype.DeclareFunction = referencer.prototype.DeclareVariable = referencer.prototype.DeclareClass = function( + node + ) { if (node.id) { createScopeVariable.call(this, node, node.id); } @@ -357,11 +357,13 @@ function monkeypatch(modules) { }; } -exports.parse = function (code, options) { +exports.parse = function(code, options) { options = options || {}; eslintOptions.ecmaVersion = options.ecmaVersion = options.ecmaVersion || 6; - eslintOptions.sourceType = options.sourceType = options.sourceType || "module"; - eslintOptions.allowImportExportEverywhere = options.allowImportExportEverywhere = options.allowImportExportEverywhere || false; + eslintOptions.sourceType = options.sourceType = + options.sourceType || "module"; + eslintOptions.allowImportExportEverywhere = options.allowImportExportEverywhere = + options.allowImportExportEverywhere || false; if (options.sourceType === "module") { eslintOptions.globalReturn = false; } else { @@ -381,7 +383,7 @@ exports.parse = function (code, options) { return exports.parseNoPatch(code, options); }; -exports.parseNoPatch = function (code, options) { +exports.parseNoPatch = function(code, options) { var opts = { codeFrame: options.hasOwnProperty("codeFrame") ? options.codeFrame : true, sourceType: options.sourceType, @@ -410,7 +412,7 @@ exports.parseNoPatch = function (code, options) { "optionalChaining", "importMeta", "classPrivateProperties", - ] + ], }; var ast; @@ -418,7 +420,6 @@ exports.parseNoPatch = function (code, options) { ast = parse(code, opts); } catch (err) { if (err instanceof SyntaxError) { - err.lineNumber = err.loc.line; err.column = err.loc.column; @@ -427,15 +428,23 @@ exports.parseNoPatch = function (code, options) { err.column = err.loc.column + 1; // remove trailing "(LINE:COLUMN)" acorn message and add in esprima syntax error message start - err.message = "Line " + err.lineNumber + ": " + err.message.replace(/ \((\d+):(\d+)\)$/, "") + - // add codeframe - "\n\n" + - codeFrameColumns(code, { - start: { - line: err.lineNumber, - column: err.column, - }, - }, { highlightCode: true }); + err.message = + "Line " + + err.lineNumber + + ": " + + err.message.replace(/ \((\d+):(\d+)\)$/, "") + + // add codeframe + "\n\n" + + codeFrameColumns( + code, + { + start: { + line: err.lineNumber, + column: err.column, + }, + }, + { highlightCode: true } + ); } } diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 2f4ddc905d50..90eb98e74e7b 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -22,6 +22,7 @@ "test-only": "mocha", "lint": "eslint index.js babylon-to-espree test", "fix": "eslint index.js babylon-to-espree test --fix", + "precommit": "lint-staged", "preversion": "npm test", "changelog": "git log `git describe --tags --abbrev=0`..HEAD --pretty=format:' * %s (%an)' | grep -v 'Merge pull request'" }, @@ -38,9 +39,19 @@ "babel-eslint": "^7.0.0", "dedent": "^0.7.0", "eslint": "^3.18.0", - "eslint-config-babel": "^6.0.0", + "eslint-config-babel": "^7.0.1", "eslint-plugin-flowtype": "^2.30.3", + "eslint-plugin-prettier": "^2.1.2", "espree": "^3.4.0", - "mocha": "^3.0.0" + "husky": "^0.13.2", + "lint-staged": "^3.6.1", + "mocha": "^3.0.0", + "prettier": "1.4.4" + }, + "lint-staged": { + "*.js": [ + "eslint --format=codeframe --fix", + "git add" + ] } } diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 31d3918c54b8..2ac2d3af581a 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -1,9 +1,9 @@ -var assert = require("assert"); +var assert = require("assert"); var babelEslint = require(".."); -var espree = require("espree"); -var escope = require("escope"); -var util = require("util"); -var unpad = require("dedent"); +var espree = require("espree"); +var escope = require("escope"); +var util = require("util"); +var unpad = require("dedent"); // Checks if the source ast implements the target ast. Ignores extra keys on source ast function assertImplementsAST(target, source, path) { @@ -20,9 +20,18 @@ function assertImplementsAST(target, source, path) { var typeA = target === null ? "null" : typeof target; var typeB = source === null ? "null" : typeof source; if (typeA !== typeB) { - error(`have different types (${typeA} !== ${typeB}) (${target} !== ${source})`); - } else if (typeA === "object" && ["RegExp"].indexOf(target.constructor.name) !== -1 && target.constructor.name !== source.constructor.name) { - error(`object have different constructors (${target.constructor.name} !== ${source.constructor.name}`); + error( + `have different types (${typeA} !== ${typeB}) (${target} !== ${source})` + ); + } else if ( + typeA === "object" && + ["RegExp"].indexOf(target.constructor.name) !== -1 && + target.constructor.name !== source.constructor.name + ) { + error( + `object have different constructors (${target.constructor + .name} !== ${source.constructor.name}` + ); } else if (typeA === "object") { var keysTarget = Object.keys(target); for (var i in keysTarget) { @@ -32,28 +41,36 @@ function assertImplementsAST(target, source, path) { path.pop(); } } else if (target !== source) { - error(`are different (${JSON.stringify(target)} !== ${JSON.stringify(source)})`); + error( + `are different (${JSON.stringify(target)} !== ${JSON.stringify(source)})` + ); } } function lookup(obj, keypath, backwardsDepth) { - if (!keypath) { return obj; } + if (!keypath) { + return obj; + } - return keypath.split(".").slice(0, -1 * backwardsDepth) - .reduce((base, segment) => { return base && base[segment], obj; }); + return keypath + .split(".") + .slice(0, -1 * backwardsDepth) + .reduce((base, segment) => { + return base && base[segment], obj; + }); } function parseAndAssertSame(code) { var esAST = espree.parse(code, { ecmaFeatures: { - // enable JSX parsing + // enable JSX parsing jsx: true, - // enable return in global scope + // enable return in global scope globalReturn: true, - // enable implied strict mode (if ecmaVersion >= 5) + // enable implied strict mode (if ecmaVersion >= 5) impliedStrict: true, - // allow experimental object rest/spread - experimentalObjectRestSpread: true + // allow experimental object rest/spread + experimentalObjectRestSpread: true, }, tokens: true, loc: true, @@ -61,7 +78,7 @@ function parseAndAssertSame(code) { comment: true, attachComment: true, ecmaVersion: 8, - sourceType: "module" + sourceType: "module", }); var babylonAST = babelEslint.parse(code); try { @@ -76,9 +93,15 @@ function parseAndAssertSame(code) { } err.message += unpad(` espree: - ${util.inspect(lookup(esAST, traversal, 2), { depth: err.depth, colors: true })} + ${util.inspect(lookup(esAST, traversal, 2), { + depth: err.depth, + colors: true, + })} babel-eslint: - ${util.inspect(lookup(babylonAST, traversal, 2), { depth: err.depth, colors: true })} + ${util.inspect(lookup(babylonAST, traversal, 2), { + depth: err.depth, + colors: true, + })} `); throw err; } @@ -90,9 +113,13 @@ describe("babylon-to-esprima", () => { it("should allow ast.analyze to be called without options", function() { var esAST = babelEslint.parse("`test`"); - assert.doesNotThrow(() => { - escope.analyze(esAST); - }, TypeError, "Should allow no options argument."); + assert.doesNotThrow( + () => { + escope.analyze(esAST); + }, + TypeError, + "Should allow no options argument." + ); }); }); @@ -138,11 +165,15 @@ describe("babylon-to-esprima", () => { }); it("template with nested function/object", () => { - parseAndAssertSame("`outer${{x: {y: 10}}}bar${`nested${function(){return 1;}}endnest`}end`"); + parseAndAssertSame( + "`outer${{x: {y: 10}}}bar${`nested${function(){return 1;}}endnest`}end`" + ); }); it("template with braces inside and outside of template string #96", () => { - parseAndAssertSame("if (a) { var target = `{}a:${webpackPort}{}}}}`; } else { app.use(); }"); + parseAndAssertSame( + "if (a) { var target = `{}a:${webpackPort}{}}}}`; } else { app.use(); }" + ); }); it("template also with braces #96", () => { @@ -218,19 +249,19 @@ describe("babylon-to-esprima", () => { }); it("default import", () => { - parseAndAssertSame("import foo from \"foo\";"); + parseAndAssertSame('import foo from "foo";'); }); it("import specifier", () => { - parseAndAssertSame("import { foo } from \"foo\";"); + parseAndAssertSame('import { foo } from "foo";'); }); it("import specifier with name", () => { - parseAndAssertSame("import { foo as bar } from \"foo\";"); + parseAndAssertSame('import { foo as bar } from "foo";'); }); it("import bare", () => { - parseAndAssertSame("import \"foo\";"); + parseAndAssertSame('import "foo";'); }); it("export default class declaration", () => { @@ -250,7 +281,7 @@ describe("babylon-to-esprima", () => { }); it("export all", () => { - parseAndAssertSame("export * from \"foo\";"); + parseAndAssertSame('export * from "foo";'); }); it("export named", () => { @@ -331,11 +362,11 @@ describe("babylon-to-esprima", () => { }); it("regexp in a template string", () => { - parseAndAssertSame("`${/\\d/.exec(\"1\")[0]}`"); + parseAndAssertSame('`${/\\d/.exec("1")[0]}`'); }); it("first line is empty", () => { - parseAndAssertSame("\nimport Immutable from \"immutable\";"); + parseAndAssertSame('\nimport Immutable from "immutable";'); }); it("empty", () => { @@ -383,7 +414,9 @@ describe("babylon-to-esprima", () => { }); it("MethodDefinition 2", () => { - parseAndAssertSame("export default class Bar { get bar() { return 42; }}"); + parseAndAssertSame( + "export default class Bar { get bar() { return 42; }}" + ); }); it("ClassMethod", () => { @@ -443,7 +476,7 @@ describe("babylon-to-esprima", () => { it("do not allow import export everywhere", () => { assert.throws(() => { - parseAndAssertSame("function F() { import a from \"a\"; }"); + parseAndAssertSame('function F() { import a from "a"; }'); }, /SyntaxError: 'import' and 'export' may only appear at the top level/); }); diff --git a/eslint/babel-eslint-parser/test/integration.js b/eslint/babel-eslint-parser/test/integration.js index c446ed342815..8e93631a5aae 100644 --- a/eslint/babel-eslint-parser/test/integration.js +++ b/eslint/babel-eslint-parser/test/integration.js @@ -13,8 +13,8 @@ var errorLevel = 2; var baseEslintOpts = { parser: require.resolve(".."), parserOptions: { - sourceType: "script" - } + sourceType: "script", + }, }; /** @@ -23,7 +23,7 @@ var baseEslintOpts = { * @param object opts * @param function done */ -function lint (opts, done) { +function lint(opts, done) { readFixture(opts.fixture, (err, src) => { if (err) return done(err); done(null, eslint.linter.verify(src, opts.eslint)); @@ -35,14 +35,10 @@ function lint (opts, done) { * @param string|array id * @param function done */ -function readFixture (id, done) { +function readFixture(id, done) { if (Array.isArray(id)) id = path.join.apply(path, id); if (!path.extname(id)) id += ".js"; - fs.readFile( - path.join(paths.fixtures, id), - encoding, - done - ); + fs.readFile(path.join(paths.fixtures, id), encoding, done); } // readFixture @@ -51,7 +47,7 @@ describe("Rules:", () => { }); // describe -function strictSuite () { +function strictSuite() { var ruleId = "strict"; describe("when set to 'never'", () => { @@ -60,19 +56,20 @@ function strictSuite () { }); eslintOpts.rules[ruleId] = [errorLevel, "never"]; - ["global-with", "function-with"].forEach((fixture) => { - it(`should error on ${fixture.match(/^[^-]+/)[0]} directive`, - (done) => { - lint({ + ["global-with", "function-with"].forEach(fixture => { + it(`should error on ${fixture.match(/^[^-]+/)[0]} directive`, done => { + lint( + { fixture: ["strict", fixture], eslint: eslintOpts, - }, (err, report) => { + }, + (err, report) => { if (err) return done(err); assert(report[0].ruleId === ruleId); done(); - }); - } - ); + } + ); + }); // it }); }); @@ -80,63 +77,75 @@ function strictSuite () { describe("when set to 'global'", () => { var eslintOpts = Object.assign({}, baseEslintOpts, { - rules: {} + rules: {}, }); eslintOpts.rules[ruleId] = [errorLevel, "global"]; - it("shouldn't error on single global directive", (done) => { - lint({ - fixture: ["strict", "global-with"], - eslint: eslintOpts, - }, (err, report) => { - if (err) return done(err); - assert(!report.length); - done(); - }); + it("shouldn't error on single global directive", done => { + lint( + { + fixture: ["strict", "global-with"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + assert(!report.length); + done(); + } + ); }); // it - it("should error twice on global directive: no and function directive: yes", (done) => { - lint({ - fixture: ["strict", "function-with"], - eslint: eslintOpts, - }, (err, report) => { - if (err) return done(err); - [0, 1].forEach((i) => { - assert(report[i].ruleId === ruleId); - }); - done(); - }); + it("should error twice on global directive: no and function directive: yes", done => { + lint( + { + fixture: ["strict", "function-with"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + [0, 1].forEach(i => { + assert(report[i].ruleId === ruleId); + }); + done(); + } + ); }); // it - it("should error on function directive", (done) => { - lint({ - fixture: ["strict", "global-with-function-with"], - eslint: eslintOpts, - }, (err, report) => { - if (err) return done(err); - assert(report[0].ruleId === ruleId); - - // This is to make sure the test fails prior to adapting Babel AST - // directive representation to ESLint format. Otherwise it reports an - // error for missing global directive that masquerades as the expected - // result of the previous assertion. - assert(report[0].nodeType !== "Program"); - done(); - }); + it("should error on function directive", done => { + lint( + { + fixture: ["strict", "global-with-function-with"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + assert(report[0].ruleId === ruleId); + + // This is to make sure the test fails prior to adapting Babel AST + // directive representation to ESLint format. Otherwise it reports an + // error for missing global directive that masquerades as the expected + // result of the previous assertion. + assert(report[0].nodeType !== "Program"); + done(); + } + ); }); // it - it("should error on no directive", (done) => { - lint({ - fixture: ["strict", "none"], - eslint: eslintOpts, - }, (err, report) => { - if (err) return done(err); - assert(report[0].ruleId === ruleId); - done(); - }); + it("should error on no directive", done => { + lint( + { + fixture: ["strict", "none"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + assert(report[0].ruleId === ruleId); + done(); + } + ); }); // it }); @@ -144,108 +153,130 @@ function strictSuite () { describe("when set to 'function'", () => { var eslintOpts = Object.assign({}, baseEslintOpts, { - rules: {} + rules: {}, }); eslintOpts.rules[ruleId] = [errorLevel, "function"]; - it("shouldn't error on single function directive", (done) => { - lint({ - fixture: ["strict", "function-with"], - eslint: eslintOpts, - }, (err, report) => { - if (err) return done(err); - assert(!report.length); - done(); - }); + it("shouldn't error on single function directive", done => { + lint( + { + fixture: ["strict", "function-with"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + assert(!report.length); + done(); + } + ); }); // it - it("should error twice on function directive: no and global directive: yes", (done) => { - lint({ - fixture: ["strict", "global-with-function-without"], - eslint: eslintOpts, - }, (err, report) => { - if (err) return done(err); - [0, 1].forEach((i) => { - assert(report[i].ruleId === ruleId); - }); - done(); - }); + it("should error twice on function directive: no and global directive: yes", done => { + lint( + { + fixture: ["strict", "global-with-function-without"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + [0, 1].forEach(i => { + assert(report[i].ruleId === ruleId); + }); + done(); + } + ); }); // it - it("should error on only global directive", (done) => { - lint({ - fixture: ["strict", "global-with"], - eslint: eslintOpts, - }, (err, report) => { - if (err) return done(err); - assert(report[0].ruleId === ruleId); - done(); - }); + it("should error on only global directive", done => { + lint( + { + fixture: ["strict", "global-with"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + assert(report[0].ruleId === ruleId); + done(); + } + ); }); // it - it("should error on extraneous global directive", (done) => { - lint({ - fixture: ["strict", "global-with-function-with"], - eslint: eslintOpts, - }, (err, report) => { - if (err) return done(err); - assert(report[0].ruleId === ruleId); - assert(report[0].nodeType.indexOf("Function") === -1); - done(); - }); + it("should error on extraneous global directive", done => { + lint( + { + fixture: ["strict", "global-with-function-with"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + assert(report[0].ruleId === ruleId); + assert(report[0].nodeType.indexOf("Function") === -1); + done(); + } + ); }); // it }); // describe - describe("When \"codeFrame\"", () => { + describe('When "codeFrame"', () => { // Strip chalk colors, these are not relevant for the test - const stripAnsi = (str) => str.replace( - /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, - "" - ); - - it("should display codeFrame when option is absent", (done) => { - lint({ - fixture: ["syntax-error"], - eslint: baseEslintOpts - }, (err, report) => { - if (err) return done(err); - assert(stripAnsi(report[0].message).indexOf("^\n 5 |") > -1); - done(); - }); + const stripAnsi = str => + str.replace( + /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, + "" + ); + + it("should display codeFrame when option is absent", done => { + lint( + { + fixture: ["syntax-error"], + eslint: baseEslintOpts, + }, + (err, report) => { + if (err) return done(err); + assert(stripAnsi(report[0].message).indexOf("^\n 5 |") > -1); + done(); + } + ); }); - it("should display codeFrame when option is true", (done) => { - lint({ - fixture: ["syntax-error"], - eslint: Object.assign({}, baseEslintOpts, { - parserOptions: { - codeFrame: true - } - }) - }, (err, report) => { - if (err) return done(err); - assert(stripAnsi(report[0].message).indexOf("^\n 5 |") > -1); - done(); - }); + it("should display codeFrame when option is true", done => { + lint( + { + fixture: ["syntax-error"], + eslint: Object.assign({}, baseEslintOpts, { + parserOptions: { + codeFrame: true, + }, + }), + }, + (err, report) => { + if (err) return done(err); + assert(stripAnsi(report[0].message).indexOf("^\n 5 |") > -1); + done(); + } + ); }); - it("should not display codeFrame when option is false", (done) => { - lint({ - fixture: ["syntax-error"], - eslint: Object.assign({}, baseEslintOpts, { - parserOptions: { - codeFrame: false - } - }) - }, (err, report) => { - if (err) return done(err); - assert(stripAnsi(report[0].message).indexOf("^\n 5 |") === -1); - done(); - }); + it("should not display codeFrame when option is false", done => { + lint( + { + fixture: ["syntax-error"], + eslint: Object.assign({}, baseEslintOpts, { + parserOptions: { + codeFrame: false, + }, + }), + }, + (err, report) => { + if (err) return done(err); + assert(stripAnsi(report[0].message).indexOf("^\n 5 |") === -1); + done(); + } + ); }); }); } diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 26bf95af3d43..f382801f229d 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -3,23 +3,29 @@ var eslint = require("eslint"); var unpad = require("dedent"); -function verifyAndAssertMessages(code, rules, expectedMessages, sourceType, overrideConfig) { +function verifyAndAssertMessages( + code, + rules, + expectedMessages, + sourceType, + overrideConfig +) { var config = { parser: require.resolve(".."), rules, env: { node: true, - es6: true + es6: true, }, parserOptions: { ecmaVersion: 8, ecmaFeatures: { jsx: true, experimentalObjectRestSpread: true, - globalReturn: true + globalReturn: true, }, - sourceType - } + sourceType, + }, }; if (overrideConfig) { @@ -31,11 +37,19 @@ function verifyAndAssertMessages(code, rules, expectedMessages, sourceType, over var messages = eslint.linter.verify(code, config); if (messages.length !== expectedMessages.length) { - throw new Error(`Expected ${expectedMessages.length} message(s), got ${messages.length}\n${JSON.stringify(messages, null, 2)}`); + throw new Error( + `Expected ${expectedMessages.length} message(s), got ${messages.length}\n${JSON.stringify( + messages, + null, + 2 + )}` + ); } messages.forEach((message, i) => { - var formatedMessage = `${message.line}:${message.column} ${message.message}${(message.ruleId ? ` ${message.ruleId}` : "")}`; + var formatedMessage = `${message.line}:${message.column} ${message.message}${message.ruleId + ? ` ${message.ruleId}` + : ""}`; if (formatedMessage !== expectedMessages[i]) { throw new Error( unpad(` @@ -50,27 +64,21 @@ function verifyAndAssertMessages(code, rules, expectedMessages, sourceType, over describe("verify", () => { it("arrow function support (issue #1)", () => { - verifyAndAssertMessages( - "describe('stuff', () => {});", - {}, - [] - ); + verifyAndAssertMessages("describe('stuff', () => {});", {}, []); }); it("EOL validation (issue #2)", () => { verifyAndAssertMessages( - "module.exports = \"something\";", - { "eol-last": 1, "semi": 1 }, - [ "1:30 Newline required at end of file but not found. eol-last" ] + 'module.exports = "something";', + { "eol-last": 1, semi: 1 }, + ["1:30 Newline required at end of file but not found. eol-last"] ); }); xit("Readable error messages (issue #3)", () => { - verifyAndAssertMessages( - "{ , res }", - {}, - [ "1:3 Parsing error: Unexpected token" ] - ); + verifyAndAssertMessages("{ , res }", {}, [ + "1:3 Parsing error: Unexpected token", + ]); }); it("Modules support (issue #5)", () => { @@ -120,7 +128,7 @@ describe("verify", () => { it("JSX attribute names marked as variables (issue #12)", () => { verifyAndAssertMessages( - "module.exports =
", + 'module.exports =
', { "no-undef": 1 }, [] ); @@ -136,8 +144,8 @@ describe("verify", () => { it("Arrow function with non-block bodies (issue #20)", () => { verifyAndAssertMessages( - "\"use strict\"; () => 1", - { "strict": [1, "global"] }, + '"use strict"; () => 1', + { strict: [1, "global"] }, [], "script" ); @@ -145,7 +153,7 @@ describe("verify", () => { it("#242", () => { verifyAndAssertMessages( - "\"use strict\"; asdf;", + '"use strict"; asdf;', { "no-irregular-whitespace": 1 }, [], {} @@ -191,19 +199,11 @@ describe("verify", () => { }); it("type alias", () => { - verifyAndAssertMessages( - "type SomeNewType = any;", - { "no-undef": 1 }, - [] - ); + verifyAndAssertMessages("type SomeNewType = any;", { "no-undef": 1 }, []); }); it("type cast expression #102", () => { - verifyAndAssertMessages( - "for (let a of (a: Array)) {}", - {}, - [] - ); + verifyAndAssertMessages("for (let a of (a: Array)) {}", {}, []); }); it("multiple nullable type annotations and return #108", () => { @@ -231,7 +231,7 @@ describe("verify", () => { }; `), { "no-unused-vars": 1, "no-undef": 1 }, - [ "2:11 'Bar' is defined but never used. no-unused-vars" ] + ["2:11 'Bar' is defined but never used. no-unused-vars"] ); }); @@ -246,7 +246,7 @@ describe("verify", () => { new Log(); `), { "no-unused-vars": 1, "no-undef": 1 }, - [ "3:34 'T4' is defined but never used. no-unused-vars" ] + ["3:34 'T4' is defined but never used. no-unused-vars"] ); }); @@ -259,9 +259,11 @@ describe("verify", () => { new Foo(); `), { "no-unused-vars": 1, "no-undef": 1 }, - [ "1:1 'T' is not defined. no-undef", + [ + "1:1 'T' is not defined. no-undef", "2:11 'T' is defined but never used. no-unused-vars", - "3:1 'T' is not defined. no-undef" ] + "3:1 'T' is not defined. no-undef", + ] ); }); @@ -274,8 +276,10 @@ describe("verify", () => { } `), { "no-unused-vars": 1, "no-undef": 1 }, - [ "2:11 'Log' is defined but never used. no-unused-vars", - "2:38 'T4' is defined but never used. no-unused-vars" ] + [ + "2:11 'Log' is defined but never used. no-unused-vars", + "2:38 'T4' is defined but never used. no-unused-vars", + ] ); }); @@ -288,9 +292,11 @@ describe("verify", () => { Foo; `), { "no-unused-vars": 1, "no-undef": 1 }, - [ "1:1 'T' is not defined. no-undef", + [ + "1:1 'T' is not defined. no-undef", "2:15 'T' is defined but never used. no-unused-vars", - "3:1 'T' is not defined. no-undef" ] + "3:1 'T' is not defined. no-undef", + ] ); }); @@ -304,8 +310,10 @@ describe("verify", () => { }; `), { "no-unused-vars": 1, "no-undef": 1 }, - [ "2:6 'Log' is defined but never used. no-unused-vars", - "2:29 'T3' is defined but never used. no-unused-vars" ] + [ + "2:6 'Log' is defined but never used. no-unused-vars", + "2:29 'T3' is defined but never used. no-unused-vars", + ] ); }); @@ -318,9 +326,11 @@ describe("verify", () => { Foo; `), { "no-unused-vars": 1, "no-undef": 1 }, - [ "1:1 'T' is not defined. no-undef", + [ + "1:1 'T' is not defined. no-undef", "2:10 'T' is defined but never used. no-unused-vars", - "3:1 'T' is not defined. no-undef" ] + "3:1 'T' is not defined. no-undef", + ] ); }); @@ -333,7 +343,7 @@ describe("verify", () => { log(1, 2); `), { "no-unused-vars": 1, "no-undef": 1 }, - [ "3:37 'T4' is defined but never used. no-unused-vars" ] + ["3:37 'T4' is defined but never used. no-unused-vars"] ); }); @@ -346,9 +356,11 @@ describe("verify", () => { log; `), { "no-unused-vars": 1, "no-undef": 1 }, - [ "1:1 'T' is not defined. no-undef", + [ + "1:1 'T' is not defined. no-undef", "2:14 'T' is defined but never used. no-unused-vars", - "3:1 'T' is not defined. no-undef" ] + "3:1 'T' is not defined. no-undef", + ] ); }); @@ -544,8 +556,10 @@ describe("verify", () => { var b: T = 1; b; `), { "no-unused-vars": 1, "no-undef": 1 }, - [ "1:21 'T' is defined but never used. no-unused-vars", - "2:8 'T' is not defined. no-undef" ] + [ + "1:21 'T' is defined but never used. no-unused-vars", + "2:8 'T' is not defined. no-undef", + ] ); }); @@ -556,7 +570,7 @@ describe("verify", () => { export class Foo extends Bar {} `), { "no-unused-vars": 1, "no-undef": 1 }, - [ "2:30 'T' is not defined. no-undef" ] + ["2:30 'T' is not defined. no-undef"] ); }); @@ -581,8 +595,10 @@ describe("verify", () => { type T = {a: number, ...U, ...V}; `), { "no-undef": 1, "no-unused-vars": 1 }, - [ "2:6 'T' is defined but never used. no-unused-vars", - "2:31 'V' is not defined. no-undef" ] + [ + "2:6 'T' is defined but never used. no-unused-vars", + "2:31 'V' is not defined. no-undef", + ] ); }); @@ -1289,11 +1305,9 @@ describe("verify", () => { }); it("detects minimal no-unused-vars case #120", () => { - verifyAndAssertMessages( - "var unused;", - { "no-unused-vars": 1 }, - [ "1:5 'unused' is defined but never used. no-unused-vars" ] - ); + verifyAndAssertMessages("var unused;", { "no-unused-vars": 1 }, [ + "1:5 'unused' is defined but never used. no-unused-vars", + ]); }); // This two tests are disabled, as the feature to visit properties when @@ -1343,7 +1357,7 @@ describe("verify", () => { verifyAndAssertMessages( "const {Bacona} = require('baconjs')", { "no-undef": 1, "no-unused-vars": 1 }, - [ "1:8 'Bacona' is assigned a value but never used. no-unused-vars" ] + ["1:8 'Bacona' is assigned a value but never used. no-unused-vars"] ); }); @@ -1389,7 +1403,7 @@ describe("verify", () => { it("ternary and parens #149", () => { verifyAndAssertMessages( - "true ? (true) : false;", + "true ? (true) : false;", { "space-infix-ops": 1 }, [] ); @@ -1407,7 +1421,7 @@ describe("verify", () => { }); `), { "space-in-parens": 1 }, - [ ] + [] ); }); @@ -1425,21 +1439,23 @@ describe("verify", () => { }); `), { "space-in-parens": 1 }, - [ ] + [] ); }); it("no no-undef error with rest #11", () => { - verifyAndAssertMessages("const [a, ...rest] = ['1', '2', '3']; a; rest;", + verifyAndAssertMessages( + "const [a, ...rest] = ['1', '2', '3']; a; rest;", { "no-undef": 1, "no-unused-vars": 1 }, - [ ] + [] ); }); it("async function with space-before-function-paren #168", () => { - verifyAndAssertMessages("it('handles updates', async function() {});", + verifyAndAssertMessages( + "it('handles updates', async function() {});", { "space-before-function-paren": [1, "never"] }, - [ ] + [] ); }); @@ -1458,7 +1474,7 @@ describe("verify", () => { } `), { "no-unused-vars": 1, "no-undef": 1 }, - [ ] + [] ); }); @@ -1469,16 +1485,12 @@ describe("verify", () => { var x = 1; `), { "no-use-before-define": 1 }, - [ "1:13 'x' was used before it was defined. no-use-before-define" ] + ["1:13 'x' was used before it was defined. no-use-before-define"] ); }); it("jsx and stringliteral #216", () => { - verifyAndAssertMessages( - "
", - {}, - [] - ); + verifyAndAssertMessages("
", {}, []); }); it("getter/setter #218", () => { @@ -1488,7 +1500,11 @@ describe("verify", () => { set a (v) { } } `), - { "space-before-function-paren": 1, "keyword-spacing": [1, { "before": true }], "indent": 1 }, + { + "space-before-function-paren": 1, + "keyword-spacing": [1, { before: true }], + indent: 1, + }, [] ); }); @@ -1531,7 +1547,7 @@ describe("verify", () => { var a = 123; `), { "no-redeclare": 1 }, - [ "2:5 'a' is already defined. no-redeclare" ], + ["2:5 'a' is already defined. no-redeclare"], "script" ); }); @@ -1543,7 +1559,7 @@ describe("verify", () => { var a = 123; `), { "no-redeclare": 1 }, - [ "2:5 'a' is already defined. no-redeclare" ], + ["2:5 'a' is already defined. no-redeclare"], "module" ); }); @@ -1552,11 +1568,13 @@ describe("verify", () => { verifyAndAssertMessages( "var leakedGlobal = 1;", { "no-implicit-globals": 1 }, - [ "1:5 Implicit global variable, assign as global property instead. no-implicit-globals" ], + [ + "1:5 Implicit global variable, assign as global property instead. no-implicit-globals", + ], "script", { env: {}, - parserOptions: { ecmaVersion: 6, sourceType: "script" } + parserOptions: { ecmaVersion: 6, sourceType: "script" }, } ); }); @@ -1569,7 +1587,7 @@ describe("verify", () => { "module", { env: {}, - parserOptions: { ecmaVersion: 6, sourceType: "module" } + parserOptions: { ecmaVersion: 6, sourceType: "module" }, } ); }); @@ -1582,7 +1600,7 @@ describe("verify", () => { null, { env: {}, - parserOptions: { ecmaVersion: 6 } + parserOptions: { ecmaVersion: 6 }, } ); }); @@ -1599,26 +1617,23 @@ describe("verify", () => { "module", { env: {}, - parserOptions: { ecmaVersion: 6, sourceType: "module", allowImportExportEverywhere: true } + parserOptions: { + ecmaVersion: 6, + sourceType: "module", + allowImportExportEverywhere: true, + }, } ); }); it("with does not crash parsing in script mode (strict off) #171", () => { - verifyAndAssertMessages( - "with (arguments) { length; }", - {}, - [], - "script" - ); + verifyAndAssertMessages("with (arguments) { length; }", {}, [], "script"); }); xit("with does crash parsing in module mode (strict on) #171", () => { - verifyAndAssertMessages( - "with (arguments) { length; }", - {}, - [ "1:1 Parsing error: 'with' in strict mode" ] - ); + verifyAndAssertMessages("with (arguments) { length; }", {}, [ + "1:1 Parsing error: 'with' in strict mode", + ]); }); it("new.target is not reported as undef #235", () => { @@ -1638,7 +1653,7 @@ describe("verify", () => { } `), { "no-undef": 1 }, - [ "2:4 'test' is not defined. no-undef" ] + ["2:4 'test' is not defined. no-undef"] ); }); @@ -1723,24 +1738,18 @@ describe("verify", () => { new A `), { "no-undef": 1, "no-unused-vars": 1, "no-redeclare": 1 }, - [ - "5:11 'b' is not defined. no-undef" - ] + ["5:11 'b' is not defined. no-undef"] ); }); }); it("dynamic import support", () => { - verifyAndAssertMessages( - "import('test-module').then(() => {})", - {}, - [] - ); + verifyAndAssertMessages("import('test-module').then(() => {})", {}, []); }); it("regex with es6 unicodeCodePointEscapes", () => { verifyAndAssertMessages( - "string.replace(/[\u{0000A0}-\u{10FFFF}<>\&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`);", + "string.replace(/[\u{0000A0}-\u{10FFFF}<>&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`);", {}, [] ); diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index 134eda3e5602..e2c20316226a 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -27,7 +27,7 @@ ajv@^4.7.0: co "^4.6.0" json-stable-stringify "^1.0.1" -ansi-escapes@^1.1.0: +ansi-escapes@^1.0.0, ansi-escapes@^1.1.0: version "1.4.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" @@ -39,6 +39,10 @@ ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" +app-root-path@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/app-root-path/-/app-root-path-2.0.1.tgz#cd62dcf8e4fd5a417efc664d2e5b10653c651b46" + argparse@^1.0.7: version "1.0.9" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86" @@ -259,16 +263,31 @@ chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" +ci-info@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.0.0.tgz#dc5285f2b4e251821683681c381c3388f46ec534" + circular-json@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.1.tgz#be8b36aefccde8b3ca7aa2d6afc07a37242c0d2d" -cli-cursor@^1.0.1: +cli-cursor@^1.0.1, cli-cursor@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-1.0.2.tgz#64da3f7d56a54412e59794bd62dc35295e8f2987" dependencies: restore-cursor "^1.0.1" +cli-spinners@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-0.1.2.tgz#bb764d88e185fb9e1e6a2a1f19772318f605e31c" + +cli-truncate@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/cli-truncate/-/cli-truncate-0.2.1.tgz#9f15cfbb0705005369216c626ac7d05ab90dd574" + dependencies: + slice-ansi "0.0.4" + string-width "^1.0.1" + cli-width@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.1.0.tgz#b234ca209b29ef66fc518d9b98d5847b00edf00a" @@ -281,7 +300,7 @@ code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" -commander@2.9.0: +commander@2.9.0, commander@^2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" dependencies: @@ -307,12 +326,37 @@ core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" +cosmiconfig@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-1.1.0.tgz#0dea0f9804efdfb929fbb1b188e25553ea053d37" + dependencies: + graceful-fs "^4.1.2" + js-yaml "^3.4.3" + minimist "^1.2.0" + object-assign "^4.0.1" + os-homedir "^1.0.1" + parse-json "^2.2.0" + pinkie-promise "^2.0.0" + require-from-string "^1.1.0" + +cross-spawn@^5.0.1: + version "5.1.0" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" + dependencies: + lru-cache "^4.0.1" + shebang-command "^1.2.0" + which "^1.2.9" + d@1: version "1.0.0" resolved "https://registry.yarnpkg.com/d/-/d-1.0.0.tgz#754bb5bfe55451da69a58b94d45f4c5b0462d58f" dependencies: es5-ext "^0.10.9" +date-fns@^1.27.2: + version "1.28.5" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.28.5.tgz#257cfc45d322df45ef5658665967ee841cd73faf" + debug@2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/debug/-/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da" @@ -356,6 +400,16 @@ doctrine@^2.0.0: esutils "^2.0.2" isarray "^1.0.0" +elegant-spinner@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/elegant-spinner/-/elegant-spinner-1.0.1.tgz#db043521c95d7e303fd8f345bedc3349cfb0729e" + +error-ex@^1.2.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.1.tgz#f855a86ce61adc4e8621c3cda21e7a7612c3a8dc" + dependencies: + is-arrayish "^0.2.1" + es5-ext@^0.10.14, es5-ext@^0.10.9, es5-ext@~0.10.14: version "0.10.15" resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.15.tgz#c330a5934c1ee21284a7c081a86e5fd937c91ea6" @@ -421,9 +475,9 @@ escope@^3.6.0: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-config-babel@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/eslint-config-babel/-/eslint-config-babel-6.0.0.tgz#66feedf6ce6e04abe585cec1a65b5bcc96bed50a" +eslint-config-babel@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/eslint-config-babel/-/eslint-config-babel-7.0.1.tgz#aac7b79f2f06f52358a5a764fdc01fde23718572" eslint-plugin-flowtype@^2.30.3: version "2.30.3" @@ -431,6 +485,13 @@ eslint-plugin-flowtype@^2.30.3: dependencies: lodash "^4.15.0" +eslint-plugin-prettier@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.1.2.tgz#4b90f4ee7f92bfbe2e926017e1ca40eb628965ea" + dependencies: + fast-diff "^1.1.1" + jest-docblock "^20.0.1" + eslint@^3.18.0: version "3.18.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.18.0.tgz#647e985c4ae71502d20ac62c109f66d5104c8a4b" @@ -514,15 +575,31 @@ event-emitter@~0.3.5: d "1" es5-ext "~0.10.14" +execa@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" + dependencies: + cross-spawn "^5.0.1" + get-stream "^3.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + exit-hook@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8" +fast-diff@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.1.1.tgz#0aea0e4e605b6a2189f0e936d4b7fbaf1b7cfd9b" + fast-levenshtein@~2.0.4: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" -figures@^1.3.5: +figures@^1.3.5, figures@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" dependencies: @@ -536,6 +613,10 @@ file-entry-cache@^2.0.0: flat-cache "^1.2.1" object-assign "^4.0.1" +find-parent-dir@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/find-parent-dir/-/find-parent-dir-0.3.0.tgz#33c44b429ab2b2f0646299c5f9f718f376ff8d54" + flat-cache@^1.2.1: version "1.2.2" resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.2.2.tgz#fa86714e72c21db88601761ecf2f555d1abc6b96" @@ -559,6 +640,10 @@ generate-object-property@^1.1.0: dependencies: is-property "^1.0.0" +get-stream@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" + glob@7.0.5: version "7.0.5" resolved "https://registry.yarnpkg.com/glob/-/glob-7.0.5.tgz#b4202a69099bbb4d292a7c1b95b6682b67ebdc95" @@ -618,6 +703,15 @@ has-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" +husky@^0.13.2: + version "0.13.4" + resolved "https://registry.yarnpkg.com/husky/-/husky-0.13.4.tgz#48785c5028de3452a51c48c12c4f94b2124a1407" + dependencies: + chalk "^1.1.3" + find-parent-dir "^0.3.0" + is-ci "^1.0.9" + normalize-path "^1.0.0" + ignore@^3.2.0: version "3.2.6" resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.2.6.tgz#26e8da0644be0bb4cb39516f6c79f0e0f4ffe48c" @@ -626,6 +720,16 @@ imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" +indent-string@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-2.1.0.tgz#8e2d48348742121b4a8218b7a137e9a52049dc80" + dependencies: + repeating "^2.0.0" + +indent-string@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-3.1.0.tgz#08ff4334603388399b329e6b9538dc7a3cf5de7d" + inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" @@ -665,6 +769,22 @@ invariant@^2.2.0: dependencies: loose-envify "^1.0.0" +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + +is-ci@^1.0.9: + version "1.0.10" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.0.10.tgz#f739336b2632365061a9d48270cd56ae3369318e" + dependencies: + ci-info "^1.0.0" + +is-finite@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" + dependencies: + number-is-nan "^1.0.0" + is-fullwidth-code-point@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" @@ -700,6 +820,10 @@ is-path-inside@^1.0.0: dependencies: path-is-inside "^1.0.1" +is-promise@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" + is-property@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" @@ -710,15 +834,27 @@ is-resolvable@^1.0.0: dependencies: tryit "^1.0.1" +is-stream@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + isarray@^1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + +jest-docblock@^20.0.1: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-20.0.3.tgz#17bea984342cc33d83c50fbe1545ea0efaa44712" + js-tokens@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7" -js-yaml@^3.5.1: +js-yaml@^3.4.3, js-yaml@^3.5.1: version "3.8.2" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.8.2.tgz#02d3e2c0f6beab20248d412c352203827d786721" dependencies: @@ -750,6 +886,67 @@ levn@^0.3.0, levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" +lint-staged@^3.6.1: + version "3.6.1" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-3.6.1.tgz#24423c8b7bd99d96e15acd1ac8cb392a78e58582" + dependencies: + app-root-path "^2.0.0" + cosmiconfig "^1.1.0" + execa "^0.7.0" + listr "^0.12.0" + lodash.chunk "^4.2.0" + minimatch "^3.0.0" + npm-which "^3.0.1" + p-map "^1.1.1" + staged-git-files "0.0.4" + +listr-silent-renderer@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/listr-silent-renderer/-/listr-silent-renderer-1.1.1.tgz#924b5a3757153770bf1a8e3fbf74b8bbf3f9242e" + +listr-update-renderer@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/listr-update-renderer/-/listr-update-renderer-0.2.0.tgz#ca80e1779b4e70266807e8eed1ad6abe398550f9" + dependencies: + chalk "^1.1.3" + cli-truncate "^0.2.1" + elegant-spinner "^1.0.1" + figures "^1.7.0" + indent-string "^3.0.0" + log-symbols "^1.0.2" + log-update "^1.0.2" + strip-ansi "^3.0.1" + +listr-verbose-renderer@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/listr-verbose-renderer/-/listr-verbose-renderer-0.4.0.tgz#44dc01bb0c34a03c572154d4d08cde9b1dc5620f" + dependencies: + chalk "^1.1.3" + cli-cursor "^1.0.2" + date-fns "^1.27.2" + figures "^1.7.0" + +listr@^0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/listr/-/listr-0.12.0.tgz#6bce2c0f5603fa49580ea17cd6a00cc0e5fa451a" + dependencies: + chalk "^1.1.3" + cli-truncate "^0.2.1" + figures "^1.7.0" + indent-string "^2.1.0" + is-promise "^2.1.0" + is-stream "^1.1.0" + listr-silent-renderer "^1.1.1" + listr-update-renderer "^0.2.0" + listr-verbose-renderer "^0.4.0" + log-symbols "^1.0.2" + log-update "^1.0.2" + ora "^0.2.3" + p-map "^1.1.1" + rxjs "^5.0.0-beta.11" + stream-to-observable "^0.1.0" + strip-ansi "^3.0.1" + lodash._baseassign@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz#8c38a099500f215ad09e59f1722fd0c52bfe0a4e" @@ -773,6 +970,10 @@ lodash._isiterateecall@^3.0.0: version "3.0.9" resolved "https://registry.yarnpkg.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz#5203ad7ba425fae842460e696db9cf3e6aac057c" +lodash.chunk@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/lodash.chunk/-/lodash.chunk-4.2.0.tgz#66e5ce1f76ed27b4303d8c6512e8d1216e8106bc" + lodash.create@3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/lodash.create/-/lodash.create-3.1.1.tgz#d7f2849f0dbda7e04682bb8cd72ab022461debe7" @@ -805,13 +1006,33 @@ lodash@^4.0.0, lodash@^4.15.0, lodash@^4.2.0, lodash@^4.3.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" +log-symbols@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-1.0.2.tgz#376ff7b58ea3086a0f09facc74617eca501e1a18" + dependencies: + chalk "^1.0.0" + +log-update@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/log-update/-/log-update-1.0.2.tgz#19929f64c4093d2d2e7075a1dad8af59c296b8d1" + dependencies: + ansi-escapes "^1.0.0" + cli-cursor "^1.0.2" + loose-envify@^1.0.0: version "1.3.1" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" dependencies: js-tokens "^3.0.0" -minimatch@^3.0.2: +lru-cache@^4.0.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.1.tgz#622e32e82488b49279114a4f9ecf45e7cd6bba55" + dependencies: + pseudomap "^1.0.2" + yallist "^2.1.2" + +minimatch@^3.0.0, minimatch@^3.0.2: version "3.0.3" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774" dependencies: @@ -821,6 +1042,10 @@ minimist@0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" +minimist@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + mkdirp@0.5.1, mkdirp@^0.5.0, mkdirp@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" @@ -859,6 +1084,30 @@ natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" +normalize-path@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-1.0.0.tgz#32d0e472f91ff345701c15a8311018d3b0a90379" + +npm-path@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/npm-path/-/npm-path-2.0.3.tgz#15cff4e1c89a38da77f56f6055b24f975dfb2bbe" + dependencies: + which "^1.2.10" + +npm-run-path@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" + dependencies: + path-key "^2.0.0" + +npm-which@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/npm-which/-/npm-which-3.0.1.tgz#9225f26ec3a285c209cae67c3b11a6b4ab7140aa" + dependencies: + commander "^2.9.0" + npm-path "^2.0.2" + which "^1.2.10" + number-is-nan@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" @@ -888,10 +1137,33 @@ optionator@^0.8.2: type-check "~0.3.2" wordwrap "~1.0.0" -os-homedir@^1.0.0: +ora@^0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/ora/-/ora-0.2.3.tgz#37527d220adcd53c39b73571d754156d5db657a4" + dependencies: + chalk "^1.1.1" + cli-cursor "^1.0.2" + cli-spinners "^0.1.2" + object-assign "^4.0.1" + +os-homedir@^1.0.0, os-homedir@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" +p-finally@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + +p-map@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/p-map/-/p-map-1.1.1.tgz#05f5e4ae97a068371bc2a5cc86bfbdbc19c4ae7a" + +parse-json@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" + dependencies: + error-ex "^1.2.0" + path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" @@ -900,6 +1172,10 @@ path-is-inside@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" +path-key@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + path-parse@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" @@ -926,6 +1202,10 @@ prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" +prettier@1.4.4: + version "1.4.4" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.4.4.tgz#a8d1447b14c9bf67e6d420dcadd10fb9a4fad65a" + process-nextick-args@~1.0.6: version "1.0.7" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" @@ -934,6 +1214,10 @@ progress@^1.1.8: version "1.1.8" resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be" +pseudomap@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + readable-stream@^2.2.2: version "2.2.6" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.6.tgz#8b43aed76e71483938d12a8d46c6cf1a00b1f816" @@ -964,6 +1248,16 @@ regenerator-runtime@^0.10.0: version "0.10.3" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.3.tgz#8c4367a904b51ea62a908ac310bf99ff90a82a3e" +repeating@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" + dependencies: + is-finite "^1.0.0" + +require-from-string@^1.1.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-1.2.1.tgz#529c9ccef27380adfec9a2f965b649bbee636418" + require-uncached@^1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" @@ -1004,6 +1298,22 @@ rx-lite@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102" +rxjs@^5.0.0-beta.11: + version "5.4.1" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.4.1.tgz#b62f757f279445d265a18a58fb0a70dc90e91626" + dependencies: + symbol-observable "^1.0.1" + +shebang-command@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + dependencies: + shebang-regex "^1.0.0" + +shebang-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + shelljs@^0.7.5: version "0.7.7" resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.7.tgz#b2f5c77ef97148f4b4f6e22682e10bba8667cff1" @@ -1012,6 +1322,10 @@ shelljs@^0.7.5: interpret "^1.0.0" rechoir "^0.6.2" +signal-exit@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + slice-ansi@0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" @@ -1020,6 +1334,14 @@ sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" +staged-git-files@0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/staged-git-files/-/staged-git-files-0.0.4.tgz#d797e1b551ca7a639dec0237dc6eb4bb9be17d35" + +stream-to-observable@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/stream-to-observable/-/stream-to-observable-0.1.0.tgz#45bf1d9f2d7dc09bed81f1c307c430e68b84cffe" + string-width@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" @@ -1039,7 +1361,7 @@ string_decoder@~0.10.x: version "0.10.31" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" -strip-ansi@^3.0.0: +strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" dependencies: @@ -1049,6 +1371,10 @@ strip-bom@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" +strip-eof@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" @@ -1063,6 +1389,10 @@ supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" +symbol-observable@^1.0.1: + version "1.0.4" + resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.4.tgz#29bf615d4aa7121bdd898b22d4b3f9bc4e2aa03d" + table@^3.7.8: version "3.8.3" resolved "https://registry.yarnpkg.com/table/-/table-3.8.3.tgz#2bbc542f0fda9861a755d3947fefd8b3f513855f" @@ -1110,6 +1440,12 @@ util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" +which@^1.2.10, which@^1.2.9: + version "1.2.14" + resolved "https://registry.yarnpkg.com/which/-/which-1.2.14.tgz#9a87c4378f03e827cecaf1acdf56c736c01c14e5" + dependencies: + isexe "^2.0.0" + wordwrap@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" @@ -1127,3 +1463,7 @@ write@^0.2.1: xtend@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" + +yallist@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" From 6aec93c46858b96aab63b1ae8e88be20e45d10a1 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sun, 18 Jun 2017 18:30:59 -0400 Subject: [PATCH 370/569] Merge pull request babel/babel-eslint#493 from danez/regression-test Test for babylon regression --- eslint/babel-eslint-parser/package.json | 2 +- eslint/babel-eslint-parser/test/non-regression.js | 15 +++++++++++++++ eslint/babel-eslint-parser/yarn.lock | 6 +++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 90eb98e74e7b..7b37cfeeb7b0 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -15,7 +15,7 @@ "babel-code-frame": "7.0.0-alpha.12", "babel-traverse": "7.0.0-alpha.12", "babel-types": "7.0.0-alpha.12", - "babylon": "7.0.0-beta.13" + "babylon": "7.0.0-beta.14" }, "scripts": { "test": "npm run lint && npm run test-only", diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index f382801f229d..a260f94eeef0 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1780,4 +1780,19 @@ describe("verify", () => { ); }); }); + + it("flow types on class method should be visited correctly", () => { + verifyAndAssertMessages( + unpad(` + import type NodeType from 'foo'; + class NodeUtils { + finishNodeAt(node: T): T { return node; } + } + + new NodeUtils(); + `), + { "no-unused-vars": 1 }, + [] + ); + }); }); diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index e2c20316226a..5e82ccbab562 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -212,9 +212,9 @@ babylon@7.0.0-beta.12: version "7.0.0-beta.12" resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.12.tgz#f7b9c8a89ff7d6afb57b906d947a4237f9bf53f9" -babylon@7.0.0-beta.13: - version "7.0.0-beta.13" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.13.tgz#12425c1bfd9498be419021ed36b43fe4f0289c0a" +babylon@7.0.0-beta.14: + version "7.0.0-beta.14" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.14.tgz#72aa3c493c984c2edc54d4bc077b74066ed4511d" babylon@7.0.0-beta.8: version "7.0.0-beta.8" From d40a6dd9b7878521368a89fb0e7355f763456422 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sun, 18 Jun 2017 18:33:40 -0400 Subject: [PATCH 371/569] 8.0.0-alpha.13 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 7b37cfeeb7b0..575343b9462d 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "8.0.0-alpha.12", + "version": "8.0.0-alpha.13", "description": "Custom parser for ESLint", "main": "index.js", "files": [ From 9a791d175c1ac5c20221f5af5ff484949623c9e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20M=C3=A5rtensson?= Date: Tue, 20 Jun 2017 23:49:46 +0200 Subject: [PATCH 372/569] Update install instructions to use latest stable release (babel/babel-eslint#497) [skip ci] --- eslint/babel-eslint-parser/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index fc5a54035fee..3690e3dff924 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -56,7 +56,7 @@ ESLint | babel-eslint ### Install ```sh -$ npm install eslint@3.x babel-eslint@6 --save-dev +$ npm install eslint@3.x babel-eslint@7 --save-dev ``` ### Setup From dcb4bffee5e24facb150514770e62e892c63864e Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Thu, 22 Jun 2017 13:18:47 -0700 Subject: [PATCH 373/569] chore(package): update husky to version 0.14.0 (babel/babel-eslint#498) --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 575343b9462d..521c0807b80c 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -43,7 +43,7 @@ "eslint-plugin-flowtype": "^2.30.3", "eslint-plugin-prettier": "^2.1.2", "espree": "^3.4.0", - "husky": "^0.13.2", + "husky": "^0.14.0", "lint-staged": "^3.6.1", "mocha": "^3.0.0", "prettier": "1.4.4" From 469e679b6d8a24846f25af824d639798f13bc671 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Sun, 25 Jun 2017 08:30:29 -0700 Subject: [PATCH 374/569] =?UTF-8?q?Update=20eslint=20to=20the=20latest=20v?= =?UTF-8?q?ersion=20=F0=9F=9A=80=20(babel/babel-eslint#500)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(package): update eslint to version 4.1.0 * escope -> eslint-scope * Fix linting --- eslint/babel-eslint-parser/package.json | 8 +- .../babel-eslint-parser/test/babel-eslint.js | 2 +- eslint/babel-eslint-parser/yarn.lock | 585 +++++++----------- 3 files changed, 245 insertions(+), 350 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 521c0807b80c..d964f539b0bd 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -36,17 +36,17 @@ }, "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { - "babel-eslint": "^7.0.0", + "babel-eslint": "^8.0.0-alpha.13", "dedent": "^0.7.0", - "eslint": "^3.18.0", + "eslint": "^4.1.0", "eslint-config-babel": "^7.0.1", "eslint-plugin-flowtype": "^2.30.3", "eslint-plugin-prettier": "^2.1.2", "espree": "^3.4.0", "husky": "^0.14.0", - "lint-staged": "^3.6.1", + "lint-staged": "^4.0.0", "mocha": "^3.0.0", - "prettier": "1.4.4" + "prettier": "^1.4.4" }, "lint-staged": { "*.js": [ diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 2ac2d3af581a..4683aa86adeb 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -1,7 +1,7 @@ var assert = require("assert"); var babelEslint = require(".."); var espree = require("espree"); -var escope = require("escope"); +var escope = require("eslint-scope"); var util = require("util"); var unpad = require("dedent"); diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index 5e82ccbab562..c59da6113b1f 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -8,29 +8,33 @@ acorn-jsx@^3.0.0: dependencies: acorn "^3.0.4" -acorn@4.0.4: - version "4.0.4" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.4.tgz#17a8d6a7a6c4ef538b814ec9abac2779293bf30a" - acorn@^3.0.4: version "3.3.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" +acorn@^5.0.1: + version "5.0.3" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.0.3.tgz#c460df08491463f028ccb82eab3730bf01087b3d" + ajv-keywords@^1.0.0: version "1.5.1" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.1.tgz#314dd0a4b3368fad3dfcdc54ede6171b886daf3c" ajv@^4.7.0: - version "4.11.5" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.5.tgz#b6ee74657b993a01dce44b7944d56f485828d5bd" + version "4.11.8" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.8.tgz#82ffb02b29e662ae53bdc20af15947706739c536" dependencies: co "^4.6.0" json-stable-stringify "^1.0.1" -ansi-escapes@^1.0.0, ansi-escapes@^1.1.0: +ansi-escapes@^1.0.0: version "1.4.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" +ansi-escapes@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-2.0.0.tgz#5bae52be424878dd9783e8910e3fc2922e83c81b" + ansi-regex@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" @@ -79,7 +83,7 @@ babel-code-frame@7.0.0-alpha.3: esutils "^2.0.2" js-tokens "^3.0.0" -babel-code-frame@^6.16.0, babel-code-frame@^6.22.0: +babel-code-frame@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4" dependencies: @@ -87,15 +91,14 @@ babel-code-frame@^6.16.0, babel-code-frame@^6.22.0: esutils "^2.0.2" js-tokens "^3.0.0" -babel-eslint@^7.0.0: - version "7.1.1" - resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-7.1.1.tgz#8a6a884f085aa7060af69cfc77341c2f99370fb2" +babel-eslint@^8.0.0-alpha.13: + version "8.0.0-alpha.13" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-8.0.0-alpha.13.tgz#47c6f04d4c7ef5084f5a849ffe5a8a48f17db7df" dependencies: - babel-code-frame "^6.16.0" - babel-traverse "^6.15.0" - babel-types "^6.15.0" - babylon "^6.13.0" - lodash.pickby "^4.6.0" + babel-code-frame "7.0.0-alpha.12" + babel-traverse "7.0.0-alpha.12" + babel-types "7.0.0-alpha.12" + babylon "7.0.0-beta.14" babel-helper-function-name@7.0.0-alpha.7: version "7.0.0-alpha.7" @@ -120,19 +123,6 @@ babel-messages@7.0.0-alpha.3: version "7.0.0-alpha.3" resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-7.0.0-alpha.3.tgz#c8390a468478b8384da134612e12a6bc31a684e9" -babel-messages@^6.23.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" - dependencies: - babel-runtime "^6.22.0" - -babel-runtime@^6.22.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.23.0.tgz#0a9489f144de70efb3ce4300accdb329e2fc543b" - dependencies: - core-js "^2.4.0" - regenerator-runtime "^0.10.0" - babel-template@7.0.0-alpha.7: version "7.0.0-alpha.7" resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-7.0.0-alpha.7.tgz#82e26500980d1b3f14d9ebe8ae8b9325dc158392" @@ -169,20 +159,6 @@ babel-traverse@7.0.0-alpha.7: invariant "^2.2.0" lodash "^4.2.0" -babel-traverse@^6.15.0: - version "6.23.1" - resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.23.1.tgz#d3cb59010ecd06a97d81310065f966b699e14f48" - dependencies: - babel-code-frame "^6.22.0" - babel-messages "^6.23.0" - babel-runtime "^6.22.0" - babel-types "^6.23.0" - babylon "^6.15.0" - debug "^2.2.0" - globals "^9.0.0" - invariant "^2.2.0" - lodash "^4.2.0" - babel-types@7.0.0-alpha.12: version "7.0.0-alpha.12" resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-7.0.0-alpha.12.tgz#d7b2c6d0c49c518fd36de5ac14f4f50bed6de7e5" @@ -199,15 +175,6 @@ babel-types@7.0.0-alpha.7: lodash "^4.2.0" to-fast-properties "^1.0.1" -babel-types@^6.15.0, babel-types@^6.23.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.23.0.tgz#bb17179d7538bad38cd0c9e115d340f77e7e9acf" - dependencies: - babel-runtime "^6.22.0" - esutils "^2.0.2" - lodash "^4.2.0" - to-fast-properties "^1.0.1" - babylon@7.0.0-beta.12: version "7.0.0-beta.12" resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.12.tgz#f7b9c8a89ff7d6afb57b906d947a4237f9bf53f9" @@ -220,29 +187,21 @@ babylon@7.0.0-beta.8: version "7.0.0-beta.8" resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.8.tgz#2bdc5ae366041442c27e068cce6f0d7c06ea9949" -babylon@^6.13.0, babylon@^6.15.0: - version "6.17.0" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.17.0.tgz#37da948878488b9c4e3c4038893fa3314b3fc932" - -balanced-match@^0.4.1: - version "0.4.2" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838" +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" -brace-expansion@^1.0.0: - version "1.1.6" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.6.tgz#7197d7eaa9b87e648390ea61fc66c84427420df9" +brace-expansion@^1.1.7: + version "1.1.8" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292" dependencies: - balanced-match "^0.4.1" + balanced-match "^1.0.0" concat-map "0.0.1" browser-stdout@1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" -buffer-shims@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/buffer-shims/-/buffer-shims-1.0.0.tgz#9978ce317388c649ad8793028c3477ef044a8b51" - caller-path@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" @@ -271,12 +230,18 @@ circular-json@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.1.tgz#be8b36aefccde8b3ca7aa2d6afc07a37242c0d2d" -cli-cursor@^1.0.1, cli-cursor@^1.0.2: +cli-cursor@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-1.0.2.tgz#64da3f7d56a54412e59794bd62dc35295e8f2987" dependencies: restore-cursor "^1.0.1" +cli-cursor@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" + dependencies: + restore-cursor "^2.0.0" + cli-spinners@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-0.1.2.tgz#bb764d88e185fb9e1e6a2a1f19772318f605e31c" @@ -310,7 +275,7 @@ concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" -concat-stream@^1.5.2: +concat-stream@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" dependencies: @@ -318,10 +283,6 @@ concat-stream@^1.5.2: readable-stream "^2.2.2" typedarray "^0.0.6" -core-js@^2.4.0: - version "2.4.1" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.4.1.tgz#4de911e667b0eae9124e34254b53aea6fc618d3e" - core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" @@ -347,27 +308,21 @@ cross-spawn@^5.0.1: shebang-command "^1.2.0" which "^1.2.9" -d@1: - version "1.0.0" - resolved "https://registry.yarnpkg.com/d/-/d-1.0.0.tgz#754bb5bfe55451da69a58b94d45f4c5b0462d58f" - dependencies: - es5-ext "^0.10.9" - date-fns@^1.27.2: version "1.28.5" resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.28.5.tgz#257cfc45d322df45ef5658665967ee841cd73faf" -debug@2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da" +debug@2.6.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.0.tgz#bc596bcabe7617f11d9fa15361eded5608b8499b" dependencies: - ms "0.7.1" + ms "0.7.2" -debug@^2.1.1, debug@^2.2.0: - version "2.6.3" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.3.tgz#0f7eb8c30965ec08c72accfa0130c8b79984141d" +debug@^2.2.0, debug@^2.6.8: + version "2.6.8" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc" dependencies: - ms "0.7.2" + ms "2.0.0" dedent@^0.7.0: version "0.7.0" @@ -389,9 +344,9 @@ del@^2.0.2: pinkie-promise "^2.0.0" rimraf "^2.2.8" -diff@1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-1.4.0.tgz#7f28d2eb9ee7b15a97efd89ce63dcfdaa3ccbabf" +diff@3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-3.2.0.tgz#c9ce393a4b7cbd0b058a725c93df299027868ff9" doctrine@^2.0.0: version "2.0.0" @@ -410,78 +365,17 @@ error-ex@^1.2.0: dependencies: is-arrayish "^0.2.1" -es5-ext@^0.10.14, es5-ext@^0.10.9, es5-ext@~0.10.14: - version "0.10.15" - resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.15.tgz#c330a5934c1ee21284a7c081a86e5fd937c91ea6" - dependencies: - es6-iterator "2" - es6-symbol "~3.1" - -es6-iterator@2, es6-iterator@^2.0.1, es6-iterator@~2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.1.tgz#8e319c9f0453bf575d374940a655920e59ca5512" - dependencies: - d "1" - es5-ext "^0.10.14" - es6-symbol "^3.1" - -es6-map@^0.1.3: - version "0.1.5" - resolved "https://registry.yarnpkg.com/es6-map/-/es6-map-0.1.5.tgz#9136e0503dcc06a301690f0bb14ff4e364e949f0" - dependencies: - d "1" - es5-ext "~0.10.14" - es6-iterator "~2.0.1" - es6-set "~0.1.5" - es6-symbol "~3.1.1" - event-emitter "~0.3.5" - -es6-set@~0.1.5: - version "0.1.5" - resolved "https://registry.yarnpkg.com/es6-set/-/es6-set-0.1.5.tgz#d2b3ec5d4d800ced818db538d28974db0a73ccb1" - dependencies: - d "1" - es5-ext "~0.10.14" - es6-iterator "~2.0.1" - es6-symbol "3.1.1" - event-emitter "~0.3.5" - -es6-symbol@3.1.1, es6-symbol@^3.1, es6-symbol@^3.1.1, es6-symbol@~3.1, es6-symbol@~3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77" - dependencies: - d "1" - es5-ext "~0.10.14" - -es6-weak-map@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.2.tgz#5e3ab32251ffd1538a1f8e5ffa1357772f92d96f" - dependencies: - d "1" - es5-ext "^0.10.14" - es6-iterator "^2.0.1" - es6-symbol "^3.1.1" - escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" -escope@^3.6.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/escope/-/escope-3.6.0.tgz#e01975e812781a163a6dadfdd80398dc64c889c3" - dependencies: - es6-map "^0.1.3" - es6-weak-map "^2.0.1" - esrecurse "^4.1.0" - estraverse "^4.1.1" - eslint-config-babel@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/eslint-config-babel/-/eslint-config-babel-7.0.1.tgz#aac7b79f2f06f52358a5a764fdc01fde23718572" eslint-plugin-flowtype@^2.30.3: - version "2.30.3" - resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.30.3.tgz#57835d2c0ed388da7a2725803ec32af2f437c301" + version "2.34.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.34.0.tgz#b9875f314652e5081623c9d2b18a346bbb759c09" dependencies: lodash "^4.15.0" @@ -492,51 +386,56 @@ eslint-plugin-prettier@^2.1.2: fast-diff "^1.1.1" jest-docblock "^20.0.1" -eslint@^3.18.0: - version "3.18.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.18.0.tgz#647e985c4ae71502d20ac62c109f66d5104c8a4b" +eslint-scope@^3.7.1: + version "3.7.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.1.0.tgz#bbb55a28220ee08b69da9554d45a6b2ebfd7d913" dependencies: - babel-code-frame "^6.16.0" + babel-code-frame "^6.22.0" chalk "^1.1.3" - concat-stream "^1.5.2" - debug "^2.1.1" + concat-stream "^1.6.0" + debug "^2.6.8" doctrine "^2.0.0" - escope "^3.6.0" - espree "^3.4.0" + eslint-scope "^3.7.1" + espree "^3.4.3" esquery "^1.0.0" estraverse "^4.2.0" esutils "^2.0.2" file-entry-cache "^2.0.0" - glob "^7.0.3" - globals "^9.14.0" - ignore "^3.2.0" + glob "^7.1.2" + globals "^9.17.0" + ignore "^3.3.3" imurmurhash "^0.1.4" - inquirer "^0.12.0" - is-my-json-valid "^2.10.0" + inquirer "^3.0.6" + is-my-json-valid "^2.16.0" is-resolvable "^1.0.0" - js-yaml "^3.5.1" - json-stable-stringify "^1.0.0" + js-yaml "^3.8.4" + json-stable-stringify "^1.0.1" levn "^0.3.0" - lodash "^4.0.0" - mkdirp "^0.5.0" + lodash "^4.17.4" + minimatch "^3.0.2" + mkdirp "^0.5.1" natural-compare "^1.4.0" optionator "^0.8.2" - path-is-inside "^1.0.1" - pluralize "^1.2.1" - progress "^1.1.8" - require-uncached "^1.0.2" - shelljs "^0.7.5" - strip-bom "^3.0.0" + path-is-inside "^1.0.2" + pluralize "^4.0.0" + progress "^2.0.0" + require-uncached "^1.0.3" strip-json-comments "~2.0.1" - table "^3.7.8" + table "^4.0.1" text-table "~0.2.0" - user-home "^2.0.0" -espree@^3.4.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-3.4.0.tgz#41656fa5628e042878025ef467e78f125cb86e1d" +espree@^3.4.0, espree@^3.4.3: + version "3.4.3" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.4.3.tgz#2910b5ccd49ce893c2ffffaab4fd8b3a31b82374" dependencies: - acorn "4.0.4" + acorn "^5.0.1" acorn-jsx "^3.0.0" esprima@^3.1.1: @@ -550,31 +449,20 @@ esquery@^1.0.0: estraverse "^4.0.0" esrecurse@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.1.0.tgz#4713b6536adf7f2ac4f327d559e7756bff648220" + version "4.2.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.0.tgz#fa9568d98d3823f9a41d91e902dcab9ea6e5b163" dependencies: - estraverse "~4.1.0" + estraverse "^4.1.0" object-assign "^4.0.1" -estraverse@^4.0.0, estraverse@^4.1.1, estraverse@^4.2.0: +estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" -estraverse@~4.1.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.1.1.tgz#f6caca728933a850ef90661d0e17982ba47111a2" - esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" -event-emitter@~0.3.5: - version "0.3.5" - resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39" - dependencies: - d "1" - es5-ext "~0.10.14" - execa@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" @@ -591,6 +479,14 @@ exit-hook@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8" +external-editor@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.0.4.tgz#1ed9199da9cbfe2ef2f7a31b2fde8b0d12368972" + dependencies: + iconv-lite "^0.4.17" + jschardet "^1.4.2" + tmp "^0.0.31" + fast-diff@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.1.1.tgz#0aea0e4e605b6a2189f0e936d4b7fbaf1b7cfd9b" @@ -599,13 +495,19 @@ fast-levenshtein@~2.0.4: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" -figures@^1.3.5, figures@^1.7.0: +figures@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" dependencies: escape-string-regexp "^1.0.5" object-assign "^4.1.0" +figures@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" + dependencies: + escape-string-regexp "^1.0.5" + file-entry-cache@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" @@ -613,10 +515,6 @@ file-entry-cache@^2.0.0: flat-cache "^1.2.1" object-assign "^4.0.1" -find-parent-dir@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/find-parent-dir/-/find-parent-dir-0.3.0.tgz#33c44b429ab2b2f0646299c5f9f718f376ff8d54" - flat-cache@^1.2.1: version "1.2.2" resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.2.2.tgz#fa86714e72c21db88601761ecf2f555d1abc6b96" @@ -644,9 +542,9 @@ get-stream@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" -glob@7.0.5: - version "7.0.5" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.0.5.tgz#b4202a69099bbb4d292a7c1b95b6682b67ebdc95" +glob@7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" @@ -655,20 +553,20 @@ glob@7.0.5: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.0.0, glob@^7.0.3, glob@^7.0.5: - version "7.1.1" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" +glob@^7.0.3, glob@^7.0.5, glob@^7.1.2: + version "7.1.2" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" inherits "2" - minimatch "^3.0.2" + minimatch "^3.0.4" once "^1.3.0" path-is-absolute "^1.0.0" -globals@^9.0.0, globals@^9.14.0: - version "9.16.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-9.16.0.tgz#63e903658171ec2d9f51b1d31de5e2b8dc01fb80" +globals@^9.0.0, globals@^9.17.0: + version "9.18.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" globby@^5.0.0: version "5.0.0" @@ -703,18 +601,21 @@ has-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" -husky@^0.13.2: - version "0.13.4" - resolved "https://registry.yarnpkg.com/husky/-/husky-0.13.4.tgz#48785c5028de3452a51c48c12c4f94b2124a1407" +husky@^0.14.0: + version "0.14.1" + resolved "https://registry.yarnpkg.com/husky/-/husky-0.14.1.tgz#8edba33e728ceed75343e88bb8002e4cbd8d1b40" dependencies: - chalk "^1.1.3" - find-parent-dir "^0.3.0" - is-ci "^1.0.9" + is-ci "^1.0.10" normalize-path "^1.0.0" + strip-indent "^2.0.0" -ignore@^3.2.0: - version "3.2.6" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.2.6.tgz#26e8da0644be0bb4cb39516f6c79f0e0f4ffe48c" +iconv-lite@^0.4.17: + version "0.4.18" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.18.tgz#23d8656b16aae6742ac29732ea8f0336a4789cf2" + +ignore@^3.3.3: + version "3.3.3" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.3.tgz#432352e57accd87ab3110e82d3fea0e47812156d" imurmurhash@^0.1.4: version "0.1.4" @@ -737,32 +638,29 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@^2.0.3, inherits@~2.0.1: +inherits@2, inherits@^2.0.3, inherits@~2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" -inquirer@^0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-0.12.0.tgz#1ef2bfd63504df0bc75785fff8c2c41df12f077e" +inquirer@^3.0.6: + version "3.1.1" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.1.1.tgz#87621c4fba4072f48a8dd71c9f9df6f100b2d534" dependencies: - ansi-escapes "^1.1.0" - ansi-regex "^2.0.0" + ansi-escapes "^2.0.0" chalk "^1.0.0" - cli-cursor "^1.0.1" + cli-cursor "^2.1.0" cli-width "^2.0.0" - figures "^1.3.5" + external-editor "^2.0.4" + figures "^2.0.0" lodash "^4.3.0" - readline2 "^1.0.1" - run-async "^0.1.0" - rx-lite "^3.1.2" - string-width "^1.0.1" + mute-stream "0.0.7" + run-async "^2.2.0" + rx-lite "^4.0.8" + rx-lite-aggregates "^4.0.8" + string-width "^2.0.0" strip-ansi "^3.0.0" through "^2.3.6" -interpret@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.1.tgz#d579fb7f693b858004947af39fa0db49f795602c" - invariant@^2.2.0: version "2.2.2" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" @@ -773,7 +671,7 @@ is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" -is-ci@^1.0.9: +is-ci@^1.0.10: version "1.0.10" resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.0.10.tgz#f739336b2632365061a9d48270cd56ae3369318e" dependencies: @@ -795,7 +693,7 @@ is-fullwidth-code-point@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" -is-my-json-valid@^2.10.0: +is-my-json-valid@^2.16.0: version "2.16.0" resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.16.0.tgz#f079dd9bfdae65ee2038aae8acbc86ab109e3693" dependencies: @@ -854,14 +752,18 @@ js-tokens@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7" -js-yaml@^3.4.3, js-yaml@^3.5.1: - version "3.8.2" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.8.2.tgz#02d3e2c0f6beab20248d412c352203827d786721" +js-yaml@^3.4.3, js-yaml@^3.8.4: + version "3.8.4" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.8.4.tgz#520b4564f86573ba96662af85a8cafa7b4b5a6f6" dependencies: argparse "^1.0.7" esprima "^3.1.1" -json-stable-stringify@^1.0.0, json-stable-stringify@^1.0.1: +jschardet@^1.4.2: + version "1.4.2" + resolved "https://registry.yarnpkg.com/jschardet/-/jschardet-1.4.2.tgz#2aa107f142af4121d145659d44f50830961e699a" + +json-stable-stringify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" dependencies: @@ -886,9 +788,9 @@ levn@^0.3.0, levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" -lint-staged@^3.6.1: - version "3.6.1" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-3.6.1.tgz#24423c8b7bd99d96e15acd1ac8cb392a78e58582" +lint-staged@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-4.0.0.tgz#c15669f598614a6e68090303e175a799d48e0d85" dependencies: app-root-path "^2.0.0" cosmiconfig "^1.1.0" @@ -998,11 +900,7 @@ lodash.keys@^3.0.0: lodash.isarguments "^3.0.0" lodash.isarray "^3.0.0" -lodash.pickby@^4.6.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/lodash.pickby/-/lodash.pickby-4.6.0.tgz#7dea21d8c18d7703a27c704c15d3b84a67e33aff" - -lodash@^4.0.0, lodash@^4.15.0, lodash@^4.2.0, lodash@^4.3.0: +lodash@^4.0.0, lodash@^4.15.0, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" @@ -1032,11 +930,15 @@ lru-cache@^4.0.1: pseudomap "^1.0.2" yallist "^2.1.2" -minimatch@^3.0.0, minimatch@^3.0.2: - version "3.0.3" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774" +mimic-fn@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18" + +minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" dependencies: - brace-expansion "^1.0.0" + brace-expansion "^1.1.7" minimist@0.0.8: version "0.0.8" @@ -1046,39 +948,39 @@ minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" -mkdirp@0.5.1, mkdirp@^0.5.0, mkdirp@^0.5.1: +mkdirp@0.5.1, mkdirp@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" dependencies: minimist "0.0.8" mocha@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-3.2.0.tgz#7dc4f45e5088075171a68896814e6ae9eb7a85e3" + version "3.4.2" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-3.4.2.tgz#d0ef4d332126dbf18d0d640c9b382dd48be97594" dependencies: browser-stdout "1.3.0" commander "2.9.0" - debug "2.2.0" - diff "1.4.0" + debug "2.6.0" + diff "3.2.0" escape-string-regexp "1.0.5" - glob "7.0.5" + glob "7.1.1" growl "1.9.2" json3 "3.3.2" lodash.create "3.1.1" mkdirp "0.5.1" supports-color "3.1.2" -ms@0.7.1: - version "0.7.1" - resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.1.tgz#9cd13c03adbff25b65effde7ce864ee952017098" - ms@0.7.2: version "0.7.2" resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.2.tgz#ae25cf2512b3885a1d95d7f037868d8431124765" -mute-stream@0.0.5: - version "0.0.5" - resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.5.tgz#8fbfabb0a98a253d3184331f9e8deb7372fac6c0" +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + +mute-stream@0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" natural-compare@^1.4.0: version "1.4.0" @@ -1126,6 +1028,12 @@ onetime@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789" +onetime@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" + dependencies: + mimic-fn "^1.0.0" + optionator@^0.8.2: version "0.8.2" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" @@ -1146,10 +1054,14 @@ ora@^0.2.3: cli-spinners "^0.1.2" object-assign "^4.0.1" -os-homedir@^1.0.0, os-homedir@^1.0.1: +os-homedir@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" +os-tmpdir@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + p-finally@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" @@ -1168,7 +1080,7 @@ path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" -path-is-inside@^1.0.1: +path-is-inside@^1.0.1, path-is-inside@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" @@ -1176,10 +1088,6 @@ path-key@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" -path-parse@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" - pify@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" @@ -1194,15 +1102,15 @@ pinkie@^2.0.0: version "2.0.4" resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" -pluralize@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-1.2.1.tgz#d1a21483fd22bb41e58a12fa3421823140897c45" +pluralize@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-4.0.0.tgz#59b708c1c0190a2f692f1c7618c446b052fd1762" prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" -prettier@1.4.4: +prettier@^1.4.4: version "1.4.4" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.4.4.tgz#a8d1447b14c9bf67e6d420dcadd10fb9a4fad65a" @@ -1210,44 +1118,26 @@ process-nextick-args@~1.0.6: version "1.0.7" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" -progress@^1.1.8: - version "1.1.8" - resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be" +progress@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f" pseudomap@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" readable-stream@^2.2.2: - version "2.2.6" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.6.tgz#8b43aed76e71483938d12a8d46c6cf1a00b1f816" + version "2.3.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.2.tgz#5a04df05e4f57fe3f0dc68fdd11dc5c97c7e6f4d" dependencies: - buffer-shims "^1.0.0" core-util-is "~1.0.0" - inherits "~2.0.1" + inherits "~2.0.3" isarray "~1.0.0" process-nextick-args "~1.0.6" - string_decoder "~0.10.x" + safe-buffer "~5.1.0" + string_decoder "~1.0.0" util-deprecate "~1.0.1" -readline2@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/readline2/-/readline2-1.0.1.tgz#41059608ffc154757b715d9989d199ffbf372e35" - dependencies: - code-point-at "^1.0.0" - is-fullwidth-code-point "^1.0.0" - mute-stream "0.0.5" - -rechoir@^0.6.2: - version "0.6.2" - resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" - dependencies: - resolve "^1.1.6" - -regenerator-runtime@^0.10.0: - version "0.10.3" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.3.tgz#8c4367a904b51ea62a908ac310bf99ff90a82a3e" - repeating@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" @@ -1258,7 +1148,7 @@ require-from-string@^1.1.0: version "1.2.1" resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-1.2.1.tgz#529c9ccef27380adfec9a2f965b649bbee636418" -require-uncached@^1.0.2: +require-uncached@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" dependencies: @@ -1269,12 +1159,6 @@ resolve-from@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" -resolve@^1.1.6: - version "1.3.2" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.3.2.tgz#1f0442c9e0cbb8136e87b9305f932f46c7f28235" - dependencies: - path-parse "^1.0.5" - restore-cursor@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541" @@ -1282,21 +1166,34 @@ restore-cursor@^1.0.1: exit-hook "^1.0.0" onetime "^1.0.0" +restore-cursor@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" + dependencies: + onetime "^2.0.0" + signal-exit "^3.0.2" + rimraf@^2.2.8: version "2.6.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d" dependencies: glob "^7.0.5" -run-async@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/run-async/-/run-async-0.1.0.tgz#c8ad4a5e110661e402a7d21b530e009f25f8e389" +run-async@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" dependencies: - once "^1.3.0" + is-promise "^2.1.0" -rx-lite@^3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102" +rx-lite-aggregates@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz#753b87a89a11c95467c4ac1626c4efc4e05c67be" + dependencies: + rx-lite "*" + +rx-lite@*, rx-lite@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444" rxjs@^5.0.0-beta.11: version "5.4.1" @@ -1304,6 +1201,10 @@ rxjs@^5.0.0-beta.11: dependencies: symbol-observable "^1.0.1" +safe-buffer@~5.1.0: + version "5.1.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" + shebang-command@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" @@ -1314,15 +1215,7 @@ shebang-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" -shelljs@^0.7.5: - version "0.7.7" - resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.7.tgz#b2f5c77ef97148f4b4f6e22682e10bba8667cff1" - dependencies: - glob "^7.0.0" - interpret "^1.0.0" - rechoir "^0.6.2" - -signal-exit@^3.0.0: +signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" @@ -1357,9 +1250,11 @@ string-width@^2.0.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^3.0.0" -string_decoder@~0.10.x: - version "0.10.31" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" +string_decoder@~1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.3.tgz#0fc67d7c141825de94282dd536bec6b9bce860ab" + dependencies: + safe-buffer "~5.1.0" strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1" @@ -1367,14 +1262,14 @@ strip-ansi@^3.0.0, strip-ansi@^3.0.1: dependencies: ansi-regex "^2.0.0" -strip-bom@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" - strip-eof@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" +strip-indent@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-2.0.0.tgz#5ef8db295d01e6ed6cbf7aab96998d7822527b68" + strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" @@ -1393,9 +1288,9 @@ symbol-observable@^1.0.1: version "1.0.4" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.4.tgz#29bf615d4aa7121bdd898b22d4b3f9bc4e2aa03d" -table@^3.7.8: - version "3.8.3" - resolved "https://registry.yarnpkg.com/table/-/table-3.8.3.tgz#2bbc542f0fda9861a755d3947fefd8b3f513855f" +table@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/table/-/table-4.0.1.tgz#a8116c133fac2c61f4a420ab6cdf5c4d61f0e435" dependencies: ajv "^4.7.0" ajv-keywords "^1.0.0" @@ -1412,9 +1307,15 @@ through@^2.3.6: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" +tmp@^0.0.31: + version "0.0.31" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.31.tgz#8f38ab9438e17315e5dbd8b3657e8bfb277ae4a7" + dependencies: + os-tmpdir "~1.0.1" + to-fast-properties@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.2.tgz#f3f5c0c3ba7299a7ef99427e44633257ade43320" + version "1.0.3" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" tryit@^1.0.1: version "1.0.3" @@ -1430,12 +1331,6 @@ typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" -user-home@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/user-home/-/user-home-2.0.0.tgz#9c70bfd8169bc1dcbf48604e0f04b8b49cde9e9f" - dependencies: - os-homedir "^1.0.0" - util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" From c9b8d2dfd153c93b1be34f2bc29dc8f2a21cb49e Mon Sep 17 00:00:00 2001 From: Evan Brodie Date: Sun, 9 Jul 2017 21:03:59 -0400 Subject: [PATCH 375/569] Readme update usage section (babel/babel-eslint#501) [skip ci] * Updates README: Consolidates versioning table Basically a revert of 52b4a13. It is easier to read a single table instead of two locations in the README for the version compatabilities between ESLint and babel-eslint * Updates README: Add yarn command for installation * [skip ci] --- eslint/babel-eslint-parser/README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index 3690e3dff924..be6878570a22 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -43,20 +43,22 @@ It just needs to export a `parse` method that takes in a string of code and outp ## Usage -> ESLint 1.x | Use <= 5.x - -> ESLint 2.x | Use >= 6.x - ### Supported ESLint versions ESLint | babel-eslint ------------ | ------------- 3.x | >= 6.x +2.x | >= 6.x +1.x | >= 5.x ### Install +Ensure that you have substituted the correct version lock for `eslint` and `babel-eslint` into this command: + ```sh $ npm install eslint@3.x babel-eslint@7 --save-dev +# or +$ yarn add eslint@3.x babel-eslint@7 -D ``` ### Setup From 522140b43fdef120a9fcd04c20d015a5715fe181 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 13 Jul 2017 12:58:45 -0400 Subject: [PATCH 376/569] update (babel/babel-eslint#504) --- eslint/babel-eslint-parser/index.js | 2 + eslint/babel-eslint-parser/package.json | 8 +-- .../test/non-regression.js | 50 +++++++++++++ eslint/babel-eslint-parser/yarn.lock | 70 +++++++++++++++++++ 4 files changed, 126 insertions(+), 4 deletions(-) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index ecedcb50ad84..79eb5a3c7db1 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -391,6 +391,7 @@ exports.parseNoPatch = function(code, options) { allowReturnOutsideFunction: true, allowSuperOutsideMethod: true, ranges: true, + tokens: true, plugins: [ "flow", "jsx", @@ -412,6 +413,7 @@ exports.parseNoPatch = function(code, options) { "optionalChaining", "importMeta", "classPrivateProperties", + "bigInt", ], }; diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index d964f539b0bd..008e97bd575b 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -12,10 +12,10 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "babel-code-frame": "7.0.0-alpha.12", - "babel-traverse": "7.0.0-alpha.12", - "babel-types": "7.0.0-alpha.12", - "babylon": "7.0.0-beta.14" + "babel-code-frame": "7.0.0-alpha.15", + "babel-traverse": "7.0.0-alpha.15", + "babel-types": "7.0.0-alpha.15", + "babylon": "7.0.0-beta.16" }, "scripts": { "test": "npm run lint && npm run test-only", diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index a260f94eeef0..72f4ae07a665 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1795,4 +1795,54 @@ describe("verify", () => { [] ); }); + + it("works with dynamicImport", () => { + verifyAndAssertMessages( + unpad(` + import('a'); + `), + {}, + [] + ); + }); + + it("works with numericSeparator", () => { + verifyAndAssertMessages( + unpad(` + 1_000 + `), + {}, + [] + ); + }); + + it("works with optionalChaining", () => { + verifyAndAssertMessages( + unpad(` + a?.b + `), + {}, + [] + ); + }); + + it("works with import.meta", () => { + verifyAndAssertMessages( + unpad(` + import.meta + `), + {}, + [] + ); + }); + + it("works with classPrivateProperties", () => { + verifyAndAssertMessages( + unpad(` + class A { #a = 1; } + `), + {}, + [] + ); + }); }); diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index c59da6113b1f..0975828882c9 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -75,6 +75,14 @@ babel-code-frame@7.0.0-alpha.12: esutils "^2.0.2" js-tokens "^3.0.0" +babel-code-frame@7.0.0-alpha.15: + version "7.0.0-alpha.15" + resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-7.0.0-alpha.15.tgz#381d3e06e17b73201129c4a019e8b62d84e2dde3" + dependencies: + chalk "^1.1.0" + esutils "^2.0.2" + js-tokens "^3.0.0" + babel-code-frame@7.0.0-alpha.3: version "7.0.0-alpha.3" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-7.0.0-alpha.3.tgz#9ff265eaaac94b58dfc7ca4a4eecf389d5f4d344" @@ -100,6 +108,15 @@ babel-eslint@^8.0.0-alpha.13: babel-types "7.0.0-alpha.12" babylon "7.0.0-beta.14" +babel-helper-function-name@7.0.0-alpha.15: + version "7.0.0-alpha.15" + resolved "https://registry.yarnpkg.com/babel-helper-function-name/-/babel-helper-function-name-7.0.0-alpha.15.tgz#087bb6bb6677acde36b3c19f6bc1afedb3d12e30" + dependencies: + babel-helper-get-function-arity "7.0.0-alpha.15" + babel-template "7.0.0-alpha.15" + babel-traverse "7.0.0-alpha.15" + babel-types "7.0.0-alpha.15" + babel-helper-function-name@7.0.0-alpha.7: version "7.0.0-alpha.7" resolved "https://registry.yarnpkg.com/babel-helper-function-name/-/babel-helper-function-name-7.0.0-alpha.7.tgz#19aecddc5402f941c5726802993077b41ea9832d" @@ -109,6 +126,12 @@ babel-helper-function-name@7.0.0-alpha.7: babel-traverse "7.0.0-alpha.7" babel-types "7.0.0-alpha.7" +babel-helper-get-function-arity@7.0.0-alpha.15: + version "7.0.0-alpha.15" + resolved "https://registry.yarnpkg.com/babel-helper-get-function-arity/-/babel-helper-get-function-arity-7.0.0-alpha.15.tgz#17e93206d0b625c3122f4c674478cbed53281f24" + dependencies: + babel-types "7.0.0-alpha.15" + babel-helper-get-function-arity@7.0.0-alpha.7: version "7.0.0-alpha.7" resolved "https://registry.yarnpkg.com/babel-helper-get-function-arity/-/babel-helper-get-function-arity-7.0.0-alpha.7.tgz#16e6526ecefc5537826012365e577de2ccba02f5" @@ -119,10 +142,23 @@ babel-messages@7.0.0-alpha.12: version "7.0.0-alpha.12" resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-7.0.0-alpha.12.tgz#5fda840cb8dfeda06a7894a1e8ab1af695f249c0" +babel-messages@7.0.0-alpha.15: + version "7.0.0-alpha.15" + resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-7.0.0-alpha.15.tgz#97991d32d86a2130aff08fa75a16cfc5acad9e42" + babel-messages@7.0.0-alpha.3: version "7.0.0-alpha.3" resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-7.0.0-alpha.3.tgz#c8390a468478b8384da134612e12a6bc31a684e9" +babel-template@7.0.0-alpha.15: + version "7.0.0-alpha.15" + resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-7.0.0-alpha.15.tgz#08b56562987c9893bbd6646bce4819074ba1cf90" + dependencies: + babel-traverse "7.0.0-alpha.15" + babel-types "7.0.0-alpha.15" + babylon "7.0.0-beta.13" + lodash "^4.2.0" + babel-template@7.0.0-alpha.7: version "7.0.0-alpha.7" resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-7.0.0-alpha.7.tgz#82e26500980d1b3f14d9ebe8ae8b9325dc158392" @@ -146,6 +182,20 @@ babel-traverse@7.0.0-alpha.12: invariant "^2.2.0" lodash "^4.2.0" +babel-traverse@7.0.0-alpha.15: + version "7.0.0-alpha.15" + resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-7.0.0-alpha.15.tgz#d7af52cb8ee6e0867b778da17166e6f01498b11a" + dependencies: + babel-code-frame "7.0.0-alpha.15" + babel-helper-function-name "7.0.0-alpha.15" + babel-messages "7.0.0-alpha.15" + babel-types "7.0.0-alpha.15" + babylon "7.0.0-beta.15" + debug "^2.2.0" + globals "^9.0.0" + invariant "^2.2.0" + lodash "^4.2.0" + babel-traverse@7.0.0-alpha.7: version "7.0.0-alpha.7" resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-7.0.0-alpha.7.tgz#61cc89061b0ad0a5f9fc6df81117fac428bc4148" @@ -167,6 +217,14 @@ babel-types@7.0.0-alpha.12: lodash "^4.2.0" to-fast-properties "^1.0.1" +babel-types@7.0.0-alpha.15: + version "7.0.0-alpha.15" + resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-7.0.0-alpha.15.tgz#e4021e6a432e906678dfc6cc89805ba3234f9f48" + dependencies: + esutils "^2.0.2" + lodash "^4.2.0" + to-fast-properties "^1.0.1" + babel-types@7.0.0-alpha.7: version "7.0.0-alpha.7" resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-7.0.0-alpha.7.tgz#4bdb77386d1f6e2001f42fa9ac21b6c3d6ad0d82" @@ -179,10 +237,22 @@ babylon@7.0.0-beta.12: version "7.0.0-beta.12" resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.12.tgz#f7b9c8a89ff7d6afb57b906d947a4237f9bf53f9" +babylon@7.0.0-beta.13: + version "7.0.0-beta.13" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.13.tgz#12425c1bfd9498be419021ed36b43fe4f0289c0a" + babylon@7.0.0-beta.14: version "7.0.0-beta.14" resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.14.tgz#72aa3c493c984c2edc54d4bc077b74066ed4511d" +babylon@7.0.0-beta.15: + version "7.0.0-beta.15" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.15.tgz#410348bcd21af470a55abea9698c9c651d87f1c6" + +babylon@7.0.0-beta.16: + version "7.0.0-beta.16" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.16.tgz#448ceedeec0a5ef56b62812e3556bf36c5bb9781" + babylon@7.0.0-beta.8: version "7.0.0-beta.8" resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.8.tgz#2bdc5ae366041442c27e068cce6f0d7c06ea9949" From 35f79cb272c50b5b66e33c260af515bd56616bfd Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 13 Jul 2017 13:01:31 -0400 Subject: [PATCH 377/569] 8.0.0-alpha.15 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 008e97bd575b..7c043bf1e6af 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "8.0.0-alpha.13", + "version": "8.0.0-alpha.15", "description": "Custom parser for ESLint", "main": "index.js", "files": [ From cf86d945975f0a17c66382c14724a3e6cbad6925 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 26 Jul 2017 16:18:45 -0400 Subject: [PATCH 378/569] alpha.17 --- eslint/babel-eslint-parser/package.json | 8 +- eslint/babel-eslint-parser/yarn.lock | 130 +++++++++++++++--------- 2 files changed, 86 insertions(+), 52 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 7c043bf1e6af..dc48631d79d8 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -12,10 +12,10 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "babel-code-frame": "7.0.0-alpha.15", - "babel-traverse": "7.0.0-alpha.15", - "babel-types": "7.0.0-alpha.15", - "babylon": "7.0.0-beta.16" + "babel-code-frame": "7.0.0-alpha.17", + "babel-traverse": "7.0.0-alpha.17", + "babel-types": "7.0.0-alpha.17", + "babylon": "7.0.0-beta.18" }, "scripts": { "test": "npm run lint && npm run test-only", diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index 0975828882c9..d93d9583385d 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -43,6 +43,12 @@ ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" +ansi-styles@^3.1.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88" + dependencies: + color-convert "^1.9.0" + app-root-path@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/app-root-path/-/app-root-path-2.0.1.tgz#cd62dcf8e4fd5a417efc664d2e5b10653c651b46" @@ -75,11 +81,11 @@ babel-code-frame@7.0.0-alpha.12: esutils "^2.0.2" js-tokens "^3.0.0" -babel-code-frame@7.0.0-alpha.15: - version "7.0.0-alpha.15" - resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-7.0.0-alpha.15.tgz#381d3e06e17b73201129c4a019e8b62d84e2dde3" +babel-code-frame@7.0.0-alpha.17: + version "7.0.0-alpha.17" + resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-7.0.0-alpha.17.tgz#06a5daddb0946d8e95392477065a86480474f19c" dependencies: - chalk "^1.1.0" + chalk "^2.0.0" esutils "^2.0.2" js-tokens "^3.0.0" @@ -108,14 +114,14 @@ babel-eslint@^8.0.0-alpha.13: babel-types "7.0.0-alpha.12" babylon "7.0.0-beta.14" -babel-helper-function-name@7.0.0-alpha.15: - version "7.0.0-alpha.15" - resolved "https://registry.yarnpkg.com/babel-helper-function-name/-/babel-helper-function-name-7.0.0-alpha.15.tgz#087bb6bb6677acde36b3c19f6bc1afedb3d12e30" +babel-helper-function-name@7.0.0-alpha.17: + version "7.0.0-alpha.17" + resolved "https://registry.yarnpkg.com/babel-helper-function-name/-/babel-helper-function-name-7.0.0-alpha.17.tgz#b976290af579712345ecd6a146e6dff86b47b8ed" dependencies: - babel-helper-get-function-arity "7.0.0-alpha.15" - babel-template "7.0.0-alpha.15" - babel-traverse "7.0.0-alpha.15" - babel-types "7.0.0-alpha.15" + babel-helper-get-function-arity "7.0.0-alpha.17" + babel-template "7.0.0-alpha.17" + babel-traverse "7.0.0-alpha.17" + babel-types "7.0.0-alpha.17" babel-helper-function-name@7.0.0-alpha.7: version "7.0.0-alpha.7" @@ -126,11 +132,11 @@ babel-helper-function-name@7.0.0-alpha.7: babel-traverse "7.0.0-alpha.7" babel-types "7.0.0-alpha.7" -babel-helper-get-function-arity@7.0.0-alpha.15: - version "7.0.0-alpha.15" - resolved "https://registry.yarnpkg.com/babel-helper-get-function-arity/-/babel-helper-get-function-arity-7.0.0-alpha.15.tgz#17e93206d0b625c3122f4c674478cbed53281f24" +babel-helper-get-function-arity@7.0.0-alpha.17: + version "7.0.0-alpha.17" + resolved "https://registry.yarnpkg.com/babel-helper-get-function-arity/-/babel-helper-get-function-arity-7.0.0-alpha.17.tgz#f9ee3be4b6e892235ee790a8849ada1f88eedcf1" dependencies: - babel-types "7.0.0-alpha.15" + babel-types "7.0.0-alpha.17" babel-helper-get-function-arity@7.0.0-alpha.7: version "7.0.0-alpha.7" @@ -142,21 +148,21 @@ babel-messages@7.0.0-alpha.12: version "7.0.0-alpha.12" resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-7.0.0-alpha.12.tgz#5fda840cb8dfeda06a7894a1e8ab1af695f249c0" -babel-messages@7.0.0-alpha.15: - version "7.0.0-alpha.15" - resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-7.0.0-alpha.15.tgz#97991d32d86a2130aff08fa75a16cfc5acad9e42" +babel-messages@7.0.0-alpha.17: + version "7.0.0-alpha.17" + resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-7.0.0-alpha.17.tgz#777d7f82656d5e3526c1f4c74aaaba99b260d7db" babel-messages@7.0.0-alpha.3: version "7.0.0-alpha.3" resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-7.0.0-alpha.3.tgz#c8390a468478b8384da134612e12a6bc31a684e9" -babel-template@7.0.0-alpha.15: - version "7.0.0-alpha.15" - resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-7.0.0-alpha.15.tgz#08b56562987c9893bbd6646bce4819074ba1cf90" +babel-template@7.0.0-alpha.17: + version "7.0.0-alpha.17" + resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-7.0.0-alpha.17.tgz#085597c0021644c72fa74460a8f76a85e76da943" dependencies: - babel-traverse "7.0.0-alpha.15" - babel-types "7.0.0-alpha.15" - babylon "7.0.0-beta.13" + babel-traverse "7.0.0-alpha.17" + babel-types "7.0.0-alpha.17" + babylon "7.0.0-beta.18" lodash "^4.2.0" babel-template@7.0.0-alpha.7: @@ -182,17 +188,17 @@ babel-traverse@7.0.0-alpha.12: invariant "^2.2.0" lodash "^4.2.0" -babel-traverse@7.0.0-alpha.15: - version "7.0.0-alpha.15" - resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-7.0.0-alpha.15.tgz#d7af52cb8ee6e0867b778da17166e6f01498b11a" +babel-traverse@7.0.0-alpha.17: + version "7.0.0-alpha.17" + resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-7.0.0-alpha.17.tgz#c8a33788274bc4138c529ec9c29f0bacb573f42c" dependencies: - babel-code-frame "7.0.0-alpha.15" - babel-helper-function-name "7.0.0-alpha.15" - babel-messages "7.0.0-alpha.15" - babel-types "7.0.0-alpha.15" - babylon "7.0.0-beta.15" + babel-code-frame "7.0.0-alpha.17" + babel-helper-function-name "7.0.0-alpha.17" + babel-messages "7.0.0-alpha.17" + babel-types "7.0.0-alpha.17" + babylon "7.0.0-beta.18" debug "^2.2.0" - globals "^9.0.0" + globals "^10.0.0" invariant "^2.2.0" lodash "^4.2.0" @@ -217,13 +223,13 @@ babel-types@7.0.0-alpha.12: lodash "^4.2.0" to-fast-properties "^1.0.1" -babel-types@7.0.0-alpha.15: - version "7.0.0-alpha.15" - resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-7.0.0-alpha.15.tgz#e4021e6a432e906678dfc6cc89805ba3234f9f48" +babel-types@7.0.0-alpha.17: + version "7.0.0-alpha.17" + resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-7.0.0-alpha.17.tgz#bc74e19423b015a5ce88727440fc6ae863463dc0" dependencies: esutils "^2.0.2" lodash "^4.2.0" - to-fast-properties "^1.0.1" + to-fast-properties "^2.0.0" babel-types@7.0.0-alpha.7: version "7.0.0-alpha.7" @@ -237,21 +243,13 @@ babylon@7.0.0-beta.12: version "7.0.0-beta.12" resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.12.tgz#f7b9c8a89ff7d6afb57b906d947a4237f9bf53f9" -babylon@7.0.0-beta.13: - version "7.0.0-beta.13" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.13.tgz#12425c1bfd9498be419021ed36b43fe4f0289c0a" - babylon@7.0.0-beta.14: version "7.0.0-beta.14" resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.14.tgz#72aa3c493c984c2edc54d4bc077b74066ed4511d" -babylon@7.0.0-beta.15: - version "7.0.0-beta.15" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.15.tgz#410348bcd21af470a55abea9698c9c651d87f1c6" - -babylon@7.0.0-beta.16: - version "7.0.0-beta.16" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.16.tgz#448ceedeec0a5ef56b62812e3556bf36c5bb9781" +babylon@7.0.0-beta.18: + version "7.0.0-beta.18" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.18.tgz#5c23ee3fdb66358aabf3789779319c5b78a233c7" babylon@7.0.0-beta.8: version "7.0.0-beta.8" @@ -292,6 +290,14 @@ chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" +chalk@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.0.1.tgz#dbec49436d2ae15f536114e76d14656cdbc0f44d" + dependencies: + ansi-styles "^3.1.0" + escape-string-regexp "^1.0.5" + supports-color "^4.0.0" + ci-info@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.0.0.tgz#dc5285f2b4e251821683681c381c3388f46ec534" @@ -335,6 +341,16 @@ code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" +color-convert@^1.9.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.0.tgz#1accf97dd739b983bf994d56fec8f95853641b7a" + dependencies: + color-name "^1.1.1" + +color-name@^1.1.1: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + commander@2.9.0, commander@^2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" @@ -634,6 +650,10 @@ glob@^7.0.3, glob@^7.0.5, glob@^7.1.2: once "^1.3.0" path-is-absolute "^1.0.0" +globals@^10.0.0: + version "10.0.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-10.0.0.tgz#a5803a1abe923b52bc33a59cffeaf6e0748cf3f7" + globals@^9.0.0, globals@^9.17.0: version "9.18.0" resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" @@ -671,6 +691,10 @@ has-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" +has-flag@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" + husky@^0.14.0: version "0.14.1" resolved "https://registry.yarnpkg.com/husky/-/husky-0.14.1.tgz#8edba33e728ceed75343e88bb8002e4cbd8d1b40" @@ -1354,6 +1378,12 @@ supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" +supports-color@^4.0.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.2.1.tgz#65a4bb2631e90e02420dba5554c375a4754bb836" + dependencies: + has-flag "^2.0.0" + symbol-observable@^1.0.1: version "1.0.4" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.4.tgz#29bf615d4aa7121bdd898b22d4b3f9bc4e2aa03d" @@ -1387,6 +1417,10 @@ to-fast-properties@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" +to-fast-properties@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + tryit@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/tryit/-/tryit-1.0.3.tgz#393be730a9446fd1ead6da59a014308f36c289cb" From bc9b69590b6577e260c92693981fee7f75c77f5c Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 26 Jul 2017 16:19:29 -0400 Subject: [PATCH 379/569] 8.0.0-alpha.17 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index dc48631d79d8..664ec6a0ba9b 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "8.0.0-alpha.15", + "version": "8.0.0-alpha.17", "description": "Custom parser for ESLint", "main": "index.js", "files": [ From 15e2aa0a2438c1bd8f827dfd26ede8fa1f495acc Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Wed, 2 Aug 2017 14:37:01 +0200 Subject: [PATCH 380/569] Remove already fixed workaround (babel/babel-eslint#508) --- eslint/babel-eslint-parser/babylon-to-espree/toAST.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/eslint/babel-eslint-parser/babylon-to-espree/toAST.js b/eslint/babel-eslint-parser/babylon-to-espree/toAST.js index 7e3e6876fc8c..07351b135ba3 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/toAST.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/toAST.js @@ -50,11 +50,6 @@ var astTransformVisitor = { node.type = "Literal"; } - // TODO estree plugin bug - if (node.type === "Property") { - if (!node.shorthand) node.shorthand = false; - } - if ( path.isRestElement() && path.parent && From d61b06b8b524b246f48effc20617f2dfb0b17385 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 12 Sep 2017 09:42:30 -0400 Subject: [PATCH 381/569] update to beta.0 --- eslint/babel-eslint-parser/package.json | 8 +- eslint/babel-eslint-parser/yarn.lock | 122 +++++++++++++----------- 2 files changed, 68 insertions(+), 62 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 664ec6a0ba9b..e4dd26ce8c21 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -12,10 +12,10 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "babel-code-frame": "7.0.0-alpha.17", - "babel-traverse": "7.0.0-alpha.17", - "babel-types": "7.0.0-alpha.17", - "babylon": "7.0.0-beta.18" + "babel-code-frame": "7.0.0-beta.0", + "babel-traverse": "7.0.0-beta.0", + "babel-types": "7.0.0-beta.0", + "babylon": "7.0.0-beta.22" }, "scripts": { "test": "npm run lint && npm run test-only", diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index d93d9583385d..3fcbc8d67e62 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -81,14 +81,6 @@ babel-code-frame@7.0.0-alpha.12: esutils "^2.0.2" js-tokens "^3.0.0" -babel-code-frame@7.0.0-alpha.17: - version "7.0.0-alpha.17" - resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-7.0.0-alpha.17.tgz#06a5daddb0946d8e95392477065a86480474f19c" - dependencies: - chalk "^2.0.0" - esutils "^2.0.2" - js-tokens "^3.0.0" - babel-code-frame@7.0.0-alpha.3: version "7.0.0-alpha.3" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-7.0.0-alpha.3.tgz#9ff265eaaac94b58dfc7ca4a4eecf389d5f4d344" @@ -97,6 +89,14 @@ babel-code-frame@7.0.0-alpha.3: esutils "^2.0.2" js-tokens "^3.0.0" +babel-code-frame@7.0.0-beta.0: + version "7.0.0-beta.0" + resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-7.0.0-beta.0.tgz#418a7b5f3f7dc9a4670e61b1158b4c5661bec98d" + dependencies: + chalk "^2.0.0" + esutils "^2.0.2" + js-tokens "^3.0.0" + babel-code-frame@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4" @@ -114,15 +114,6 @@ babel-eslint@^8.0.0-alpha.13: babel-types "7.0.0-alpha.12" babylon "7.0.0-beta.14" -babel-helper-function-name@7.0.0-alpha.17: - version "7.0.0-alpha.17" - resolved "https://registry.yarnpkg.com/babel-helper-function-name/-/babel-helper-function-name-7.0.0-alpha.17.tgz#b976290af579712345ecd6a146e6dff86b47b8ed" - dependencies: - babel-helper-get-function-arity "7.0.0-alpha.17" - babel-template "7.0.0-alpha.17" - babel-traverse "7.0.0-alpha.17" - babel-types "7.0.0-alpha.17" - babel-helper-function-name@7.0.0-alpha.7: version "7.0.0-alpha.7" resolved "https://registry.yarnpkg.com/babel-helper-function-name/-/babel-helper-function-name-7.0.0-alpha.7.tgz#19aecddc5402f941c5726802993077b41ea9832d" @@ -132,11 +123,14 @@ babel-helper-function-name@7.0.0-alpha.7: babel-traverse "7.0.0-alpha.7" babel-types "7.0.0-alpha.7" -babel-helper-get-function-arity@7.0.0-alpha.17: - version "7.0.0-alpha.17" - resolved "https://registry.yarnpkg.com/babel-helper-get-function-arity/-/babel-helper-get-function-arity-7.0.0-alpha.17.tgz#f9ee3be4b6e892235ee790a8849ada1f88eedcf1" +babel-helper-function-name@7.0.0-beta.0: + version "7.0.0-beta.0" + resolved "https://registry.yarnpkg.com/babel-helper-function-name/-/babel-helper-function-name-7.0.0-beta.0.tgz#d1b6779b647e5c5c31ebeb05e13b998e4d352d56" dependencies: - babel-types "7.0.0-alpha.17" + babel-helper-get-function-arity "7.0.0-beta.0" + babel-template "7.0.0-beta.0" + babel-traverse "7.0.0-beta.0" + babel-types "7.0.0-beta.0" babel-helper-get-function-arity@7.0.0-alpha.7: version "7.0.0-alpha.7" @@ -144,26 +138,23 @@ babel-helper-get-function-arity@7.0.0-alpha.7: dependencies: babel-types "7.0.0-alpha.7" +babel-helper-get-function-arity@7.0.0-beta.0: + version "7.0.0-beta.0" + resolved "https://registry.yarnpkg.com/babel-helper-get-function-arity/-/babel-helper-get-function-arity-7.0.0-beta.0.tgz#9d1ab7213bb5efe1ef1638a8ea1489969b5a8b6e" + dependencies: + babel-types "7.0.0-beta.0" + babel-messages@7.0.0-alpha.12: version "7.0.0-alpha.12" resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-7.0.0-alpha.12.tgz#5fda840cb8dfeda06a7894a1e8ab1af695f249c0" -babel-messages@7.0.0-alpha.17: - version "7.0.0-alpha.17" - resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-7.0.0-alpha.17.tgz#777d7f82656d5e3526c1f4c74aaaba99b260d7db" - babel-messages@7.0.0-alpha.3: version "7.0.0-alpha.3" resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-7.0.0-alpha.3.tgz#c8390a468478b8384da134612e12a6bc31a684e9" -babel-template@7.0.0-alpha.17: - version "7.0.0-alpha.17" - resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-7.0.0-alpha.17.tgz#085597c0021644c72fa74460a8f76a85e76da943" - dependencies: - babel-traverse "7.0.0-alpha.17" - babel-types "7.0.0-alpha.17" - babylon "7.0.0-beta.18" - lodash "^4.2.0" +babel-messages@7.0.0-beta.0: + version "7.0.0-beta.0" + resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-7.0.0-beta.0.tgz#6df01296e49fc8fbd0637394326a167f36da817b" babel-template@7.0.0-alpha.7: version "7.0.0-alpha.7" @@ -174,6 +165,15 @@ babel-template@7.0.0-alpha.7: babylon "7.0.0-beta.8" lodash "^4.2.0" +babel-template@7.0.0-beta.0: + version "7.0.0-beta.0" + resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-7.0.0-beta.0.tgz#85083cf9e4395d5e48bf5154d7a8d6991cafecfb" + dependencies: + babel-traverse "7.0.0-beta.0" + babel-types "7.0.0-beta.0" + babylon "7.0.0-beta.22" + lodash "^4.2.0" + babel-traverse@7.0.0-alpha.12: version "7.0.0-alpha.12" resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-7.0.0-alpha.12.tgz#0c0855a60287e56e54cf61ea9f135cdf759d6ad0" @@ -188,20 +188,6 @@ babel-traverse@7.0.0-alpha.12: invariant "^2.2.0" lodash "^4.2.0" -babel-traverse@7.0.0-alpha.17: - version "7.0.0-alpha.17" - resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-7.0.0-alpha.17.tgz#c8a33788274bc4138c529ec9c29f0bacb573f42c" - dependencies: - babel-code-frame "7.0.0-alpha.17" - babel-helper-function-name "7.0.0-alpha.17" - babel-messages "7.0.0-alpha.17" - babel-types "7.0.0-alpha.17" - babylon "7.0.0-beta.18" - debug "^2.2.0" - globals "^10.0.0" - invariant "^2.2.0" - lodash "^4.2.0" - babel-traverse@7.0.0-alpha.7: version "7.0.0-alpha.7" resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-7.0.0-alpha.7.tgz#61cc89061b0ad0a5f9fc6df81117fac428bc4148" @@ -215,6 +201,20 @@ babel-traverse@7.0.0-alpha.7: invariant "^2.2.0" lodash "^4.2.0" +babel-traverse@7.0.0-beta.0: + version "7.0.0-beta.0" + resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-7.0.0-beta.0.tgz#da14be9b762f62a2f060db464eaafdd8cd072a41" + dependencies: + babel-code-frame "7.0.0-beta.0" + babel-helper-function-name "7.0.0-beta.0" + babel-messages "7.0.0-beta.0" + babel-types "7.0.0-beta.0" + babylon "7.0.0-beta.22" + debug "^3.0.1" + globals "^10.0.0" + invariant "^2.2.0" + lodash "^4.2.0" + babel-types@7.0.0-alpha.12: version "7.0.0-alpha.12" resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-7.0.0-alpha.12.tgz#d7b2c6d0c49c518fd36de5ac14f4f50bed6de7e5" @@ -223,14 +223,6 @@ babel-types@7.0.0-alpha.12: lodash "^4.2.0" to-fast-properties "^1.0.1" -babel-types@7.0.0-alpha.17: - version "7.0.0-alpha.17" - resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-7.0.0-alpha.17.tgz#bc74e19423b015a5ce88727440fc6ae863463dc0" - dependencies: - esutils "^2.0.2" - lodash "^4.2.0" - to-fast-properties "^2.0.0" - babel-types@7.0.0-alpha.7: version "7.0.0-alpha.7" resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-7.0.0-alpha.7.tgz#4bdb77386d1f6e2001f42fa9ac21b6c3d6ad0d82" @@ -239,6 +231,14 @@ babel-types@7.0.0-alpha.7: lodash "^4.2.0" to-fast-properties "^1.0.1" +babel-types@7.0.0-beta.0: + version "7.0.0-beta.0" + resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-7.0.0-beta.0.tgz#eb8b6e556470e6dcc4aef982d79ad229469b5169" + dependencies: + esutils "^2.0.2" + lodash "^4.2.0" + to-fast-properties "^2.0.0" + babylon@7.0.0-beta.12: version "7.0.0-beta.12" resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.12.tgz#f7b9c8a89ff7d6afb57b906d947a4237f9bf53f9" @@ -247,9 +247,9 @@ babylon@7.0.0-beta.14: version "7.0.0-beta.14" resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.14.tgz#72aa3c493c984c2edc54d4bc077b74066ed4511d" -babylon@7.0.0-beta.18: - version "7.0.0-beta.18" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.18.tgz#5c23ee3fdb66358aabf3789779319c5b78a233c7" +babylon@7.0.0-beta.22: + version "7.0.0-beta.22" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.22.tgz#74f0ad82ed7c7c3cfeab74cf684f815104161b65" babylon@7.0.0-beta.8: version "7.0.0-beta.8" @@ -410,6 +410,12 @@ debug@^2.2.0, debug@^2.6.8: dependencies: ms "2.0.0" +debug@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.0.1.tgz#0564c612b521dc92d9f2988f0549e34f9c98db64" + dependencies: + ms "2.0.0" + dedent@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" From b576677e9f69193984c8251e1ea2faf6baf78068 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 12 Sep 2017 09:44:23 -0400 Subject: [PATCH 382/569] 8.0.0 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index e4dd26ce8c21..02318fd23586 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "8.0.0-alpha.17", + "version": "8.0.0", "description": "Custom parser for ESLint", "main": "index.js", "files": [ From 04cf4246b850f11581373602629e6599f6f496e6 Mon Sep 17 00:00:00 2001 From: Jordan Gensler Date: Tue, 26 Sep 2017 13:17:44 -0700 Subject: [PATCH 383/569] Adding optionalCatchBinding to plugins. (babel/babel-eslint#521) --- eslint/babel-eslint-parser/index.js | 1 + eslint/babel-eslint-parser/test/non-regression.js | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index 79eb5a3c7db1..ed1b8ff3a0e0 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -414,6 +414,7 @@ exports.parseNoPatch = function(code, options) { "importMeta", "classPrivateProperties", "bigInt", + "optionalCatchBinding", ], }; diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 72f4ae07a665..4161af03d67b 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1845,4 +1845,15 @@ describe("verify", () => { [] ); }); + + it("works with optionalCatchBinding", () => { + verifyAndAssertMessages( + unpad(` + try {} catch {} + try {} catch {} finally {} + `), + {}, + [] + ); + }); }); From 5b3caf7b66980f6fe64541092883ea053725d9d8 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Wed, 11 Oct 2017 14:14:29 +0200 Subject: [PATCH 384/569] chore(package): update mocha to version 4.0.0 (babel/babel-eslint#524) --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 02318fd23586..c739f2fb0df0 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -45,7 +45,7 @@ "espree": "^3.4.0", "husky": "^0.14.0", "lint-staged": "^4.0.0", - "mocha": "^3.0.0", + "mocha": "^4.0.0", "prettier": "^1.4.4" }, "lint-staged": { From b0d8baf320efdab952bee64620e9310ebdd84a44 Mon Sep 17 00:00:00 2001 From: Clement Hoang Date: Tue, 31 Oct 2017 11:50:35 -0700 Subject: [PATCH 385/569] Update README.md support (babel/babel-eslint#531) [skip ci] #linting channel is now archived in babel slack. --- eslint/babel-eslint-parser/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index be6878570a22..23f13c3b1080 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -11,7 +11,7 @@ You only need to use babel-eslint if you are using types (Flow) or experimental > If there is an issue, first check if it can be reproduced with the regular parser or with the latest versions of `eslint` and `babel-eslint`! -For questions and support please visit the [`#linting`](https://babeljs.slack.com/messages/linting/) babel slack channel (sign up [here](https://babel-slack.herokuapp.com))! +For questions and support please visit the [`#discussion`](https://babeljs.slack.com/messages/discussion/) babel slack channel (sign up [here](https://github.com/babel/notes/issues/38)) or eslint [gitter](https://gitter.im/eslint/eslint)! > Note that the `ecmaFeatures` config property may still be required for ESLint to work properly with features not in ECMAScript 5 by default. Examples are `globalReturn` and `modules`). From c958724bbd337bf9ba3e21cbe8482aec10523b9c Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 26 Sep 2017 16:18:43 -0400 Subject: [PATCH 386/569] 8.0.1 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index c739f2fb0df0..52c726309614 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "8.0.0", + "version": "8.0.1", "description": "Custom parser for ESLint", "main": "index.js", "files": [ From 38f372b8ea9552b40700acbc3bf435ea146f2afd Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Mon, 6 Nov 2017 12:25:35 -0500 Subject: [PATCH 387/569] fix(package): update babylon to version 7.0.0-beta.31 (babel/babel-eslint#533) --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 52c726309614..1f702c222741 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -15,7 +15,7 @@ "babel-code-frame": "7.0.0-beta.0", "babel-traverse": "7.0.0-beta.0", "babel-types": "7.0.0-beta.0", - "babylon": "7.0.0-beta.22" + "babylon": "7.0.0-beta.31" }, "scripts": { "test": "npm run lint && npm run test-only", From f43062ebbbc79f07a1b9408ab0e0b88dcc9e0c2c Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 6 Nov 2017 12:47:47 -0500 Subject: [PATCH 388/569] Allow ^ version for babel dependencies (babel/babel-eslint#534) --- eslint/babel-eslint-parser/package.json | 10 +- eslint/babel-eslint-parser/yarn.lock | 311 ++++++++---------------- 2 files changed, 104 insertions(+), 217 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 1f702c222741..0d24a1e4fe19 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -12,10 +12,10 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "babel-code-frame": "7.0.0-beta.0", - "babel-traverse": "7.0.0-beta.0", - "babel-types": "7.0.0-beta.0", - "babylon": "7.0.0-beta.31" + "@babel/code-frame": "^7.0.0-beta.31", + "@babel/traverse": "^7.0.0-beta.31", + "@babel/types": "^7.0.0-beta.31", + "babylon": "^7.0.0-beta.31" }, "scripts": { "test": "npm run lint && npm run test-only", @@ -36,7 +36,7 @@ }, "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { - "babel-eslint": "^8.0.0-alpha.13", + "babel-eslint": "^8.0.0", "dedent": "^0.7.0", "eslint": "^4.1.0", "eslint-config-babel": "^7.0.1", diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index 3fcbc8d67e62..438860714273 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -2,6 +2,59 @@ # yarn lockfile v1 +"@babel/code-frame@7.0.0-beta.31", "@babel/code-frame@^7.0.0-beta.31": + version "7.0.0-beta.31" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.31.tgz#473d021ecc573a2cce1c07d5b509d5215f46ba35" + dependencies: + chalk "^2.0.0" + esutils "^2.0.2" + js-tokens "^3.0.0" + +"@babel/helper-function-name@7.0.0-beta.31": + version "7.0.0-beta.31" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.31.tgz#afe63ad799209989348b1109b44feb66aa245f57" + dependencies: + "@babel/helper-get-function-arity" "7.0.0-beta.31" + "@babel/template" "7.0.0-beta.31" + "@babel/traverse" "7.0.0-beta.31" + "@babel/types" "7.0.0-beta.31" + +"@babel/helper-get-function-arity@7.0.0-beta.31": + version "7.0.0-beta.31" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.31.tgz#1176d79252741218e0aec872ada07efb2b37a493" + dependencies: + "@babel/types" "7.0.0-beta.31" + +"@babel/template@7.0.0-beta.31": + version "7.0.0-beta.31" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.31.tgz#577bb29389f6c497c3e7d014617e7d6713f68bda" + dependencies: + "@babel/code-frame" "7.0.0-beta.31" + "@babel/types" "7.0.0-beta.31" + babylon "7.0.0-beta.31" + lodash "^4.2.0" + +"@babel/traverse@7.0.0-beta.31", "@babel/traverse@^7.0.0-beta.31": + version "7.0.0-beta.31" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.31.tgz#db399499ad74aefda014f0c10321ab255134b1df" + dependencies: + "@babel/code-frame" "7.0.0-beta.31" + "@babel/helper-function-name" "7.0.0-beta.31" + "@babel/types" "7.0.0-beta.31" + babylon "7.0.0-beta.31" + debug "^3.0.1" + globals "^10.0.0" + invariant "^2.2.0" + lodash "^4.2.0" + +"@babel/types@7.0.0-beta.31", "@babel/types@^7.0.0-beta.31": + version "7.0.0-beta.31" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.31.tgz#42c9c86784f674c173fb21882ca9643334029de4" + dependencies: + esutils "^2.0.2" + lodash "^4.2.0" + to-fast-properties "^2.0.0" + acorn-jsx@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" @@ -73,22 +126,6 @@ arrify@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" -babel-code-frame@7.0.0-alpha.12: - version "7.0.0-alpha.12" - resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-7.0.0-alpha.12.tgz#26fbb2eab1c20763271fecb6b04a108756fae61f" - dependencies: - chalk "^1.1.0" - esutils "^2.0.2" - js-tokens "^3.0.0" - -babel-code-frame@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-7.0.0-alpha.3.tgz#9ff265eaaac94b58dfc7ca4a4eecf389d5f4d344" - dependencies: - chalk "^1.1.0" - esutils "^2.0.2" - js-tokens "^3.0.0" - babel-code-frame@7.0.0-beta.0: version "7.0.0-beta.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-7.0.0-beta.0.tgz#418a7b5f3f7dc9a4670e61b1158b4c5661bec98d" @@ -105,23 +142,14 @@ babel-code-frame@^6.22.0: esutils "^2.0.2" js-tokens "^3.0.0" -babel-eslint@^8.0.0-alpha.13: - version "8.0.0-alpha.13" - resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-8.0.0-alpha.13.tgz#47c6f04d4c7ef5084f5a849ffe5a8a48f17db7df" +babel-eslint@^8.0.0: + version "8.0.1" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-8.0.1.tgz#5d718be7a328625d006022eb293ed3008cbd6346" dependencies: - babel-code-frame "7.0.0-alpha.12" - babel-traverse "7.0.0-alpha.12" - babel-types "7.0.0-alpha.12" - babylon "7.0.0-beta.14" - -babel-helper-function-name@7.0.0-alpha.7: - version "7.0.0-alpha.7" - resolved "https://registry.yarnpkg.com/babel-helper-function-name/-/babel-helper-function-name-7.0.0-alpha.7.tgz#19aecddc5402f941c5726802993077b41ea9832d" - dependencies: - babel-helper-get-function-arity "7.0.0-alpha.7" - babel-template "7.0.0-alpha.7" - babel-traverse "7.0.0-alpha.7" - babel-types "7.0.0-alpha.7" + babel-code-frame "7.0.0-beta.0" + babel-traverse "7.0.0-beta.0" + babel-types "7.0.0-beta.0" + babylon "7.0.0-beta.22" babel-helper-function-name@7.0.0-beta.0: version "7.0.0-beta.0" @@ -132,39 +160,16 @@ babel-helper-function-name@7.0.0-beta.0: babel-traverse "7.0.0-beta.0" babel-types "7.0.0-beta.0" -babel-helper-get-function-arity@7.0.0-alpha.7: - version "7.0.0-alpha.7" - resolved "https://registry.yarnpkg.com/babel-helper-get-function-arity/-/babel-helper-get-function-arity-7.0.0-alpha.7.tgz#16e6526ecefc5537826012365e577de2ccba02f5" - dependencies: - babel-types "7.0.0-alpha.7" - babel-helper-get-function-arity@7.0.0-beta.0: version "7.0.0-beta.0" resolved "https://registry.yarnpkg.com/babel-helper-get-function-arity/-/babel-helper-get-function-arity-7.0.0-beta.0.tgz#9d1ab7213bb5efe1ef1638a8ea1489969b5a8b6e" dependencies: babel-types "7.0.0-beta.0" -babel-messages@7.0.0-alpha.12: - version "7.0.0-alpha.12" - resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-7.0.0-alpha.12.tgz#5fda840cb8dfeda06a7894a1e8ab1af695f249c0" - -babel-messages@7.0.0-alpha.3: - version "7.0.0-alpha.3" - resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-7.0.0-alpha.3.tgz#c8390a468478b8384da134612e12a6bc31a684e9" - babel-messages@7.0.0-beta.0: version "7.0.0-beta.0" resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-7.0.0-beta.0.tgz#6df01296e49fc8fbd0637394326a167f36da817b" -babel-template@7.0.0-alpha.7: - version "7.0.0-alpha.7" - resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-7.0.0-alpha.7.tgz#82e26500980d1b3f14d9ebe8ae8b9325dc158392" - dependencies: - babel-traverse "7.0.0-alpha.7" - babel-types "7.0.0-alpha.7" - babylon "7.0.0-beta.8" - lodash "^4.2.0" - babel-template@7.0.0-beta.0: version "7.0.0-beta.0" resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-7.0.0-beta.0.tgz#85083cf9e4395d5e48bf5154d7a8d6991cafecfb" @@ -174,33 +179,6 @@ babel-template@7.0.0-beta.0: babylon "7.0.0-beta.22" lodash "^4.2.0" -babel-traverse@7.0.0-alpha.12: - version "7.0.0-alpha.12" - resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-7.0.0-alpha.12.tgz#0c0855a60287e56e54cf61ea9f135cdf759d6ad0" - dependencies: - babel-code-frame "7.0.0-alpha.12" - babel-helper-function-name "7.0.0-alpha.7" - babel-messages "7.0.0-alpha.12" - babel-types "7.0.0-alpha.12" - babylon "7.0.0-beta.12" - debug "^2.2.0" - globals "^9.0.0" - invariant "^2.2.0" - lodash "^4.2.0" - -babel-traverse@7.0.0-alpha.7: - version "7.0.0-alpha.7" - resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-7.0.0-alpha.7.tgz#61cc89061b0ad0a5f9fc6df81117fac428bc4148" - dependencies: - babel-code-frame "7.0.0-alpha.3" - babel-messages "7.0.0-alpha.3" - babel-types "7.0.0-alpha.7" - babylon "7.0.0-beta.8" - debug "^2.2.0" - globals "^9.0.0" - invariant "^2.2.0" - lodash "^4.2.0" - babel-traverse@7.0.0-beta.0: version "7.0.0-beta.0" resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-7.0.0-beta.0.tgz#da14be9b762f62a2f060db464eaafdd8cd072a41" @@ -215,22 +193,6 @@ babel-traverse@7.0.0-beta.0: invariant "^2.2.0" lodash "^4.2.0" -babel-types@7.0.0-alpha.12: - version "7.0.0-alpha.12" - resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-7.0.0-alpha.12.tgz#d7b2c6d0c49c518fd36de5ac14f4f50bed6de7e5" - dependencies: - esutils "^2.0.2" - lodash "^4.2.0" - to-fast-properties "^1.0.1" - -babel-types@7.0.0-alpha.7: - version "7.0.0-alpha.7" - resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-7.0.0-alpha.7.tgz#4bdb77386d1f6e2001f42fa9ac21b6c3d6ad0d82" - dependencies: - esutils "^2.0.2" - lodash "^4.2.0" - to-fast-properties "^1.0.1" - babel-types@7.0.0-beta.0: version "7.0.0-beta.0" resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-7.0.0-beta.0.tgz#eb8b6e556470e6dcc4aef982d79ad229469b5169" @@ -239,21 +201,13 @@ babel-types@7.0.0-beta.0: lodash "^4.2.0" to-fast-properties "^2.0.0" -babylon@7.0.0-beta.12: - version "7.0.0-beta.12" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.12.tgz#f7b9c8a89ff7d6afb57b906d947a4237f9bf53f9" - -babylon@7.0.0-beta.14: - version "7.0.0-beta.14" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.14.tgz#72aa3c493c984c2edc54d4bc077b74066ed4511d" - babylon@7.0.0-beta.22: version "7.0.0-beta.22" resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.22.tgz#74f0ad82ed7c7c3cfeab74cf684f815104161b65" -babylon@7.0.0-beta.8: - version "7.0.0-beta.8" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.8.tgz#2bdc5ae366041442c27e068cce6f0d7c06ea9949" +babylon@7.0.0-beta.31, babylon@^7.0.0-beta.31: + version "7.0.0-beta.31" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.31.tgz#7ec10f81e0e456fd0f855ad60fa30c2ac454283f" balanced-match@^1.0.0: version "1.0.0" @@ -351,7 +305,11 @@ color-name@^1.1.1: version "1.1.3" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" -commander@2.9.0, commander@^2.9.0: +commander@2.11.0: + version "2.11.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" + +commander@^2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" dependencies: @@ -398,13 +356,13 @@ date-fns@^1.27.2: version "1.28.5" resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.28.5.tgz#257cfc45d322df45ef5658665967ee841cd73faf" -debug@2.6.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.0.tgz#bc596bcabe7617f11d9fa15361eded5608b8499b" +debug@3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" dependencies: - ms "0.7.2" + ms "2.0.0" -debug@^2.2.0, debug@^2.6.8: +debug@^2.6.8: version "2.6.8" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc" dependencies: @@ -436,9 +394,9 @@ del@^2.0.2: pinkie-promise "^2.0.0" rimraf "^2.2.8" -diff@3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-3.2.0.tgz#c9ce393a4b7cbd0b058a725c93df299027868ff9" +diff@3.3.1: + version "3.3.1" + resolved "https://registry.yarnpkg.com/diff/-/diff-3.3.1.tgz#aa8567a6eed03c531fc89d3f711cd0e5259dec75" doctrine@^2.0.0: version "2.0.0" @@ -634,18 +592,7 @@ get-stream@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" -glob@7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.2" - once "^1.3.0" - path-is-absolute "^1.0.0" - -glob@^7.0.3, glob@^7.0.5, glob@^7.1.2: +glob@7.1.2, glob@^7.0.3, glob@^7.0.5, glob@^7.1.2: version "7.1.2" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" dependencies: @@ -660,7 +607,7 @@ globals@^10.0.0: version "10.0.0" resolved "https://registry.yarnpkg.com/globals/-/globals-10.0.0.tgz#a5803a1abe923b52bc33a59cffeaf6e0748cf3f7" -globals@^9.0.0, globals@^9.17.0: +globals@^9.17.0: version "9.18.0" resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" @@ -683,9 +630,9 @@ graceful-fs@^4.1.2: version "1.0.1" resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" -growl@1.9.2: - version "1.9.2" - resolved "https://registry.yarnpkg.com/growl/-/growl-1.9.2.tgz#0ea7743715db8d8de2c5ede1775e1b45ac85c02f" +growl@1.10.3: + version "1.10.3" + resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.3.tgz#1926ba90cf3edfe2adb4927f5880bc22c66c790f" has-ansi@^2.0.0: version "2.0.0" @@ -693,14 +640,14 @@ has-ansi@^2.0.0: dependencies: ansi-regex "^2.0.0" -has-flag@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" - has-flag@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" +he@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" + husky@^0.14.0: version "0.14.1" resolved "https://registry.yarnpkg.com/husky/-/husky-0.14.1.tgz#8edba33e728ceed75343e88bb8002e4cbd8d1b40" @@ -869,10 +816,6 @@ json-stable-stringify@^1.0.1: dependencies: jsonify "~0.0.0" -json3@3.3.2: - version "3.3.2" - resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.2.tgz#3c0434743df93e2f5c42aee7b19bcb483575f4e1" - jsonify@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" @@ -949,57 +892,10 @@ listr@^0.12.0: stream-to-observable "^0.1.0" strip-ansi "^3.0.1" -lodash._baseassign@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz#8c38a099500f215ad09e59f1722fd0c52bfe0a4e" - dependencies: - lodash._basecopy "^3.0.0" - lodash.keys "^3.0.0" - -lodash._basecopy@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36" - -lodash._basecreate@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz#1bc661614daa7fc311b7d03bf16806a0213cf821" - -lodash._getnative@^3.0.0: - version "3.9.1" - resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" - -lodash._isiterateecall@^3.0.0: - version "3.0.9" - resolved "https://registry.yarnpkg.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz#5203ad7ba425fae842460e696db9cf3e6aac057c" - lodash.chunk@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/lodash.chunk/-/lodash.chunk-4.2.0.tgz#66e5ce1f76ed27b4303d8c6512e8d1216e8106bc" -lodash.create@3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/lodash.create/-/lodash.create-3.1.1.tgz#d7f2849f0dbda7e04682bb8cd72ab022461debe7" - dependencies: - lodash._baseassign "^3.0.0" - lodash._basecreate "^3.0.0" - lodash._isiterateecall "^3.0.0" - -lodash.isarguments@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" - -lodash.isarray@^3.0.0: - version "3.0.4" - resolved "https://registry.yarnpkg.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55" - -lodash.keys@^3.0.0: - version "3.1.2" - resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a" - dependencies: - lodash._getnative "^3.0.0" - lodash.isarguments "^3.0.0" - lodash.isarray "^3.0.0" - lodash@^4.0.0, lodash@^4.15.0, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" @@ -1054,25 +950,20 @@ mkdirp@0.5.1, mkdirp@^0.5.1: dependencies: minimist "0.0.8" -mocha@^3.0.0: - version "3.4.2" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-3.4.2.tgz#d0ef4d332126dbf18d0d640c9b382dd48be97594" +mocha@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-4.0.1.tgz#0aee5a95cf69a4618820f5e51fa31717117daf1b" dependencies: browser-stdout "1.3.0" - commander "2.9.0" - debug "2.6.0" - diff "3.2.0" + commander "2.11.0" + debug "3.1.0" + diff "3.3.1" escape-string-regexp "1.0.5" - glob "7.1.1" - growl "1.9.2" - json3 "3.3.2" - lodash.create "3.1.1" + glob "7.1.2" + growl "1.10.3" + he "1.1.1" mkdirp "0.5.1" - supports-color "3.1.2" - -ms@0.7.2: - version "0.7.2" - resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.2.tgz#ae25cf2512b3885a1d95d7f037868d8431124765" + supports-color "4.4.0" ms@2.0.0: version "2.0.0" @@ -1374,11 +1265,11 @@ strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" -supports-color@3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.1.2.tgz#72a262894d9d408b956ca05ff37b2ed8a6e2a2d5" +supports-color@4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.4.0.tgz#883f7ddabc165142b2a61427f3352ded195d1a3e" dependencies: - has-flag "^1.0.0" + has-flag "^2.0.0" supports-color@^2.0.0: version "2.0.0" @@ -1419,10 +1310,6 @@ tmp@^0.0.31: dependencies: os-tmpdir "~1.0.1" -to-fast-properties@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" - to-fast-properties@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" From 090269e5a09353675060174fdbb48a481f2ce96f Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 6 Nov 2017 12:51:19 -0500 Subject: [PATCH 389/569] Always use unpad (babel/babel-eslint#535) --- .../babel-eslint-parser/test/babel-eslint.js | 267 ++++++++---------- 1 file changed, 118 insertions(+), 149 deletions(-) diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 4683aa86adeb..ad9838f8b5ca 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -61,6 +61,7 @@ function lookup(obj, keypath, backwardsDepth) { } function parseAndAssertSame(code) { + code = unpad(code); var esAST = espree.parse(code, { ecmaFeatures: { // enable JSX parsing @@ -177,30 +178,26 @@ describe("babylon-to-esprima", () => { }); it("template also with braces #96", () => { - parseAndAssertSame( - unpad(` - export default function f1() { - function f2(foo) { - const bar = 3; - return \`\${foo} \${bar}\`; - } - return f2; + parseAndAssertSame(` + export default function f1() { + function f2(foo) { + const bar = 3; + return \`\${foo} \${bar}\`; } - `) - ); + return f2; + } + `); }); it("template with destructuring #31", () => { - parseAndAssertSame( - unpad(` - module.exports = { - render() { - var {name} = this.props; - return Math.max(null, \`Name: \${name}, Name: \${name}\`); - } - }; - `) - ); + parseAndAssertSame(` + module.exports = { + render() { + var {name} = this.props; + return Math.max(null, \`Name: \${name}, Name: \${name}\`); + } + }; + `); }); }); @@ -301,40 +298,34 @@ describe("babylon-to-esprima", () => { }); it("line comments", () => { - parseAndAssertSame( - unpad(` - // single comment - var foo = 15; // comment next to statement - // second comment after statement - `) - ); + parseAndAssertSame(` + // single comment + var foo = 15; // comment next to statement + // second comment after statement + `); }); it("block comments", () => { - parseAndAssertSame( - unpad(` - /* single comment */ - var foo = 15; /* comment next to statement */ - /* - * multiline - * comment - */ - `) - ); + parseAndAssertSame(` + /* single comment */ + var foo = 15; /* comment next to statement */ + /* + * multiline + * comment + */ + `); }); it("block comments #124", () => { - parseAndAssertSame( - unpad(` - React.createClass({ - render() { - // return ( - //
- // ); // <-- this is the line that is reported - } - }); - `) - ); + parseAndAssertSame(` + React.createClass({ + render() { + // return ( + //
+ // ); // <-- this is the line that is reported + } + }); + `); }); it("null", () => { @@ -374,43 +365,37 @@ describe("babylon-to-esprima", () => { }); it("jsdoc", () => { - parseAndAssertSame( - unpad(` - /** - * @param {object} options - * @return {number} - */ - const test = function({ a, b, c }) { - return a + b + c; - }; - module.exports = test; - `) - ); + parseAndAssertSame(` + /** + * @param {object} options + * @return {number} + */ + const test = function({ a, b, c }) { + return a + b + c; + }; + module.exports = test; + `); }); it("empty block with comment", () => { - parseAndAssertSame( - unpad(` - function a () { - try { - b(); - } catch (e) { - // asdf - } + parseAndAssertSame(` + function a () { + try { + b(); + } catch (e) { + // asdf } - `) - ); + } + `); }); describe("babel tests", () => { it("MethodDefinition", () => { - parseAndAssertSame( - unpad(` - export default class A { - a() {} - } - `) - ); + parseAndAssertSame(` + export default class A { + a() {} + } + `); }); it("MethodDefinition 2", () => { @@ -420,43 +405,37 @@ describe("babylon-to-esprima", () => { }); it("ClassMethod", () => { - parseAndAssertSame( - unpad(` - class A { - constructor() { - } + parseAndAssertSame(` + class A { + constructor() { } - `) - ); + } + `); }); it("ClassMethod multiple params", () => { - parseAndAssertSame( - unpad(` - class A { - constructor(a, b, c) { - } + parseAndAssertSame(` + class A { + constructor(a, b, c) { } - `) - ); + } + `); }); it("ClassMethod multiline", () => { - parseAndAssertSame( - unpad(` - class A { - constructor ( - a, - b, - c - ) + parseAndAssertSame(` + class A { + constructor ( + a, + b, + c + ) - { + { - } } - `) - ); + } + `); }); it("ClassMethod oneline", () => { @@ -464,14 +443,12 @@ describe("babylon-to-esprima", () => { }); it("ObjectMethod", () => { - parseAndAssertSame( - unpad(` - var a = { - b(c) { - } + parseAndAssertSame(` + var a = { + b(c) { } - `) - ); + } + `); }); it("do not allow import export everywhere", () => { @@ -496,41 +473,35 @@ describe("babylon-to-esprima", () => { it("getters and setters", () => { parseAndAssertSame("class A { get x ( ) { ; } }"); - parseAndAssertSame( - unpad(` - class A { - get x( - ) - { - ; - } + parseAndAssertSame(` + class A { + get x( + ) + { + ; } - `) - ); + } + `); parseAndAssertSame("class A { set x (a) { ; } }"); - parseAndAssertSame( - unpad(` - class A { - set x(a - ) - { - ; - } + parseAndAssertSame(` + class A { + set x(a + ) + { + ; } - `) - ); - parseAndAssertSame( - unpad(` - var B = { - get x () { - return this.ecks; - }, - set x (ecks) { - this.ecks = ecks; - } - }; - `) - ); + } + `); + parseAndAssertSame(` + var B = { + get x () { + return this.ecks; + }, + set x (ecks) { + this.ecks = ecks; + } + }; + `); }); it("RestOperator", () => { @@ -546,13 +517,11 @@ describe("babylon-to-esprima", () => { }); it("Async/Await", () => { - parseAndAssertSame( - unpad(` - async function a() { - await 1; - } - `) - ); + parseAndAssertSame(` + async function a() { + await 1; + } + `); }); }); }); From 0e2bbc370542e601c8a5ab690ba7e3b1de46acd2 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 6 Nov 2017 14:57:56 -0500 Subject: [PATCH 390/569] require correct deps --- eslint/babel-eslint-parser/babylon-to-espree/toAST.js | 2 +- eslint/babel-eslint-parser/index.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eslint/babel-eslint-parser/babylon-to-espree/toAST.js b/eslint/babel-eslint-parser/babylon-to-espree/toAST.js index 07351b135ba3..b3da41f0cb06 100644 --- a/eslint/babel-eslint-parser/babylon-to-espree/toAST.js +++ b/eslint/babel-eslint-parser/babylon-to-espree/toAST.js @@ -1,6 +1,6 @@ "use strict"; -var t = require("babel-types"); +var t = require("@babel/types"); var convertComments = require("./convertComments"); module.exports = function(ast, traverse, code) { diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/index.js index ed1b8ff3a0e0..0fec8e47856a 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/index.js @@ -2,10 +2,10 @@ var babylonToEspree = require("./babylon-to-espree"); var Module = require("module"); var path = require("path"); var parse = require("babylon").parse; -var t = require("babel-types"); +var t = require("@babel/types"); var tt = require("babylon").tokTypes; -var traverse = require("babel-traverse").default; -var codeFrameColumns = require("babel-code-frame").codeFrameColumns; +var traverse = require("@babel/traverse").default; +var codeFrameColumns = require("@babel/code-frame").codeFrameColumns; var hasPatched = false; var eslintOptions = {}; From 39cef9288589a7a1da5b4a85eebd023ea6302bb9 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 6 Nov 2017 15:00:41 -0500 Subject: [PATCH 391/569] 8.0.2 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 0d24a1e4fe19..07573703bbb7 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "8.0.1", + "version": "8.0.2", "description": "Custom parser for ESLint", "main": "index.js", "files": [ From b6172b2ed349365732613fdf54197a187e49cf64 Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Fri, 1 Dec 2017 10:05:34 -0800 Subject: [PATCH 392/569] Lock down dependency versions. --- eslint/babel-eslint-parser/package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 07573703bbb7..4229cd75edf7 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -12,10 +12,10 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "@babel/code-frame": "^7.0.0-beta.31", - "@babel/traverse": "^7.0.0-beta.31", - "@babel/types": "^7.0.0-beta.31", - "babylon": "^7.0.0-beta.31" + "@babel/code-frame": "7.0.0-beta.31", + "@babel/traverse": "7.0.0-beta.31", + "@babel/types": "7.0.0-beta.31", + "babylon": "7.0.0-beta.31" }, "scripts": { "test": "npm run lint && npm run test-only", From 3a36eca1b4d5ed592c3f42d9d6fff60e807c98d8 Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Fri, 1 Dec 2017 10:06:24 -0800 Subject: [PATCH 393/569] Fix mocha command path. --- eslint/babel-eslint-parser/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/Makefile b/eslint/babel-eslint-parser/Makefile index 53bfdbc78a5f..d35bcfa016e2 100644 --- a/eslint/babel-eslint-parser/Makefile +++ b/eslint/babel-eslint-parser/Makefile @@ -1,7 +1,7 @@ .PHONY: publish-patch publish-patch: - mocha + ./node_modules/.bin/mocha npm version patch npm publish git push --follow-tags From 7ed6bfb9253ad83b2a2e8cf90a2045d8ca8cb4c7 Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Fri, 1 Dec 2017 10:06:40 -0800 Subject: [PATCH 394/569] 8.0.3 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 4229cd75edf7..188478669806 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "8.0.2", + "version": "8.0.3", "description": "Custom parser for ESLint", "main": "index.js", "files": [ From 5d6d52f04e17e36640fda0b78b4320368927fdb0 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Sun, 24 Dec 2017 15:42:17 +0900 Subject: [PATCH 395/569] Use new scopeManager/visitorKeys APIs (babel/babel-eslint#542) (fixes https://github.com/eslint/eslint/issues/9762) --- .../babel-eslint-parser/lib/analyze-scope.js | 330 ++++++++++++++++++ .../babylon-to-espree/attachComments.js | 0 .../babylon-to-espree/convertComments.js | 0 .../babylon-to-espree/convertTemplateType.js | 0 .../{ => lib}/babylon-to-espree/index.js | 0 .../{ => lib}/babylon-to-espree/toAST.js | 0 .../{ => lib}/babylon-to-espree/toToken.js | 0 .../{ => lib}/babylon-to-espree/toTokens.js | 0 eslint/babel-eslint-parser/lib/index.js | 17 + .../{index.js => lib/parse-with-patch.js} | 89 +---- .../lib/parse-with-scope.js | 19 + eslint/babel-eslint-parser/lib/parse.js | 83 +++++ .../babel-eslint-parser/lib/visitor-keys.js | 14 + eslint/babel-eslint-parser/package.json | 11 +- .../babel-eslint-parser/test/babel-eslint.js | 10 +- eslint/babel-eslint-parser/yarn.lock | 177 ++++++---- 16 files changed, 592 insertions(+), 158 deletions(-) create mode 100644 eslint/babel-eslint-parser/lib/analyze-scope.js rename eslint/babel-eslint-parser/{ => lib}/babylon-to-espree/attachComments.js (100%) rename eslint/babel-eslint-parser/{ => lib}/babylon-to-espree/convertComments.js (100%) rename eslint/babel-eslint-parser/{ => lib}/babylon-to-espree/convertTemplateType.js (100%) rename eslint/babel-eslint-parser/{ => lib}/babylon-to-espree/index.js (100%) rename eslint/babel-eslint-parser/{ => lib}/babylon-to-espree/toAST.js (100%) rename eslint/babel-eslint-parser/{ => lib}/babylon-to-espree/toToken.js (100%) rename eslint/babel-eslint-parser/{ => lib}/babylon-to-espree/toTokens.js (100%) create mode 100644 eslint/babel-eslint-parser/lib/index.js rename eslint/babel-eslint-parser/{index.js => lib/parse-with-patch.js} (84%) create mode 100644 eslint/babel-eslint-parser/lib/parse-with-scope.js create mode 100644 eslint/babel-eslint-parser/lib/parse.js create mode 100644 eslint/babel-eslint-parser/lib/visitor-keys.js diff --git a/eslint/babel-eslint-parser/lib/analyze-scope.js b/eslint/babel-eslint-parser/lib/analyze-scope.js new file mode 100644 index 000000000000..b538dea078d6 --- /dev/null +++ b/eslint/babel-eslint-parser/lib/analyze-scope.js @@ -0,0 +1,330 @@ +"use strict"; + +const t = require("@babel/types"); +const escope = require("eslint-scope"); +const Definition = require("eslint-scope/lib/definition").Definition; +const OriginalPatternVisitor = require("eslint-scope/lib/pattern-visitor"); +const OriginalReferencer = require("eslint-scope/lib/referencer"); +const fallback = require("eslint-visitor-keys").getKeys; +const childVisitorKeys = require("./visitor-keys"); + +const flowFlippedAliasKeys = t.FLIPPED_ALIAS_KEYS.Flow.concat([ + "ArrayPattern", + "ClassDeclaration", + "ClassExpression", + "FunctionDeclaration", + "FunctionExpression", + "Identifier", + "ObjectPattern", + "RestElement", +]); +const visitorKeysMap = Object.keys(t.VISITOR_KEYS).reduce(function(acc, key) { + const value = t.VISITOR_KEYS[key]; + if (flowFlippedAliasKeys.indexOf(value) === -1) { + acc[key] = value; + } + return acc; +}, {}); + +const propertyTypes = { + // loops + callProperties: { type: "loop", values: ["value"] }, + indexers: { type: "loop", values: ["key", "value"] }, + properties: { type: "loop", values: ["argument", "value"] }, + types: { type: "loop" }, + params: { type: "loop" }, + // single property + argument: { type: "single" }, + elementType: { type: "single" }, + qualification: { type: "single" }, + rest: { type: "single" }, + returnType: { type: "single" }, + // others + typeAnnotation: { type: "typeAnnotation" }, + typeParameters: { type: "typeParameters" }, + id: { type: "id" }, +}; + +class PatternVisitor extends OriginalPatternVisitor { + ArrayPattern(node) { + node.elements.forEach(this.visit, this); + } + + ObjectPattern(node) { + node.properties.forEach(this.visit, this); + } +} + +class Referencer extends OriginalReferencer { + // inherits. + visitPattern(node, options, callback) { + if (!node) { + return; + } + + // Visit type annotations. + this._checkIdentifierOrVisit(node.typeAnnotation); + if (t.isAssignmentPattern(node)) { + this._checkIdentifierOrVisit(node.left.typeAnnotation); + } + + // Overwrite `super.visitPattern(node, options, callback)` in order to not visit `ArrayPattern#typeAnnotation` and `ObjectPattern#typeAnnotation`. + if (typeof options === "function") { + callback = options; + options = { processRightHandNodes: false }; + } + + const visitor = new PatternVisitor(this.options, node, callback); + visitor.visit(node); + + // Process the right hand nodes recursively. + if (options.processRightHandNodes) { + visitor.rightHandNodes.forEach(this.visit, this); + } + } + + // inherits. + visitClass(node) { + // Decorators. + this._visitArray(node.decorators); + + // Flow type parameters. + const typeParamScope = this._nestTypeParamScope(node); + + // Flow super types. + this._visitTypeAnnotation(node.implements); + this._visitTypeAnnotation( + node.superTypeParameters && node.superTypeParameters.params + ); + + // Basic. + super.visitClass(node); + + // Close the type parameter scope. + if (typeParamScope) { + this.close(node); + } + } + + // inherits. + visitFunction(node) { + const typeParamScope = this._nestTypeParamScope(node); + + // Flow return types. + this._checkIdentifierOrVisit(node.returnType); + + // Basic. + super.visitFunction(node); + + // Close the type parameter scope. + if (typeParamScope) { + this.close(node); + } + } + + // inherits. + visitProperty(node) { + if (node.value && node.value.type === "TypeCastExpression") { + this._visitTypeAnnotation(node.value); + } + this._visitArray(node.decorators); + super.visitProperty(node); + } + + InterfaceDeclaration(node) { + this._createScopeVariable(node, node.id); + + const typeParamScope = this._nestTypeParamScope(node); + + // TODO: Handle mixins + this._visitArray(node.extends); + this.visit(node.body); + + if (typeParamScope) { + this.close(node); + } + } + + TypeAlias(node) { + this._createScopeVariable(node, node.id); + + const typeParamScope = this._nestTypeParamScope(node); + + this.visit(node.right); + + if (typeParamScope) { + this.close(node); + } + } + + ClassProperty(node) { + this._visitClassProperty(node); + } + + ClassPrivateProperty(node) { + this._visitClassProperty(node); + } + + DeclareModule(node) { + this._visitDeclareX(node); + } + + DeclareFunction(node) { + this._visitDeclareX(node); + } + + DeclareVariable(node) { + this._visitDeclareX(node); + } + + DeclareClass(node) { + this._visitDeclareX(node); + } + + _visitClassProperty(node) { + this._visitTypeAnnotation(node.typeAnnotation); + this.visitProperty(node); + } + + _visitDeclareX(node) { + if (node.id) { + this._createScopeVariable(node, node.id); + } + + const typeParamScope = this._nestTypeParamScope(node); + if (typeParamScope) { + this.close(node); + } + } + + _createScopeVariable(node, name) { + this.currentScope().variableScope.__define( + name, + new Definition("Variable", name, node, null, null, null) + ); + } + + _nestTypeParamScope(node) { + if (!node.typeParameters) { + return null; + } + + const parentScope = this.scopeManager.__currentScope; + const scope = new escope.Scope( + this.scopeManager, + "type-parameters", + parentScope, + node, + false + ); + + this.scopeManager.__nestScope(scope); + for (let j = 0; j < node.typeParameters.params.length; j++) { + const name = node.typeParameters.params[j]; + scope.__define(name, new Definition("TypeParameter", name, name)); + if (name.typeAnnotation) { + this._checkIdentifierOrVisit(name); + } + } + scope.__define = function() { + return parentScope.__define.apply(parentScope, arguments); + }; + + return scope; + } + + _visitTypeAnnotation(node) { + if (!node) { + return; + } + if (Array.isArray(node)) { + node.forEach(this._visitTypeAnnotation, this); + return; + } + + // get property to check (params, id, etc...) + const visitorValues = visitorKeysMap[node.type]; + if (!visitorValues) { + return; + } + + // can have multiple properties + for (let i = 0; i < visitorValues.length; i++) { + const visitorValue = visitorValues[i]; + const propertyType = propertyTypes[visitorValue]; + const nodeProperty = node[visitorValue]; + // check if property or type is defined + if (propertyType == null || nodeProperty == null) { + continue; + } + if (propertyType.type === "loop") { + for (let j = 0; j < nodeProperty.length; j++) { + if (Array.isArray(propertyType.values)) { + for (let k = 0; k < propertyType.values.length; k++) { + const loopPropertyNode = nodeProperty[j][propertyType.values[k]]; + if (loopPropertyNode) { + this._checkIdentifierOrVisit(loopPropertyNode); + } + } + } else { + this._checkIdentifierOrVisit(nodeProperty[j]); + } + } + } else if (propertyType.type === "single") { + this._checkIdentifierOrVisit(nodeProperty); + } else if (propertyType.type === "typeAnnotation") { + this._visitTypeAnnotation(node.typeAnnotation); + } else if (propertyType.type === "typeParameters") { + for (let l = 0; l < node.typeParameters.params.length; l++) { + this._checkIdentifierOrVisit(node.typeParameters.params[l]); + } + } else if (propertyType.type === "id") { + if (node.id.type === "Identifier") { + this._checkIdentifierOrVisit(node.id); + } else { + this._visitTypeAnnotation(node.id); + } + } + } + } + + _checkIdentifierOrVisit(node) { + if (node && node.typeAnnotation) { + this._visitTypeAnnotation(node.typeAnnotation); + } else if (node && node.type === "Identifier") { + this.visit(node); + } else { + this._visitTypeAnnotation(node); + } + } + + _visitArray(nodeList) { + if (nodeList) { + for (const node of nodeList) { + this.visit(node); + } + } + } +} + +module.exports = function(ast, parserOptions) { + const options = { + optimistic: false, + directive: false, + nodejsScope: + ast.sourceType === "script" && + (parserOptions.ecmaFeatures && + parserOptions.ecmaFeatures.globalReturn) === true, + impliedStrict: false, + sourceType: ast.sourceType, + ecmaVersion: parserOptions.ecmaVersion || 6, + childVisitorKeys, + fallback, + }; + const scopeManager = new escope.ScopeManager(options); + const referencer = new Referencer(options, scopeManager); + + referencer.visit(ast); + + return scopeManager; +}; diff --git a/eslint/babel-eslint-parser/babylon-to-espree/attachComments.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/attachComments.js similarity index 100% rename from eslint/babel-eslint-parser/babylon-to-espree/attachComments.js rename to eslint/babel-eslint-parser/lib/babylon-to-espree/attachComments.js diff --git a/eslint/babel-eslint-parser/babylon-to-espree/convertComments.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/convertComments.js similarity index 100% rename from eslint/babel-eslint-parser/babylon-to-espree/convertComments.js rename to eslint/babel-eslint-parser/lib/babylon-to-espree/convertComments.js diff --git a/eslint/babel-eslint-parser/babylon-to-espree/convertTemplateType.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/convertTemplateType.js similarity index 100% rename from eslint/babel-eslint-parser/babylon-to-espree/convertTemplateType.js rename to eslint/babel-eslint-parser/lib/babylon-to-espree/convertTemplateType.js diff --git a/eslint/babel-eslint-parser/babylon-to-espree/index.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/index.js similarity index 100% rename from eslint/babel-eslint-parser/babylon-to-espree/index.js rename to eslint/babel-eslint-parser/lib/babylon-to-espree/index.js diff --git a/eslint/babel-eslint-parser/babylon-to-espree/toAST.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/toAST.js similarity index 100% rename from eslint/babel-eslint-parser/babylon-to-espree/toAST.js rename to eslint/babel-eslint-parser/lib/babylon-to-espree/toAST.js diff --git a/eslint/babel-eslint-parser/babylon-to-espree/toToken.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/toToken.js similarity index 100% rename from eslint/babel-eslint-parser/babylon-to-espree/toToken.js rename to eslint/babel-eslint-parser/lib/babylon-to-espree/toToken.js diff --git a/eslint/babel-eslint-parser/babylon-to-espree/toTokens.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/toTokens.js similarity index 100% rename from eslint/babel-eslint-parser/babylon-to-espree/toTokens.js rename to eslint/babel-eslint-parser/lib/babylon-to-espree/toTokens.js diff --git a/eslint/babel-eslint-parser/lib/index.js b/eslint/babel-eslint-parser/lib/index.js new file mode 100644 index 000000000000..35843352bad0 --- /dev/null +++ b/eslint/babel-eslint-parser/lib/index.js @@ -0,0 +1,17 @@ +"use strict"; + +let patched = false; + +exports.parse = function(code, options) { + patched = true; + return require("./parse-with-patch")(code, options); +}; + +exports.parseForESLint = function(code, options) { + if (!patched && options.eslintVisitorKeys && options.eslintScopeManager) { + return require("./parse-with-scope")(code, options); + } + + patched = true; + return { ast: require("./parse-with-patch")(code, options) }; +}; diff --git a/eslint/babel-eslint-parser/index.js b/eslint/babel-eslint-parser/lib/parse-with-patch.js similarity index 84% rename from eslint/babel-eslint-parser/index.js rename to eslint/babel-eslint-parser/lib/parse-with-patch.js index 0fec8e47856a..d8157cfe7271 100644 --- a/eslint/babel-eslint-parser/index.js +++ b/eslint/babel-eslint-parser/lib/parse-with-patch.js @@ -1,12 +1,9 @@ -var babylonToEspree = require("./babylon-to-espree"); +"use strict"; + +var parse = require("./parse"); var Module = require("module"); var path = require("path"); -var parse = require("babylon").parse; var t = require("@babel/types"); -var tt = require("babylon").tokTypes; -var traverse = require("@babel/traverse").default; -var codeFrameColumns = require("@babel/code-frame").codeFrameColumns; - var hasPatched = false; var eslintOptions = {}; @@ -357,7 +354,7 @@ function monkeypatch(modules) { }; } -exports.parse = function(code, options) { +module.exports = function(code, options) { options = options || {}; eslintOptions.ecmaVersion = options.ecmaVersion = options.ecmaVersion || 6; eslintOptions.sourceType = options.sourceType = @@ -380,81 +377,5 @@ exports.parse = function(code, options) { } } - return exports.parseNoPatch(code, options); -}; - -exports.parseNoPatch = function(code, options) { - var opts = { - codeFrame: options.hasOwnProperty("codeFrame") ? options.codeFrame : true, - sourceType: options.sourceType, - allowImportExportEverywhere: options.allowImportExportEverywhere, // consistent with espree - allowReturnOutsideFunction: true, - allowSuperOutsideMethod: true, - ranges: true, - tokens: true, - plugins: [ - "flow", - "jsx", - "estree", - "asyncFunctions", - "asyncGenerators", - "classConstructorCall", - "classProperties", - "decorators", - "doExpressions", - "exponentiationOperator", - "exportExtensions", - "functionBind", - "functionSent", - "objectRestSpread", - "trailingFunctionCommas", - "dynamicImport", - "numericSeparator", - "optionalChaining", - "importMeta", - "classPrivateProperties", - "bigInt", - "optionalCatchBinding", - ], - }; - - var ast; - try { - ast = parse(code, opts); - } catch (err) { - if (err instanceof SyntaxError) { - err.lineNumber = err.loc.line; - err.column = err.loc.column; - - if (opts.codeFrame) { - err.lineNumber = err.loc.line; - err.column = err.loc.column + 1; - - // remove trailing "(LINE:COLUMN)" acorn message and add in esprima syntax error message start - err.message = - "Line " + - err.lineNumber + - ": " + - err.message.replace(/ \((\d+):(\d+)\)$/, "") + - // add codeframe - "\n\n" + - codeFrameColumns( - code, - { - start: { - line: err.lineNumber, - column: err.column, - }, - }, - { highlightCode: true } - ); - } - } - - throw err; - } - - babylonToEspree(ast, traverse, tt, code); - - return ast; + return parse(code, options); }; diff --git a/eslint/babel-eslint-parser/lib/parse-with-scope.js b/eslint/babel-eslint-parser/lib/parse-with-scope.js new file mode 100644 index 000000000000..a222b79aefe8 --- /dev/null +++ b/eslint/babel-eslint-parser/lib/parse-with-scope.js @@ -0,0 +1,19 @@ +"use strict"; + +const t = require("@babel/types"); +const analyzeScope = require("./analyze-scope"); +const parse = require("./parse"); + +module.exports = function(code, options) { + options = options || {}; + options.ecmaVersion = options.ecmaVersion || 6; + options.sourceType = options.sourceType || "module"; + options.allowImportExportEverywhere = + options.allowImportExportEverywhere || false; + + const ast = parse(code, options); + const scopeManager = analyzeScope(ast, options); + const visitorKeys = t.VISITOR_KEYS; + + return { ast, scopeManager, visitorKeys }; +}; diff --git a/eslint/babel-eslint-parser/lib/parse.js b/eslint/babel-eslint-parser/lib/parse.js new file mode 100644 index 000000000000..0763d7e056ac --- /dev/null +++ b/eslint/babel-eslint-parser/lib/parse.js @@ -0,0 +1,83 @@ +"use strict"; + +var babylonToEspree = require("./babylon-to-espree"); +var parse = require("babylon").parse; +var tt = require("babylon").tokTypes; +var traverse = require("@babel/traverse").default; +var codeFrameColumns = require("@babel/code-frame").codeFrameColumns; + +module.exports = function(code, options) { + var opts = { + codeFrame: options.hasOwnProperty("codeFrame") ? options.codeFrame : true, + sourceType: options.sourceType, + allowImportExportEverywhere: options.allowImportExportEverywhere, // consistent with espree + allowReturnOutsideFunction: true, + allowSuperOutsideMethod: true, + ranges: true, + tokens: true, + plugins: [ + "flow", + "jsx", + "estree", + "asyncFunctions", + "asyncGenerators", + "classConstructorCall", + "classProperties", + "decorators", + "doExpressions", + "exponentiationOperator", + "exportExtensions", + "functionBind", + "functionSent", + "objectRestSpread", + "trailingFunctionCommas", + "dynamicImport", + "numericSeparator", + "optionalChaining", + "importMeta", + "classPrivateProperties", + "bigInt", + "optionalCatchBinding", + ], + }; + + var ast; + try { + ast = parse(code, opts); + } catch (err) { + if (err instanceof SyntaxError) { + err.lineNumber = err.loc.line; + err.column = err.loc.column; + + if (opts.codeFrame) { + err.lineNumber = err.loc.line; + err.column = err.loc.column + 1; + + // remove trailing "(LINE:COLUMN)" acorn message and add in esprima syntax error message start + err.message = + "Line " + + err.lineNumber + + ": " + + err.message.replace(/ \((\d+):(\d+)\)$/, "") + + // add codeframe + "\n\n" + + codeFrameColumns( + code, + { + start: { + line: err.lineNumber, + column: err.column, + }, + }, + { highlightCode: true } + ); + } + } + + throw err; + } + + babylonToEspree(ast, traverse, tt, code); + + return ast; +}; diff --git a/eslint/babel-eslint-parser/lib/visitor-keys.js b/eslint/babel-eslint-parser/lib/visitor-keys.js new file mode 100644 index 000000000000..9ef7ef970c94 --- /dev/null +++ b/eslint/babel-eslint-parser/lib/visitor-keys.js @@ -0,0 +1,14 @@ +"use strict"; + +const BABEL_VISITOR_KEYS = require("@babel/types").VISITOR_KEYS; +const ESLINT_VISITOR_KEYS = require("eslint-visitor-keys").KEYS; + +module.exports = Object.assign( + { + MethodDefinition: ["decorators"].concat( + ESLINT_VISITOR_KEYS.MethodDefinition + ), + Property: ["decorators"].concat(ESLINT_VISITOR_KEYS.Property), + }, + BABEL_VISITOR_KEYS +); diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 188478669806..4b884f6d888a 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -2,10 +2,9 @@ "name": "babel-eslint", "version": "8.0.3", "description": "Custom parser for ESLint", - "main": "index.js", + "main": "lib/index.js", "files": [ - "index.js", - "babylon-to-espree" + "lib" ], "repository": { "type": "git", @@ -15,7 +14,9 @@ "@babel/code-frame": "7.0.0-beta.31", "@babel/traverse": "7.0.0-beta.31", "@babel/types": "7.0.0-beta.31", - "babylon": "7.0.0-beta.31" + "babylon": "7.0.0-beta.31", + "eslint-scope": "~3.7.1", + "eslint-visitor-keys": "^1.0.0" }, "scripts": { "test": "npm run lint && npm run test-only", @@ -38,7 +39,7 @@ "devDependencies": { "babel-eslint": "^8.0.0", "dedent": "^0.7.0", - "eslint": "^4.1.0", + "eslint": "^4.12.1", "eslint-config-babel": "^7.0.1", "eslint-plugin-flowtype": "^2.30.3", "eslint-plugin-prettier": "^2.1.2", diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index ad9838f8b5ca..6e8dd129a7a5 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -81,7 +81,10 @@ function parseAndAssertSame(code) { ecmaVersion: 8, sourceType: "module", }); - var babylonAST = babelEslint.parse(code); + var babylonAST = babelEslint.parseForESLint(code, { + eslintVisitorKeys: true, + eslintScopeManager: true, + }).ast; try { assertImplementsAST(esAST, babylonAST); } catch (err) { @@ -112,7 +115,10 @@ function parseAndAssertSame(code) { describe("babylon-to-esprima", () => { describe("compatibility", () => { it("should allow ast.analyze to be called without options", function() { - var esAST = babelEslint.parse("`test`"); + var esAST = babelEslint.parseForESLint("`test`", { + eslintScopeManager: true, + eslintVisitorKeys: true, + }).ast; assert.doesNotThrow( () => { diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index 438860714273..e3f869756116 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -2,7 +2,7 @@ # yarn lockfile v1 -"@babel/code-frame@7.0.0-beta.31", "@babel/code-frame@^7.0.0-beta.31": +"@babel/code-frame@7.0.0-beta.31": version "7.0.0-beta.31" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.31.tgz#473d021ecc573a2cce1c07d5b509d5215f46ba35" dependencies: @@ -34,7 +34,7 @@ babylon "7.0.0-beta.31" lodash "^4.2.0" -"@babel/traverse@7.0.0-beta.31", "@babel/traverse@^7.0.0-beta.31": +"@babel/traverse@7.0.0-beta.31": version "7.0.0-beta.31" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.31.tgz#db399499ad74aefda014f0c10321ab255134b1df" dependencies: @@ -47,7 +47,7 @@ invariant "^2.2.0" lodash "^4.2.0" -"@babel/types@7.0.0-beta.31", "@babel/types@^7.0.0-beta.31": +"@babel/types@7.0.0-beta.31": version "7.0.0-beta.31" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.31.tgz#42c9c86784f674c173fb21882ca9643334029de4" dependencies: @@ -69,6 +69,10 @@ acorn@^5.0.1: version "5.0.3" resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.0.3.tgz#c460df08491463f028ccb82eab3730bf01087b3d" +acorn@^5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.2.1.tgz#317ac7821826c22c702d66189ab8359675f135d7" + ajv-keywords@^1.0.0: version "1.5.1" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.1.tgz#314dd0a4b3368fad3dfcdc54ede6171b886daf3c" @@ -80,6 +84,15 @@ ajv@^4.7.0: co "^4.6.0" json-stable-stringify "^1.0.1" +ajv@^5.3.0: + version "5.4.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.4.0.tgz#32d1cf08dbc80c432f426f12e10b2511f6b46474" + dependencies: + co "^4.6.0" + fast-deep-equal "^1.0.0" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.3.0" + ansi-escapes@^1.0.0: version "1.4.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" @@ -92,6 +105,10 @@ ansi-regex@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" +ansi-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" @@ -205,7 +222,7 @@ babylon@7.0.0-beta.22: version "7.0.0-beta.22" resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.22.tgz#74f0ad82ed7c7c3cfeab74cf684f815104161b65" -babylon@7.0.0-beta.31, babylon@^7.0.0-beta.31: +babylon@7.0.0-beta.31: version "7.0.0-beta.31" resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.31.tgz#7ec10f81e0e456fd0f855ad60fa30c2ac454283f" @@ -252,6 +269,14 @@ chalk@^2.0.0: escape-string-regexp "^1.0.5" supports-color "^4.0.0" +chalk@^2.1.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.0.tgz#b5ea48efc9c1793dccc9b4767c93914d3f2d52ba" + dependencies: + ansi-styles "^3.1.0" + escape-string-regexp "^1.0.5" + supports-color "^4.0.0" + ci-info@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.0.0.tgz#dc5285f2b4e251821683681c381c3388f46ec534" @@ -344,7 +369,7 @@ cosmiconfig@^1.1.0: pinkie-promise "^2.0.0" require-from-string "^1.1.0" -cross-spawn@^5.0.1: +cross-spawn@^5.0.1, cross-spawn@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" dependencies: @@ -362,12 +387,6 @@ debug@3.1.0: dependencies: ms "2.0.0" -debug@^2.6.8: - version "2.6.8" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc" - dependencies: - ms "2.0.0" - debug@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/debug/-/debug-3.0.1.tgz#0564c612b521dc92d9f2988f0549e34f9c98db64" @@ -398,12 +417,11 @@ diff@3.3.1: version "3.3.1" resolved "https://registry.yarnpkg.com/diff/-/diff-3.3.1.tgz#aa8567a6eed03c531fc89d3f711cd0e5259dec75" -doctrine@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.0.0.tgz#c73d8d2909d22291e1a007a395804da8b665fe63" +doctrine@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.0.2.tgz#68f96ce8efc56cc42651f1faadb4f175273b0075" dependencies: esutils "^2.0.2" - isarray "^1.0.0" elegant-spinner@^1.0.1: version "1.0.1" @@ -436,37 +454,43 @@ eslint-plugin-prettier@^2.1.2: fast-diff "^1.1.1" jest-docblock "^20.0.1" -eslint-scope@^3.7.1: +eslint-scope@^3.7.1, eslint-scope@~3.7.1: version "3.7.1" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" dependencies: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.1.0.tgz#bbb55a28220ee08b69da9554d45a6b2ebfd7d913" +eslint-visitor-keys@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" + +eslint@^4.12.1: + version "4.12.1" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.12.1.tgz#5ec1973822b4a066b353770c3c6d69a2a188e880" dependencies: + ajv "^5.3.0" babel-code-frame "^6.22.0" - chalk "^1.1.3" + chalk "^2.1.0" concat-stream "^1.6.0" - debug "^2.6.8" - doctrine "^2.0.0" + cross-spawn "^5.1.0" + debug "^3.0.1" + doctrine "^2.0.2" eslint-scope "^3.7.1" - espree "^3.4.3" + espree "^3.5.2" esquery "^1.0.0" estraverse "^4.2.0" esutils "^2.0.2" file-entry-cache "^2.0.0" + functional-red-black-tree "^1.0.1" glob "^7.1.2" - globals "^9.17.0" + globals "^11.0.1" ignore "^3.3.3" imurmurhash "^0.1.4" inquirer "^3.0.6" - is-my-json-valid "^2.16.0" is-resolvable "^1.0.0" - js-yaml "^3.8.4" - json-stable-stringify "^1.0.1" + js-yaml "^3.9.1" + json-stable-stringify-without-jsonify "^1.0.1" levn "^0.3.0" lodash "^4.17.4" minimatch "^3.0.2" @@ -474,24 +498,37 @@ eslint@^4.1.0: natural-compare "^1.4.0" optionator "^0.8.2" path-is-inside "^1.0.2" - pluralize "^4.0.0" + pluralize "^7.0.0" progress "^2.0.0" require-uncached "^1.0.3" + semver "^5.3.0" + strip-ansi "^4.0.0" strip-json-comments "~2.0.1" table "^4.0.1" text-table "~0.2.0" -espree@^3.4.0, espree@^3.4.3: +espree@^3.4.0: version "3.4.3" resolved "https://registry.yarnpkg.com/espree/-/espree-3.4.3.tgz#2910b5ccd49ce893c2ffffaab4fd8b3a31b82374" dependencies: acorn "^5.0.1" acorn-jsx "^3.0.0" +espree@^3.5.2: + version "3.5.2" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.2.tgz#756ada8b979e9dcfcdb30aad8d1a9304a905e1ca" + dependencies: + acorn "^5.2.1" + acorn-jsx "^3.0.0" + esprima@^3.1.1: version "3.1.3" resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" +esprima@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" + esquery@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.0.tgz#cfba8b57d7fba93f17298a8a006a04cda13d80fa" @@ -537,10 +574,18 @@ external-editor@^2.0.4: jschardet "^1.4.2" tmp "^0.0.31" +fast-deep-equal@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz#96256a3bc975595eb36d82e9929d060d893439ff" + fast-diff@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.1.1.tgz#0aea0e4e605b6a2189f0e936d4b7fbaf1b7cfd9b" +fast-json-stable-stringify@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" + fast-levenshtein@~2.0.4: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" @@ -578,15 +623,9 @@ fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" -generate-function@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/generate-function/-/generate-function-2.0.0.tgz#6858fe7c0969b7d4e9093337647ac79f60dfbe74" - -generate-object-property@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/generate-object-property/-/generate-object-property-1.2.0.tgz#9c0e1c40308ce804f4783618b937fa88f99d50d0" - dependencies: - is-property "^1.0.0" +functional-red-black-tree@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" get-stream@^3.0.0: version "3.0.0" @@ -607,9 +646,9 @@ globals@^10.0.0: version "10.0.0" resolved "https://registry.yarnpkg.com/globals/-/globals-10.0.0.tgz#a5803a1abe923b52bc33a59cffeaf6e0748cf3f7" -globals@^9.17.0: - version "9.18.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" +globals@^11.0.1: + version "11.0.1" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.0.1.tgz#12a87bb010e5154396acc535e1e43fc753b0e5e8" globby@^5.0.0: version "5.0.0" @@ -740,15 +779,6 @@ is-fullwidth-code-point@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" -is-my-json-valid@^2.16.0: - version "2.16.0" - resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.16.0.tgz#f079dd9bfdae65ee2038aae8acbc86ab109e3693" - dependencies: - generate-function "^2.0.0" - generate-object-property "^1.1.0" - jsonpointer "^4.0.0" - xtend "^4.0.0" - is-path-cwd@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" @@ -769,10 +799,6 @@ is-promise@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" -is-property@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" - is-resolvable@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.0.0.tgz#8df57c61ea2e3c501408d100fb013cf8d6e0cc62" @@ -783,7 +809,7 @@ is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" -isarray@^1.0.0, isarray@~1.0.0: +isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" @@ -799,17 +825,32 @@ js-tokens@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7" -js-yaml@^3.4.3, js-yaml@^3.8.4: +js-yaml@^3.4.3: version "3.8.4" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.8.4.tgz#520b4564f86573ba96662af85a8cafa7b4b5a6f6" dependencies: argparse "^1.0.7" esprima "^3.1.1" +js-yaml@^3.9.1: + version "3.10.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc" + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + jschardet@^1.4.2: version "1.4.2" resolved "https://registry.yarnpkg.com/jschardet/-/jschardet-1.4.2.tgz#2aa107f142af4121d145659d44f50830961e699a" +json-schema-traverse@^0.3.0: + version "0.3.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" + +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + json-stable-stringify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" @@ -820,10 +861,6 @@ jsonify@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" -jsonpointer@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/jsonpointer/-/jsonpointer-4.0.1.tgz#4fd92cb34e0e9db3c89c8622ecf51f9b978c6cb9" - levn@^0.3.0, levn@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" @@ -1093,9 +1130,9 @@ pinkie@^2.0.0: version "2.0.4" resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" -pluralize@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-4.0.0.tgz#59b708c1c0190a2f692f1c7618c446b052fd1762" +pluralize@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" prelude-ls@~1.1.2: version "1.1.2" @@ -1196,6 +1233,10 @@ safe-buffer@~5.1.0: version "5.1.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" +semver@^5.3.0: + version "5.4.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" + shebang-command@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" @@ -1253,6 +1294,12 @@ strip-ansi@^3.0.0, strip-ansi@^3.0.1: dependencies: ansi-regex "^2.0.0" +strip-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + dependencies: + ansi-regex "^3.0.0" + strip-eof@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" @@ -1352,10 +1399,6 @@ write@^0.2.1: dependencies: mkdirp "^0.5.1" -xtend@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" - yallist@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" From d33839a9c306fece26ecc6bb81cf9bf7d1a37e22 Mon Sep 17 00:00:00 2001 From: Teddy Katz Date: Sun, 24 Dec 2017 02:00:29 -0500 Subject: [PATCH 396/569] Re-add parseNoPatch function (accidentally removed) (babel/babel-eslint#557) --- eslint/babel-eslint-parser/lib/index.js | 4 ++++ eslint/babel-eslint-parser/test/babel-eslint.js | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/eslint/babel-eslint-parser/lib/index.js b/eslint/babel-eslint-parser/lib/index.js index 35843352bad0..130b10b89868 100644 --- a/eslint/babel-eslint-parser/lib/index.js +++ b/eslint/babel-eslint-parser/lib/index.js @@ -15,3 +15,7 @@ exports.parseForESLint = function(code, options) { patched = true; return { ast: require("./parse-with-patch")(code, options) }; }; + +exports.parseNoPatch = function(code, options) { + return require("./parse")(code, options); +}; diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 6e8dd129a7a5..3bebc0acfde0 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -531,3 +531,12 @@ describe("babylon-to-esprima", () => { }); }); }); + +describe("Public API", () => { + it("exports a parseNoPatch function", () => { + assertImplementsAST( + espree.parse("foo"), + babelEslint.parseNoPatch("foo", {}) + ); + }); +}); From 5b08714a4d976ac2790fcb655a8b115a6c0bd200 Mon Sep 17 00:00:00 2001 From: Teddy Katz Date: Sun, 24 Dec 2017 02:02:44 -0500 Subject: [PATCH 397/569] 8.1.0 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 4b884f6d888a..0f8892c21dd3 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "8.0.3", + "version": "8.1.0", "description": "Custom parser for ESLint", "main": "lib/index.js", "files": [ From e988a88af042d5b27ed80945d33700ffb0fde172 Mon Sep 17 00:00:00 2001 From: Teddy Katz Date: Mon, 25 Dec 2017 01:52:36 -0500 Subject: [PATCH 398/569] Fix: Prevent parseForESLint() behavior from changing after parse() is called (fixes babel/babel-eslint#558)(babel/babel-eslint#559) * Prevent parseForESLint() behavior from changing after parse() is called (fixes https://github.com/babel/babel-eslint/issues/558, fixes https://github.com/eslint/eslint/issues/9767) * Avoid using the enhanced referencer after monkeypatching * Chore: add test for babel/babel-eslint#558 * Pass correct scope analyzer options * fix escope patch and improve tests * remove process.exit(1) --- .../babel-eslint-parser/lib/analyze-scope.js | 9 +- eslint/babel-eslint-parser/lib/index.js | 15 +- .../lib/parse-with-patch.js | 376 +----------------- .../lib/parse-with-scope.js | 6 - .../lib/patch-eslint-scope.js | 370 +++++++++++++++++ eslint/babel-eslint-parser/package.json | 6 +- .../babel-eslint-parser/test/babel-eslint.js | 43 +- .../test/fixtures/assert-implements-ast.js | 41 ++ .../eslint-plugin-import/.eslintrc.yml | 11 + .../test/fixtures/eslint-plugin-import/a.js | 1 + .../test/fixtures/eslint-plugin-import/b.js | 1 + .../test/fixtures/eslint-plugin-import/c.js | 4 + .../test/fixtures/preprocess-to-patch.js | 5 + .../test/fixtures/use-eslint-old.js | 12 + .../test/non-regression.js | 24 +- .../test/z_parser-for-eslint-after-patched.js | 45 +++ eslint/babel-eslint-parser/yarn.lock | 254 +++++++++++- 17 files changed, 779 insertions(+), 444 deletions(-) create mode 100644 eslint/babel-eslint-parser/lib/patch-eslint-scope.js create mode 100644 eslint/babel-eslint-parser/test/fixtures/assert-implements-ast.js create mode 100644 eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/.eslintrc.yml create mode 100644 eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/a.js create mode 100644 eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/b.js create mode 100644 eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/c.js create mode 100644 eslint/babel-eslint-parser/test/fixtures/preprocess-to-patch.js create mode 100644 eslint/babel-eslint-parser/test/fixtures/use-eslint-old.js create mode 100644 eslint/babel-eslint-parser/test/z_parser-for-eslint-after-patched.js diff --git a/eslint/babel-eslint-parser/lib/analyze-scope.js b/eslint/babel-eslint-parser/lib/analyze-scope.js index b538dea078d6..6001c13647e4 100644 --- a/eslint/babel-eslint-parser/lib/analyze-scope.js +++ b/eslint/babel-eslint-parser/lib/analyze-scope.js @@ -318,9 +318,16 @@ module.exports = function(ast, parserOptions) { impliedStrict: false, sourceType: ast.sourceType, ecmaVersion: parserOptions.ecmaVersion || 6, - childVisitorKeys, fallback, }; + + if (OriginalReferencer._babelEslintPatched) { + require("./patch-eslint-scope")(parserOptions); + return escope.analyze(ast, options); + } + + options.childVisitorKeys = childVisitorKeys; + const scopeManager = new escope.ScopeManager(options); const referencer = new Referencer(options, scopeManager); diff --git a/eslint/babel-eslint-parser/lib/index.js b/eslint/babel-eslint-parser/lib/index.js index 130b10b89868..973f742ea592 100644 --- a/eslint/babel-eslint-parser/lib/index.js +++ b/eslint/babel-eslint-parser/lib/index.js @@ -1,18 +1,19 @@ "use strict"; -let patched = false; - exports.parse = function(code, options) { - patched = true; - return require("./parse-with-patch")(code, options); + return exports.parseForESLint(code, options).ast; }; exports.parseForESLint = function(code, options) { - if (!patched && options.eslintVisitorKeys && options.eslintScopeManager) { + options = options || {}; + options.ecmaVersion = options.ecmaVersion || 6; + options.sourceType = options.sourceType || "module"; + options.allowImportExportEverywhere = + options.allowImportExportEverywhere || false; + + if (options.eslintVisitorKeys && options.eslintScopeManager) { return require("./parse-with-scope")(code, options); } - - patched = true; return { ast: require("./parse-with-patch")(code, options) }; }; diff --git a/eslint/babel-eslint-parser/lib/parse-with-patch.js b/eslint/babel-eslint-parser/lib/parse-with-patch.js index d8157cfe7271..ba1b95b5b107 100644 --- a/eslint/babel-eslint-parser/lib/parse-with-patch.js +++ b/eslint/babel-eslint-parser/lib/parse-with-patch.js @@ -1,381 +1,9 @@ "use strict"; var parse = require("./parse"); -var Module = require("module"); -var path = require("path"); -var t = require("@babel/types"); -var hasPatched = false; -var eslintOptions = {}; - -function getModules() { - try { - // avoid importing a local copy of eslint, try to find a peer dependency - var eslintLoc = Module._resolveFilename("eslint", module.parent); - } catch (err) { - try { - // avoids breaking in jest where module.parent is undefined - eslintLoc = require.resolve("eslint"); - } catch (err) { - throw new ReferenceError("couldn't resolve eslint"); - } - } - - // get modules relative to what eslint will load - var eslintMod = new Module(eslintLoc); - eslintMod.filename = eslintLoc; - eslintMod.paths = Module._nodeModulePaths(path.dirname(eslintLoc)); - - try { - var escope = eslintMod.require("eslint-scope"); - var Definition = eslintMod.require("eslint-scope/lib/definition") - .Definition; - var referencer = eslintMod.require("eslint-scope/lib/referencer"); - } catch (err) { - escope = eslintMod.require("escope"); - Definition = eslintMod.require("escope/lib/definition").Definition; - referencer = eslintMod.require("escope/lib/referencer"); - } - - var estraverse = eslintMod.require("estraverse"); - - if (referencer.__esModule) referencer = referencer.default; - - return { - Definition, - escope, - estraverse, - referencer, - }; -} - -function monkeypatch(modules) { - var Definition = modules.Definition; - var escope = modules.escope; - var estraverse = modules.estraverse; - var referencer = modules.referencer; - - Object.assign(estraverse.VisitorKeys, t.VISITOR_KEYS); - estraverse.VisitorKeys.MethodDefinition.push("decorators"); - estraverse.VisitorKeys.Property.push("decorators"); - - var analyze = escope.analyze; - escope.analyze = function(ast, opts) { - opts = opts || {}; - opts.ecmaVersion = eslintOptions.ecmaVersion; - opts.sourceType = eslintOptions.sourceType; - if (eslintOptions.globalReturn !== undefined) { - opts.nodejsScope = eslintOptions.globalReturn; - } - - var results = analyze.call(this, ast, opts); - return results; - }; - - // if there are decorators, then visit each - function visitDecorators(node) { - if (!node.decorators) { - return; - } - for (var i = 0; i < node.decorators.length; i++) { - if (node.decorators[i].expression) { - this.visit(node.decorators[i]); - } - } - } - - // iterate through part of t.VISITOR_KEYS - var flowFlippedAliasKeys = t.FLIPPED_ALIAS_KEYS.Flow.concat([ - "ArrayPattern", - "ClassDeclaration", - "ClassExpression", - "FunctionDeclaration", - "FunctionExpression", - "Identifier", - "ObjectPattern", - "RestElement", - ]); - var visitorKeysMap = Object.keys(t.VISITOR_KEYS).reduce(function(acc, key) { - var value = t.VISITOR_KEYS[key]; - if (flowFlippedAliasKeys.indexOf(value) === -1) { - acc[key] = value; - } - return acc; - }, {}); - - var propertyTypes = { - // loops - callProperties: { type: "loop", values: ["value"] }, - indexers: { type: "loop", values: ["key", "value"] }, - properties: { type: "loop", values: ["argument", "value"] }, - types: { type: "loop" }, - params: { type: "loop" }, - // single property - argument: { type: "single" }, - elementType: { type: "single" }, - qualification: { type: "single" }, - rest: { type: "single" }, - returnType: { type: "single" }, - // others - typeAnnotation: { type: "typeAnnotation" }, - typeParameters: { type: "typeParameters" }, - id: { type: "id" }, - }; - - function visitTypeAnnotation(node) { - // get property to check (params, id, etc...) - var visitorValues = visitorKeysMap[node.type]; - if (!visitorValues) { - return; - } - - // can have multiple properties - for (var i = 0; i < visitorValues.length; i++) { - var visitorValue = visitorValues[i]; - var propertyType = propertyTypes[visitorValue]; - var nodeProperty = node[visitorValue]; - // check if property or type is defined - if (propertyType == null || nodeProperty == null) { - continue; - } - if (propertyType.type === "loop") { - for (var j = 0; j < nodeProperty.length; j++) { - if (Array.isArray(propertyType.values)) { - for (var k = 0; k < propertyType.values.length; k++) { - var loopPropertyNode = nodeProperty[j][propertyType.values[k]]; - if (loopPropertyNode) { - checkIdentifierOrVisit.call(this, loopPropertyNode); - } - } - } else { - checkIdentifierOrVisit.call(this, nodeProperty[j]); - } - } - } else if (propertyType.type === "single") { - checkIdentifierOrVisit.call(this, nodeProperty); - } else if (propertyType.type === "typeAnnotation") { - visitTypeAnnotation.call(this, node.typeAnnotation); - } else if (propertyType.type === "typeParameters") { - for (var l = 0; l < node.typeParameters.params.length; l++) { - checkIdentifierOrVisit.call(this, node.typeParameters.params[l]); - } - } else if (propertyType.type === "id") { - if (node.id.type === "Identifier") { - checkIdentifierOrVisit.call(this, node.id); - } else { - visitTypeAnnotation.call(this, node.id); - } - } - } - } - - function checkIdentifierOrVisit(node) { - if (node.typeAnnotation) { - visitTypeAnnotation.call(this, node.typeAnnotation); - } else if (node.type === "Identifier") { - this.visit(node); - } else { - visitTypeAnnotation.call(this, node); - } - } - - function nestTypeParamScope(manager, node) { - var parentScope = manager.__currentScope; - var scope = new escope.Scope( - manager, - "type-parameters", - parentScope, - node, - false - ); - manager.__nestScope(scope); - for (var j = 0; j < node.typeParameters.params.length; j++) { - var name = node.typeParameters.params[j]; - scope.__define(name, new Definition("TypeParameter", name, name)); - if (name.typeAnnotation) { - checkIdentifierOrVisit.call(this, name); - } - } - scope.__define = function() { - return parentScope.__define.apply(parentScope, arguments); - }; - return scope; - } - - // visit decorators that are in: ClassDeclaration / ClassExpression - var visitClass = referencer.prototype.visitClass; - referencer.prototype.visitClass = function(node) { - visitDecorators.call(this, node); - var typeParamScope; - if (node.typeParameters) { - typeParamScope = nestTypeParamScope.call(this, this.scopeManager, node); - } - // visit flow type: ClassImplements - if (node.implements) { - for (var i = 0; i < node.implements.length; i++) { - checkIdentifierOrVisit.call(this, node.implements[i]); - } - } - if (node.superTypeParameters) { - for (var k = 0; k < node.superTypeParameters.params.length; k++) { - checkIdentifierOrVisit.call(this, node.superTypeParameters.params[k]); - } - } - visitClass.call(this, node); - if (typeParamScope) { - this.close(node); - } - }; - - // visit decorators that are in: Property / MethodDefinition - var visitProperty = referencer.prototype.visitProperty; - referencer.prototype.visitProperty = function(node) { - if (node.value && node.value.type === "TypeCastExpression") { - visitTypeAnnotation.call(this, node.value); - } - visitDecorators.call(this, node); - visitProperty.call(this, node); - }; - - function visitClassProperty(node) { - if (node.typeAnnotation) { - visitTypeAnnotation.call(this, node.typeAnnotation); - } - this.visitProperty(node); - } - - // visit ClassProperty as a Property. - referencer.prototype.ClassProperty = visitClassProperty; - - // visit ClassPrivateProperty as a Property. - referencer.prototype.ClassPrivateProperty = visitClassProperty; - - // visit flow type in FunctionDeclaration, FunctionExpression, ArrowFunctionExpression - var visitFunction = referencer.prototype.visitFunction; - referencer.prototype.visitFunction = function(node) { - var typeParamScope; - if (node.typeParameters) { - typeParamScope = nestTypeParamScope.call(this, this.scopeManager, node); - } - if (node.returnType) { - checkIdentifierOrVisit.call(this, node.returnType); - } - // only visit if function parameters have types - if (node.params) { - for (var i = 0; i < node.params.length; i++) { - var param = node.params[i]; - if (param.typeAnnotation) { - checkIdentifierOrVisit.call(this, param); - } else if (t.isAssignmentPattern(param)) { - if (param.left.typeAnnotation) { - checkIdentifierOrVisit.call(this, param.left); - } - } - } - } - // set ArrayPattern/ObjectPattern visitor keys back to their original. otherwise - // escope will traverse into them and include the identifiers within as declarations - estraverse.VisitorKeys.ObjectPattern = ["properties"]; - estraverse.VisitorKeys.ArrayPattern = ["elements"]; - visitFunction.call(this, node); - // set them back to normal... - estraverse.VisitorKeys.ObjectPattern = t.VISITOR_KEYS.ObjectPattern; - estraverse.VisitorKeys.ArrayPattern = t.VISITOR_KEYS.ArrayPattern; - if (typeParamScope) { - this.close(node); - } - }; - - // visit flow type in VariableDeclaration - var variableDeclaration = referencer.prototype.VariableDeclaration; - referencer.prototype.VariableDeclaration = function(node) { - if (node.declarations) { - for (var i = 0; i < node.declarations.length; i++) { - var id = node.declarations[i].id; - var typeAnnotation = id.typeAnnotation; - if (typeAnnotation) { - checkIdentifierOrVisit.call(this, typeAnnotation); - } - } - } - variableDeclaration.call(this, node); - }; - - function createScopeVariable(node, name) { - this.currentScope().variableScope.__define( - name, - new Definition("Variable", name, node, null, null, null) - ); - } - - referencer.prototype.InterfaceDeclaration = function(node) { - createScopeVariable.call(this, node, node.id); - var typeParamScope; - if (node.typeParameters) { - typeParamScope = nestTypeParamScope.call(this, this.scopeManager, node); - } - // TODO: Handle mixins - for (var i = 0; i < node.extends.length; i++) { - visitTypeAnnotation.call(this, node.extends[i]); - } - visitTypeAnnotation.call(this, node.body); - if (typeParamScope) { - this.close(node); - } - }; - - referencer.prototype.TypeAlias = function(node) { - createScopeVariable.call(this, node, node.id); - var typeParamScope; - if (node.typeParameters) { - typeParamScope = nestTypeParamScope.call(this, this.scopeManager, node); - } - if (node.right) { - visitTypeAnnotation.call(this, node.right); - } - if (typeParamScope) { - this.close(node); - } - }; - - referencer.prototype.DeclareModule = referencer.prototype.DeclareFunction = referencer.prototype.DeclareVariable = referencer.prototype.DeclareClass = function( - node - ) { - if (node.id) { - createScopeVariable.call(this, node, node.id); - } - - var typeParamScope; - if (node.typeParameters) { - typeParamScope = nestTypeParamScope.call(this, this.scopeManager, node); - } - if (typeParamScope) { - this.close(node); - } - }; -} +var patchEscope = require("./patch-eslint-scope"); module.exports = function(code, options) { - options = options || {}; - eslintOptions.ecmaVersion = options.ecmaVersion = options.ecmaVersion || 6; - eslintOptions.sourceType = options.sourceType = - options.sourceType || "module"; - eslintOptions.allowImportExportEverywhere = options.allowImportExportEverywhere = - options.allowImportExportEverywhere || false; - if (options.sourceType === "module") { - eslintOptions.globalReturn = false; - } else { - delete eslintOptions.globalReturn; - } - - if (!hasPatched) { - hasPatched = true; - try { - monkeypatch(getModules()); - } catch (err) { - console.error(err.stack); - process.exit(1); - } - } - + patchEscope(options); return parse(code, options); }; diff --git a/eslint/babel-eslint-parser/lib/parse-with-scope.js b/eslint/babel-eslint-parser/lib/parse-with-scope.js index a222b79aefe8..8892076e596c 100644 --- a/eslint/babel-eslint-parser/lib/parse-with-scope.js +++ b/eslint/babel-eslint-parser/lib/parse-with-scope.js @@ -5,12 +5,6 @@ const analyzeScope = require("./analyze-scope"); const parse = require("./parse"); module.exports = function(code, options) { - options = options || {}; - options.ecmaVersion = options.ecmaVersion || 6; - options.sourceType = options.sourceType || "module"; - options.allowImportExportEverywhere = - options.allowImportExportEverywhere || false; - const ast = parse(code, options); const scopeManager = analyzeScope(ast, options); const visitorKeys = t.VISITOR_KEYS; diff --git a/eslint/babel-eslint-parser/lib/patch-eslint-scope.js b/eslint/babel-eslint-parser/lib/patch-eslint-scope.js new file mode 100644 index 000000000000..aec71fc6ca70 --- /dev/null +++ b/eslint/babel-eslint-parser/lib/patch-eslint-scope.js @@ -0,0 +1,370 @@ +"use strict"; + +var Module = require("module"); +var path = require("path"); +var t = require("@babel/types"); + +function getModules() { + try { + // avoid importing a local copy of eslint, try to find a peer dependency + var eslintLoc = Module._resolveFilename("eslint", module.parent); + } catch (err) { + try { + // avoids breaking in jest where module.parent is undefined + eslintLoc = require.resolve("eslint"); + } catch (err) { + throw new ReferenceError("couldn't resolve eslint"); + } + } + + // get modules relative to what eslint will load + var eslintMod = new Module(eslintLoc); + eslintMod.filename = eslintLoc; + eslintMod.paths = Module._nodeModulePaths(path.dirname(eslintLoc)); + + try { + var escope = eslintMod.require("eslint-scope"); + var Definition = eslintMod.require("eslint-scope/lib/definition") + .Definition; + var referencer = eslintMod.require("eslint-scope/lib/referencer"); + } catch (err) { + escope = eslintMod.require("escope"); + Definition = eslintMod.require("escope/lib/definition").Definition; + referencer = eslintMod.require("escope/lib/referencer"); + } + + var estraverse = eslintMod.require("estraverse"); + + if (referencer.__esModule) referencer = referencer.default; + + return { + Definition, + escope, + estraverse, + referencer, + }; +} + +function monkeypatch(modules) { + var Definition = modules.Definition; + var escope = modules.escope; + var estraverse = modules.estraverse; + var referencer = modules.referencer; + + Object.assign(estraverse.VisitorKeys, t.VISITOR_KEYS); + estraverse.VisitorKeys.MethodDefinition.push("decorators"); + estraverse.VisitorKeys.Property.push("decorators"); + + // if there are decorators, then visit each + function visitDecorators(node) { + if (!node.decorators) { + return; + } + for (var i = 0; i < node.decorators.length; i++) { + if (node.decorators[i].expression) { + this.visit(node.decorators[i]); + } + } + } + + // iterate through part of t.VISITOR_KEYS + var flowFlippedAliasKeys = t.FLIPPED_ALIAS_KEYS.Flow.concat([ + "ArrayPattern", + "ClassDeclaration", + "ClassExpression", + "FunctionDeclaration", + "FunctionExpression", + "Identifier", + "ObjectPattern", + "RestElement", + ]); + var visitorKeysMap = Object.keys(t.VISITOR_KEYS).reduce(function(acc, key) { + var value = t.VISITOR_KEYS[key]; + if (flowFlippedAliasKeys.indexOf(value) === -1) { + acc[key] = value; + } + return acc; + }, {}); + + var propertyTypes = { + // loops + callProperties: { type: "loop", values: ["value"] }, + indexers: { type: "loop", values: ["key", "value"] }, + properties: { type: "loop", values: ["argument", "value"] }, + types: { type: "loop" }, + params: { type: "loop" }, + // single property + argument: { type: "single" }, + elementType: { type: "single" }, + qualification: { type: "single" }, + rest: { type: "single" }, + returnType: { type: "single" }, + // others + typeAnnotation: { type: "typeAnnotation" }, + typeParameters: { type: "typeParameters" }, + id: { type: "id" }, + }; + + function visitTypeAnnotation(node) { + // get property to check (params, id, etc...) + var visitorValues = visitorKeysMap[node.type]; + if (!visitorValues) { + return; + } + + // can have multiple properties + for (var i = 0; i < visitorValues.length; i++) { + var visitorValue = visitorValues[i]; + var propertyType = propertyTypes[visitorValue]; + var nodeProperty = node[visitorValue]; + // check if property or type is defined + if (propertyType == null || nodeProperty == null) { + continue; + } + if (propertyType.type === "loop") { + for (var j = 0; j < nodeProperty.length; j++) { + if (Array.isArray(propertyType.values)) { + for (var k = 0; k < propertyType.values.length; k++) { + var loopPropertyNode = nodeProperty[j][propertyType.values[k]]; + if (loopPropertyNode) { + checkIdentifierOrVisit.call(this, loopPropertyNode); + } + } + } else { + checkIdentifierOrVisit.call(this, nodeProperty[j]); + } + } + } else if (propertyType.type === "single") { + checkIdentifierOrVisit.call(this, nodeProperty); + } else if (propertyType.type === "typeAnnotation") { + visitTypeAnnotation.call(this, node.typeAnnotation); + } else if (propertyType.type === "typeParameters") { + for (var l = 0; l < node.typeParameters.params.length; l++) { + checkIdentifierOrVisit.call(this, node.typeParameters.params[l]); + } + } else if (propertyType.type === "id") { + if (node.id.type === "Identifier") { + checkIdentifierOrVisit.call(this, node.id); + } else { + visitTypeAnnotation.call(this, node.id); + } + } + } + } + + function checkIdentifierOrVisit(node) { + if (node.typeAnnotation) { + visitTypeAnnotation.call(this, node.typeAnnotation); + } else if (node.type === "Identifier") { + this.visit(node); + } else { + visitTypeAnnotation.call(this, node); + } + } + + function nestTypeParamScope(manager, node) { + var parentScope = manager.__currentScope; + var scope = new escope.Scope( + manager, + "type-parameters", + parentScope, + node, + false + ); + manager.__nestScope(scope); + for (var j = 0; j < node.typeParameters.params.length; j++) { + var name = node.typeParameters.params[j]; + scope.__define(name, new Definition("TypeParameter", name, name)); + if (name.typeAnnotation) { + checkIdentifierOrVisit.call(this, name); + } + } + scope.__define = function() { + return parentScope.__define.apply(parentScope, arguments); + }; + return scope; + } + + // visit decorators that are in: ClassDeclaration / ClassExpression + var visitClass = referencer.prototype.visitClass; + referencer.prototype.visitClass = function(node) { + visitDecorators.call(this, node); + var typeParamScope; + if (node.typeParameters) { + typeParamScope = nestTypeParamScope.call(this, this.scopeManager, node); + } + // visit flow type: ClassImplements + if (node.implements) { + for (var i = 0; i < node.implements.length; i++) { + checkIdentifierOrVisit.call(this, node.implements[i]); + } + } + if (node.superTypeParameters) { + for (var k = 0; k < node.superTypeParameters.params.length; k++) { + checkIdentifierOrVisit.call(this, node.superTypeParameters.params[k]); + } + } + visitClass.call(this, node); + if (typeParamScope) { + this.close(node); + } + }; + + // visit decorators that are in: Property / MethodDefinition + var visitProperty = referencer.prototype.visitProperty; + referencer.prototype.visitProperty = function(node) { + if (node.value && node.value.type === "TypeCastExpression") { + visitTypeAnnotation.call(this, node.value); + } + visitDecorators.call(this, node); + visitProperty.call(this, node); + }; + + function visitClassProperty(node) { + if (node.typeAnnotation) { + visitTypeAnnotation.call(this, node.typeAnnotation); + } + this.visitProperty(node); + } + + // visit ClassProperty as a Property. + referencer.prototype.ClassProperty = visitClassProperty; + + // visit ClassPrivateProperty as a Property. + referencer.prototype.ClassPrivateProperty = visitClassProperty; + + // visit flow type in FunctionDeclaration, FunctionExpression, ArrowFunctionExpression + var visitFunction = referencer.prototype.visitFunction; + referencer.prototype.visitFunction = function(node) { + var typeParamScope; + if (node.typeParameters) { + typeParamScope = nestTypeParamScope.call(this, this.scopeManager, node); + } + if (node.returnType) { + checkIdentifierOrVisit.call(this, node.returnType); + } + // only visit if function parameters have types + if (node.params) { + for (var i = 0; i < node.params.length; i++) { + var param = node.params[i]; + if (param.typeAnnotation) { + checkIdentifierOrVisit.call(this, param); + } else if (t.isAssignmentPattern(param)) { + if (param.left.typeAnnotation) { + checkIdentifierOrVisit.call(this, param.left); + } + } + } + } + // set ArrayPattern/ObjectPattern visitor keys back to their original. otherwise + // escope will traverse into them and include the identifiers within as declarations + estraverse.VisitorKeys.ObjectPattern = ["properties"]; + estraverse.VisitorKeys.ArrayPattern = ["elements"]; + visitFunction.call(this, node); + // set them back to normal... + estraverse.VisitorKeys.ObjectPattern = t.VISITOR_KEYS.ObjectPattern; + estraverse.VisitorKeys.ArrayPattern = t.VISITOR_KEYS.ArrayPattern; + if (typeParamScope) { + this.close(node); + } + }; + + // visit flow type in VariableDeclaration + var variableDeclaration = referencer.prototype.VariableDeclaration; + referencer.prototype.VariableDeclaration = function(node) { + if (node.declarations) { + for (var i = 0; i < node.declarations.length; i++) { + var id = node.declarations[i].id; + var typeAnnotation = id.typeAnnotation; + if (typeAnnotation) { + checkIdentifierOrVisit.call(this, typeAnnotation); + } + } + } + variableDeclaration.call(this, node); + }; + + function createScopeVariable(node, name) { + this.currentScope().variableScope.__define( + name, + new Definition("Variable", name, node, null, null, null) + ); + } + + referencer.prototype.InterfaceDeclaration = function(node) { + createScopeVariable.call(this, node, node.id); + var typeParamScope; + if (node.typeParameters) { + typeParamScope = nestTypeParamScope.call(this, this.scopeManager, node); + } + // TODO: Handle mixins + for (var i = 0; i < node.extends.length; i++) { + visitTypeAnnotation.call(this, node.extends[i]); + } + visitTypeAnnotation.call(this, node.body); + if (typeParamScope) { + this.close(node); + } + }; + + referencer.prototype.TypeAlias = function(node) { + createScopeVariable.call(this, node, node.id); + var typeParamScope; + if (node.typeParameters) { + typeParamScope = nestTypeParamScope.call(this, this.scopeManager, node); + } + if (node.right) { + visitTypeAnnotation.call(this, node.right); + } + if (typeParamScope) { + this.close(node); + } + }; + + referencer.prototype.DeclareModule = referencer.prototype.DeclareFunction = referencer.prototype.DeclareVariable = referencer.prototype.DeclareClass = function( + node + ) { + if (node.id) { + createScopeVariable.call(this, node, node.id); + } + + var typeParamScope; + if (node.typeParameters) { + typeParamScope = nestTypeParamScope.call(this, this.scopeManager, node); + } + if (typeParamScope) { + this.close(node); + } + }; + + referencer._babelEslintPatched = true; +} + +// To patch for each call. +var escope = null; +var escopeAnalyze = null; + +module.exports = function(parserOptions) { + // Patch `Referencer.prototype` once. + if (!escope) { + const modules = getModules(); + monkeypatch(modules); + + // Store to patch for each call. + escope = modules.escope; + escopeAnalyze = modules.escope.analyze; + } + + // Patch `escope.analyze` based on the current parserOptions. + escope.analyze = function(ast, opts) { + opts = opts || {}; + opts.ecmaVersion = parserOptions.ecmaVersion; + opts.sourceType = parserOptions.sourceType; + opts.nodejsScope = + ast.sourceType === "script" && + (parserOptions.ecmaFeatures && + parserOptions.ecmaFeatures.globalReturn) === true; + + return escopeAnalyze.call(this, ast, opts); + }; +}; diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 0f8892c21dd3..7338678d294b 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -20,7 +20,7 @@ }, "scripts": { "test": "npm run lint && npm run test-only", - "test-only": "mocha", + "test-only": "mocha && mocha --require test/fixtures/preprocess-to-patch.js && mocha --require test/fixtures/use-eslint-old.js", "lint": "eslint index.js babylon-to-espree test", "fix": "eslint index.js babylon-to-espree test --fix", "precommit": "lint-staged", @@ -39,9 +39,11 @@ "devDependencies": { "babel-eslint": "^8.0.0", "dedent": "^0.7.0", - "eslint": "^4.12.1", + "eslint": "^4.14.0", "eslint-config-babel": "^7.0.1", + "eslint-old": "npm:eslint@4.13.1", "eslint-plugin-flowtype": "^2.30.3", + "eslint-plugin-import": "^2.8.0", "eslint-plugin-prettier": "^2.1.2", "espree": "^3.4.0", "husky": "^0.14.0", diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 3bebc0acfde0..9218a783a4f2 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -4,48 +4,7 @@ var espree = require("espree"); var escope = require("eslint-scope"); var util = require("util"); var unpad = require("dedent"); - -// Checks if the source ast implements the target ast. Ignores extra keys on source ast -function assertImplementsAST(target, source, path) { - if (!path) { - path = []; - } - - function error(text) { - var err = new Error(`At ${path.join(".")}: ${text}:`); - err.depth = path.length + 1; - throw err; - } - - var typeA = target === null ? "null" : typeof target; - var typeB = source === null ? "null" : typeof source; - if (typeA !== typeB) { - error( - `have different types (${typeA} !== ${typeB}) (${target} !== ${source})` - ); - } else if ( - typeA === "object" && - ["RegExp"].indexOf(target.constructor.name) !== -1 && - target.constructor.name !== source.constructor.name - ) { - error( - `object have different constructors (${target.constructor - .name} !== ${source.constructor.name}` - ); - } else if (typeA === "object") { - var keysTarget = Object.keys(target); - for (var i in keysTarget) { - var key = keysTarget[i]; - path.push(key); - assertImplementsAST(target[key], source[key], path); - path.pop(); - } - } else if (target !== source) { - error( - `are different (${JSON.stringify(target)} !== ${JSON.stringify(source)})` - ); - } -} +var assertImplementsAST = require("./fixtures/assert-implements-ast"); function lookup(obj, keypath, backwardsDepth) { if (!keypath) { diff --git a/eslint/babel-eslint-parser/test/fixtures/assert-implements-ast.js b/eslint/babel-eslint-parser/test/fixtures/assert-implements-ast.js new file mode 100644 index 000000000000..61e77e21b06b --- /dev/null +++ b/eslint/babel-eslint-parser/test/fixtures/assert-implements-ast.js @@ -0,0 +1,41 @@ +// Checks if the source ast implements the target ast. Ignores extra keys on source ast +module.exports = function assertImplementsAST(target, source, path) { + if (!path) { + path = []; + } + + function error(text) { + var err = new Error(`At ${path.join(".")}: ${text}:`); + err.depth = path.length + 1; + throw err; + } + + var typeA = target === null ? "null" : typeof target; + var typeB = source === null ? "null" : typeof source; + if (typeA !== typeB) { + error( + `have different types (${typeA} !== ${typeB}) (${target} !== ${source})` + ); + } else if ( + typeA === "object" && + ["RegExp"].indexOf(target.constructor.name) !== -1 && + target.constructor.name !== source.constructor.name + ) { + error( + `object have different constructors (${target.constructor + .name} !== ${source.constructor.name}` + ); + } else if (typeA === "object") { + var keysTarget = Object.keys(target); + for (var i in keysTarget) { + var key = keysTarget[i]; + path.push(key); + assertImplementsAST(target[key], source[key], path); + path.pop(); + } + } else if (target !== source) { + error( + `are different (${JSON.stringify(target)} !== ${JSON.stringify(source)})` + ); + } +}; diff --git a/eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/.eslintrc.yml b/eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/.eslintrc.yml new file mode 100644 index 000000000000..418b3d0c0ceb --- /dev/null +++ b/eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/.eslintrc.yml @@ -0,0 +1,11 @@ +root: true + +# babel-eslint +parser: ../../../lib/index.js + +# use eslint-plugin-import +plugins: + - import +rules: + import/no-named-as-default: error + no-unused-vars: error diff --git a/eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/a.js b/eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/a.js new file mode 100644 index 000000000000..e8d96fc4d62d --- /dev/null +++ b/eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/a.js @@ -0,0 +1 @@ +export default function foo() { } diff --git a/eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/b.js b/eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/b.js new file mode 100644 index 000000000000..b3a52f870198 --- /dev/null +++ b/eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/b.js @@ -0,0 +1 @@ +import foo from './a.js'; diff --git a/eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/c.js b/eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/c.js new file mode 100644 index 000000000000..2beac98f3b74 --- /dev/null +++ b/eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/c.js @@ -0,0 +1,4 @@ +// @flow +type Foo = {}; + +const FlowTypeButton = ({ }: Foo) => { }; diff --git a/eslint/babel-eslint-parser/test/fixtures/preprocess-to-patch.js b/eslint/babel-eslint-parser/test/fixtures/preprocess-to-patch.js new file mode 100644 index 000000000000..1dbfc172a106 --- /dev/null +++ b/eslint/babel-eslint-parser/test/fixtures/preprocess-to-patch.js @@ -0,0 +1,5 @@ +"use strict" +const babelEslint = require("../..") + +// Apply monkeypatch to eslint-scope. +babelEslint.parse("var x = 0;") diff --git a/eslint/babel-eslint-parser/test/fixtures/use-eslint-old.js b/eslint/babel-eslint-parser/test/fixtures/use-eslint-old.js new file mode 100644 index 000000000000..e26a39c89d06 --- /dev/null +++ b/eslint/babel-eslint-parser/test/fixtures/use-eslint-old.js @@ -0,0 +1,12 @@ +"use strict" + +var Module = require('module'); +var originalRequire = Module.prototype.require; + +// Override to eslint-old +Module.prototype.require = function () { + if (arguments[0] === "eslint") { + arguments[0] = "eslint-old"; + } + return originalRequire.apply(this, arguments); +}; diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 4161af03d67b..8ff223b623a5 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -3,12 +3,13 @@ var eslint = require("eslint"); var unpad = require("dedent"); -function verifyAndAssertMessages( +function verifyAndAssertMessagesWithSpecificESLint( code, rules, expectedMessages, sourceType, - overrideConfig + overrideConfig, + linter ) { var config = { parser: require.resolve(".."), @@ -34,7 +35,7 @@ function verifyAndAssertMessages( } } - var messages = eslint.linter.verify(code, config); + var messages = linter.verify(code, config); if (messages.length !== expectedMessages.length) { throw new Error( @@ -62,6 +63,23 @@ function verifyAndAssertMessages( }); } +function verifyAndAssertMessages( + code, + rules, + expectedMessages, + sourceType, + overrideConfig +) { + verifyAndAssertMessagesWithSpecificESLint( + code, + rules, + expectedMessages, + sourceType, + overrideConfig, + new eslint.Linter() + ); +} + describe("verify", () => { it("arrow function support (issue #1)", () => { verifyAndAssertMessages("describe('stuff', () => {});", {}, []); diff --git a/eslint/babel-eslint-parser/test/z_parser-for-eslint-after-patched.js b/eslint/babel-eslint-parser/test/z_parser-for-eslint-after-patched.js new file mode 100644 index 000000000000..a7d6882d351e --- /dev/null +++ b/eslint/babel-eslint-parser/test/z_parser-for-eslint-after-patched.js @@ -0,0 +1,45 @@ +"use strict"; + +const eslint = require("eslint"); +const assert = require("assert"); +const babelEslint = require(".."); +const espree = require("espree"); +var assertImplementsAST = require("./fixtures/assert-implements-ast"); + +describe("https://github.com/babel/babel-eslint/issues/558", () => { + it("don't crash with eslint-plugin-import", () => { + const engine = new eslint.CLIEngine({ ignore: false }); + engine.executeOnFiles([ + "test/fixtures/eslint-plugin-import/a.js", + "test/fixtures/eslint-plugin-import/b.js", + "test/fixtures/eslint-plugin-import/c.js", + ]); + }); + + /* + * This test ensures that the enhanced referencer does not get used if eslint-scope has already been + * monkeypatched, because this causes some correctness issues. For example, if the enhanced referencer + * is used after the original referencer is monkeypatched, type annotation references are counted twice. + */ + it("does not visit type annotations multiple times after monkeypatching and calling parseForESLint()", () => { + assertImplementsAST( + espree.parse("foo", { sourceType: "module" }), + babelEslint.parse("foo", {}) + ); + const parseResult = babelEslint.parseForESLint( + "type Foo = {}; function x(): Foo {}", + { + eslintVisitorKeys: true, + eslintScopeManager: true, + } + ); + assert(parseResult.visitorKeys); + assert(parseResult.scopeManager); + + const fooVariable = parseResult.scopeManager.getDeclaredVariables( + parseResult.ast.body[0] + )[0]; + + assert.strictEqual(fooVariable.references.length, 1); + }); +}); diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index e3f869756116..5cb0ef21fa89 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -241,6 +241,10 @@ browser-stdout@1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" +builtin-modules@^1.0.0, builtin-modules@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" + caller-path@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" @@ -352,6 +356,10 @@ concat-stream@^1.6.0: readable-stream "^2.2.2" typedarray "^0.0.6" +contains-path@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" + core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" @@ -381,12 +389,18 @@ date-fns@^1.27.2: version "1.28.5" resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.28.5.tgz#257cfc45d322df45ef5658665967ee841cd73faf" -debug@3.1.0: +debug@3.1.0, debug@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" dependencies: ms "2.0.0" +debug@^2.6.8: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + dependencies: + ms "2.0.0" + debug@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/debug/-/debug-3.0.1.tgz#0564c612b521dc92d9f2988f0549e34f9c98db64" @@ -417,6 +431,13 @@ diff@3.3.1: version "3.3.1" resolved "https://registry.yarnpkg.com/diff/-/diff-3.3.1.tgz#aa8567a6eed03c531fc89d3f711cd0e5259dec75" +doctrine@1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" + dependencies: + esutils "^2.0.2" + isarray "^1.0.0" + doctrine@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.0.2.tgz#68f96ce8efc56cc42651f1faadb4f175273b0075" @@ -441,12 +462,83 @@ eslint-config-babel@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/eslint-config-babel/-/eslint-config-babel-7.0.1.tgz#aac7b79f2f06f52358a5a764fdc01fde23718572" +eslint-import-resolver-node@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.1.tgz#4422574cde66a9a7b099938ee4d508a199e0e3cc" + dependencies: + debug "^2.6.8" + resolve "^1.2.0" + +eslint-module-utils@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.1.1.tgz#abaec824177613b8a95b299639e1b6facf473449" + dependencies: + debug "^2.6.8" + pkg-dir "^1.0.0" + +"eslint-old@npm:eslint@4.13.1": + version "4.13.1" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.13.1.tgz#0055e0014464c7eb7878caf549ef2941992b444f" + dependencies: + ajv "^5.3.0" + babel-code-frame "^6.22.0" + chalk "^2.1.0" + concat-stream "^1.6.0" + cross-spawn "^5.1.0" + debug "^3.0.1" + doctrine "^2.0.2" + eslint-scope "^3.7.1" + espree "^3.5.2" + esquery "^1.0.0" + estraverse "^4.2.0" + esutils "^2.0.2" + file-entry-cache "^2.0.0" + functional-red-black-tree "^1.0.1" + glob "^7.1.2" + globals "^11.0.1" + ignore "^3.3.3" + imurmurhash "^0.1.4" + inquirer "^3.0.6" + is-resolvable "^1.0.0" + js-yaml "^3.9.1" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.3.0" + lodash "^4.17.4" + minimatch "^3.0.2" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + optionator "^0.8.2" + path-is-inside "^1.0.2" + pluralize "^7.0.0" + progress "^2.0.0" + require-uncached "^1.0.3" + semver "^5.3.0" + strip-ansi "^4.0.0" + strip-json-comments "~2.0.1" + table "^4.0.1" + text-table "~0.2.0" + eslint-plugin-flowtype@^2.30.3: version "2.34.0" resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.34.0.tgz#b9875f314652e5081623c9d2b18a346bbb759c09" dependencies: lodash "^4.15.0" +eslint-plugin-import@^2.8.0: + version "2.8.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.8.0.tgz#fa1b6ef31fcb3c501c09859c1b86f1fc5b986894" + dependencies: + builtin-modules "^1.1.1" + contains-path "^0.1.0" + debug "^2.6.8" + doctrine "1.5.0" + eslint-import-resolver-node "^0.3.1" + eslint-module-utils "^2.1.1" + has "^1.0.1" + lodash.cond "^4.3.0" + minimatch "^3.0.3" + read-pkg-up "^2.0.0" + eslint-plugin-prettier@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.1.2.tgz#4b90f4ee7f92bfbe2e926017e1ca40eb628965ea" @@ -465,21 +557,21 @@ eslint-visitor-keys@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" -eslint@^4.12.1: - version "4.12.1" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.12.1.tgz#5ec1973822b4a066b353770c3c6d69a2a188e880" +eslint@^4.14.0: + version "4.14.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.14.0.tgz#96609768d1dd23304faba2d94b7fefe5a5447a82" dependencies: ajv "^5.3.0" babel-code-frame "^6.22.0" chalk "^2.1.0" concat-stream "^1.6.0" cross-spawn "^5.1.0" - debug "^3.0.1" + debug "^3.1.0" doctrine "^2.0.2" eslint-scope "^3.7.1" + eslint-visitor-keys "^1.0.0" espree "^3.5.2" esquery "^1.0.0" - estraverse "^4.2.0" esutils "^2.0.2" file-entry-cache "^2.0.0" functional-red-black-tree "^1.0.1" @@ -610,6 +702,19 @@ file-entry-cache@^2.0.0: flat-cache "^1.2.1" object-assign "^4.0.1" +find-up@^1.0.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" + dependencies: + path-exists "^2.0.0" + pinkie-promise "^2.0.0" + +find-up@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + dependencies: + locate-path "^2.0.0" + flat-cache@^1.2.1: version "1.2.2" resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.2.2.tgz#fa86714e72c21db88601761ecf2f555d1abc6b96" @@ -623,6 +728,10 @@ fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" +function-bind@^1.0.2: + version "1.1.1" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + functional-red-black-tree@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" @@ -683,10 +792,20 @@ has-flag@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" +has@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28" + dependencies: + function-bind "^1.0.2" + he@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" +hosted-git-info@^2.1.4: + version "2.5.0" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.5.0.tgz#6d60e34b3abbc8313062c3b798ef8d901a07af3c" + husky@^0.14.0: version "0.14.1" resolved "https://registry.yarnpkg.com/husky/-/husky-0.14.1.tgz#8edba33e728ceed75343e88bb8002e4cbd8d1b40" @@ -757,6 +876,12 @@ is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" +is-builtin-module@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe" + dependencies: + builtin-modules "^1.0.0" + is-ci@^1.0.10: version "1.0.10" resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.0.10.tgz#f739336b2632365061a9d48270cd56ae3369318e" @@ -809,7 +934,7 @@ is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" -isarray@~1.0.0: +isarray@^1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" @@ -929,10 +1054,30 @@ listr@^0.12.0: stream-to-observable "^0.1.0" strip-ansi "^3.0.1" +load-json-file@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8" + dependencies: + graceful-fs "^4.1.2" + parse-json "^2.2.0" + pify "^2.0.0" + strip-bom "^3.0.0" + +locate-path@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" + dependencies: + p-locate "^2.0.0" + path-exists "^3.0.0" + lodash.chunk@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/lodash.chunk/-/lodash.chunk-4.2.0.tgz#66e5ce1f76ed27b4303d8c6512e8d1216e8106bc" +lodash.cond@^4.3.0: + version "4.5.2" + resolved "https://registry.yarnpkg.com/lodash.cond/-/lodash.cond-4.5.2.tgz#f471a1da486be60f6ab955d17115523dd1d255d5" + lodash@^4.0.0, lodash@^4.15.0, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" @@ -967,7 +1112,7 @@ mimic-fn@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18" -minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.4: +minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" dependencies: @@ -1014,6 +1159,15 @@ natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" +normalize-package-data@^2.3.2: + version "2.4.0" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f" + dependencies: + hosted-git-info "^2.1.4" + is-builtin-module "^1.0.0" + semver "2 || 3 || 4 || 5" + validate-npm-package-license "^3.0.1" + normalize-path@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-1.0.0.tgz#32d0e472f91ff345701c15a8311018d3b0a90379" @@ -1094,6 +1248,16 @@ p-finally@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" +p-limit@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.1.0.tgz#b07ff2d9a5d88bec806035895a2bab66a27988bc" + +p-locate@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" + dependencies: + p-limit "^1.1.0" + p-map@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/p-map/-/p-map-1.1.1.tgz#05f5e4ae97a068371bc2a5cc86bfbdbc19c4ae7a" @@ -1104,6 +1268,16 @@ parse-json@^2.2.0: dependencies: error-ex "^1.2.0" +path-exists@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" + dependencies: + pinkie-promise "^2.0.0" + +path-exists@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" @@ -1116,6 +1290,16 @@ path-key@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" +path-parse@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" + +path-type@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73" + dependencies: + pify "^2.0.0" + pify@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" @@ -1130,6 +1314,12 @@ pinkie@^2.0.0: version "2.0.4" resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" +pkg-dir@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-1.0.0.tgz#7a4b508a8d5bb2d629d447056ff4e9c9314cf3d4" + dependencies: + find-up "^1.0.0" + pluralize@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" @@ -1154,6 +1344,21 @@ pseudomap@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" +read-pkg-up@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" + dependencies: + find-up "^2.0.0" + read-pkg "^2.0.0" + +read-pkg@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-2.0.0.tgz#8ef1c0623c6a6db0dc6713c4bfac46332b2368f8" + dependencies: + load-json-file "^2.0.0" + normalize-package-data "^2.3.2" + path-type "^2.0.0" + readable-stream@^2.2.2: version "2.3.2" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.2.tgz#5a04df05e4f57fe3f0dc68fdd11dc5c97c7e6f4d" @@ -1187,6 +1392,12 @@ resolve-from@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" +resolve@^1.2.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36" + dependencies: + path-parse "^1.0.5" + restore-cursor@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541" @@ -1233,7 +1444,7 @@ safe-buffer@~5.1.0: version "5.1.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" -semver@^5.3.0: +"semver@2 || 3 || 4 || 5", semver@^5.3.0: version "5.4.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" @@ -1255,6 +1466,20 @@ slice-ansi@0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" +spdx-correct@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40" + dependencies: + spdx-license-ids "^1.0.2" + +spdx-expression-parse@~1.0.0: + version "1.0.4" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz#9bdf2f20e1f40ed447fbe273266191fced51626c" + +spdx-license-ids@^1.0.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz#c9df7a3424594ade6bd11900d596696dc06bac57" + sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" @@ -1300,6 +1525,10 @@ strip-ansi@^4.0.0: dependencies: ansi-regex "^3.0.0" +strip-bom@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + strip-eof@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" @@ -1379,6 +1608,13 @@ util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" +validate-npm-package-license@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz#2804babe712ad3379459acfbe24746ab2c303fbc" + dependencies: + spdx-correct "~1.0.0" + spdx-expression-parse "~1.0.0" + which@^1.2.10, which@^1.2.9: version "1.2.14" resolved "https://registry.yarnpkg.com/which/-/which-1.2.14.tgz#9a87c4378f03e827cecaf1acdf56c736c01c14e5" From a706e85b19fa25c2e7db1bcf508c2fbaddfd5e55 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Mon, 25 Dec 2017 15:57:19 +0900 Subject: [PATCH 399/569] 8.1.1 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 7338678d294b..501733ce2f40 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "8.1.0", + "version": "8.1.1", "description": "Custom parser for ESLint", "main": "lib/index.js", "files": [ From 3cb154df82f2f96691de1d224a6fe8dcb808d079 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Tue, 26 Dec 2017 10:49:36 +0900 Subject: [PATCH 400/569] Fix: ignore eval (fixes babel/babel-eslint#560) (babel/babel-eslint#561) --- eslint/babel-eslint-parser/lib/analyze-scope.js | 1 + eslint/babel-eslint-parser/test/non-regression.js | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/eslint/babel-eslint-parser/lib/analyze-scope.js b/eslint/babel-eslint-parser/lib/analyze-scope.js index 6001c13647e4..287763ccef55 100644 --- a/eslint/babel-eslint-parser/lib/analyze-scope.js +++ b/eslint/babel-eslint-parser/lib/analyze-scope.js @@ -309,6 +309,7 @@ class Referencer extends OriginalReferencer { module.exports = function(ast, parserOptions) { const options = { + ignoreEval: true, optimistic: false, directive: false, nodejsScope: diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 8ff223b623a5..1d223bd8a87a 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1874,4 +1874,16 @@ describe("verify", () => { [] ); }); + + it("ignore eval in scope analysis", () => { + verifyAndAssertMessages( + unpad(` + const a = 1; + console.log(a); + eval(''); + `), + { "no-unused-vars": 1, "no-undef": 1 }, + [] + ); + }); }); From 624a425f7da138772c95092c3b0d07aaac0db0d8 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Tue, 26 Dec 2017 10:50:13 +0900 Subject: [PATCH 401/569] Fix: add Literal type to visitorKeys (babel/babel-eslint#562) * Fix: add Literal type to visitorKeys * Fix: use ./visitor-keys --- eslint/babel-eslint-parser/lib/parse-with-scope.js | 3 +-- eslint/babel-eslint-parser/lib/visitor-keys.js | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/lib/parse-with-scope.js b/eslint/babel-eslint-parser/lib/parse-with-scope.js index 8892076e596c..36e3fce5b067 100644 --- a/eslint/babel-eslint-parser/lib/parse-with-scope.js +++ b/eslint/babel-eslint-parser/lib/parse-with-scope.js @@ -1,13 +1,12 @@ "use strict"; -const t = require("@babel/types"); +const visitorKeys = require("./visitor-keys"); const analyzeScope = require("./analyze-scope"); const parse = require("./parse"); module.exports = function(code, options) { const ast = parse(code, options); const scopeManager = analyzeScope(ast, options); - const visitorKeys = t.VISITOR_KEYS; return { ast, scopeManager, visitorKeys }; }; diff --git a/eslint/babel-eslint-parser/lib/visitor-keys.js b/eslint/babel-eslint-parser/lib/visitor-keys.js index 9ef7ef970c94..921a0bb01657 100644 --- a/eslint/babel-eslint-parser/lib/visitor-keys.js +++ b/eslint/babel-eslint-parser/lib/visitor-keys.js @@ -5,6 +5,7 @@ const ESLINT_VISITOR_KEYS = require("eslint-visitor-keys").KEYS; module.exports = Object.assign( { + Literal: ESLINT_VISITOR_KEYS.Literal, MethodDefinition: ["decorators"].concat( ESLINT_VISITOR_KEYS.MethodDefinition ), From d0d84aca9b1cc70c0cccb8045395165c47eee7e5 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Tue, 26 Dec 2017 10:59:19 +0900 Subject: [PATCH 402/569] 8.1.2 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 501733ce2f40..dc7dce591e48 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "8.1.1", + "version": "8.1.2", "description": "Custom parser for ESLint", "main": "lib/index.js", "files": [ From 660180b93258d9195cc1acfea9b88627edd0c26f Mon Sep 17 00:00:00 2001 From: jony89 Date: Tue, 9 Jan 2018 00:40:11 +0200 Subject: [PATCH 403/569] update babel packages (babel/babel-eslint#565) * update babel packages There is some critical bug fixes in version babylon#7.0.0-beta.33 regard `async` - `await` syntax which is needed pretty immediately :) * remove test 42 (test for import type *) `import type *` is invalid, since the namespace can't be a type --- eslint/babel-eslint-parser/package.json | 8 ++++---- eslint/babel-eslint-parser/test/non-regression.js | 11 ----------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index dc7dce591e48..61f2974d93af 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -11,10 +11,10 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "@babel/code-frame": "7.0.0-beta.31", - "@babel/traverse": "7.0.0-beta.31", - "@babel/types": "7.0.0-beta.31", - "babylon": "7.0.0-beta.31", + "@babel/code-frame": "7.0.0-beta.36", + "@babel/traverse": "7.0.0-beta.36", + "@babel/types": "7.0.0-beta.36", + "babylon": "7.0.0-beta.36", "eslint-scope": "~3.7.1", "eslint-visitor-keys": "^1.0.0" }, diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 1d223bd8a87a..67fa66226718 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1079,17 +1079,6 @@ describe("verify", () => { ); }); - it("42", () => { - verifyAndAssertMessages( - unpad(` - import type * as namespace from 'bar'; - namespace; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] - ); - }); - it("43", () => { verifyAndAssertMessages( unpad(` From 97c944251114bb0ef6a40191157914556fc7c1ee Mon Sep 17 00:00:00 2001 From: Kai Cataldo Date: Mon, 8 Jan 2018 17:45:24 -0500 Subject: [PATCH 404/569] Make 2018 the default ecmaVersion for rules relying on parserOptions (babel/babel-eslint#556) --- eslint/babel-eslint-parser/lib/analyze-scope.js | 2 +- eslint/babel-eslint-parser/lib/index.js | 2 +- eslint/babel-eslint-parser/package.json | 2 +- eslint/babel-eslint-parser/test/babel-eslint.js | 4 ++-- eslint/babel-eslint-parser/test/non-regression.js | 2 +- eslint/babel-eslint-parser/yarn.lock | 11 ----------- 6 files changed, 6 insertions(+), 17 deletions(-) diff --git a/eslint/babel-eslint-parser/lib/analyze-scope.js b/eslint/babel-eslint-parser/lib/analyze-scope.js index 287763ccef55..dd4cc3b35a5a 100644 --- a/eslint/babel-eslint-parser/lib/analyze-scope.js +++ b/eslint/babel-eslint-parser/lib/analyze-scope.js @@ -318,7 +318,7 @@ module.exports = function(ast, parserOptions) { parserOptions.ecmaFeatures.globalReturn) === true, impliedStrict: false, sourceType: ast.sourceType, - ecmaVersion: parserOptions.ecmaVersion || 6, + ecmaVersion: parserOptions.ecmaVersion || 2018, fallback, }; diff --git a/eslint/babel-eslint-parser/lib/index.js b/eslint/babel-eslint-parser/lib/index.js index 973f742ea592..c4655280afad 100644 --- a/eslint/babel-eslint-parser/lib/index.js +++ b/eslint/babel-eslint-parser/lib/index.js @@ -6,7 +6,7 @@ exports.parse = function(code, options) { exports.parseForESLint = function(code, options) { options = options || {}; - options.ecmaVersion = options.ecmaVersion || 6; + options.ecmaVersion = options.ecmaVersion || 2018; options.sourceType = options.sourceType || "module"; options.allowImportExportEverywhere = options.allowImportExportEverywhere || false; diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 61f2974d93af..3c93db711381 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -45,7 +45,7 @@ "eslint-plugin-flowtype": "^2.30.3", "eslint-plugin-import": "^2.8.0", "eslint-plugin-prettier": "^2.1.2", - "espree": "^3.4.0", + "espree": "^3.5.2", "husky": "^0.14.0", "lint-staged": "^4.0.0", "mocha": "^4.0.0", diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 9218a783a4f2..db1b5222de09 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -37,7 +37,7 @@ function parseAndAssertSame(code) { range: true, comment: true, attachComment: true, - ecmaVersion: 8, + ecmaVersion: 2018, sourceType: "module", }); var babylonAST = babelEslint.parseForESLint(code, { @@ -71,7 +71,7 @@ function parseAndAssertSame(code) { // assert.equal(esAST, babylonAST); } -describe("babylon-to-esprima", () => { +describe("babylon-to-espree", () => { describe("compatibility", () => { it("should allow ast.analyze to be called without options", function() { var esAST = babelEslint.parseForESLint("`test`", { diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 67fa66226718..da0f4158a405 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -19,7 +19,7 @@ function verifyAndAssertMessagesWithSpecificESLint( es6: true, }, parserOptions: { - ecmaVersion: 8, + ecmaVersion: 2018, ecmaFeatures: { jsx: true, experimentalObjectRestSpread: true, diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index 5cb0ef21fa89..88c27bf9308f 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -65,10 +65,6 @@ acorn@^3.0.4: version "3.3.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" -acorn@^5.0.1: - version "5.0.3" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.0.3.tgz#c460df08491463f028ccb82eab3730bf01087b3d" - acorn@^5.2.1: version "5.2.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.2.1.tgz#317ac7821826c22c702d66189ab8359675f135d7" @@ -599,13 +595,6 @@ eslint@^4.14.0: table "^4.0.1" text-table "~0.2.0" -espree@^3.4.0: - version "3.4.3" - resolved "https://registry.yarnpkg.com/espree/-/espree-3.4.3.tgz#2910b5ccd49ce893c2ffffaab4fd8b3a31b82374" - dependencies: - acorn "^5.0.1" - acorn-jsx "^3.0.0" - espree@^3.5.2: version "3.5.2" resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.2.tgz#756ada8b979e9dcfcdb30aad8d1a9304a905e1ca" From 2afde9943402092413bb124bf99c801d3e81c0c6 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 8 Jan 2018 17:46:57 -0500 Subject: [PATCH 405/569] Add other parser plugins, update yarn.lock (babel/babel-eslint#569) --- eslint/babel-eslint-parser/lib/parse.js | 3 ++ eslint/babel-eslint-parser/yarn.lock | 71 +++++++++++++------------ 2 files changed, 40 insertions(+), 34 deletions(-) diff --git a/eslint/babel-eslint-parser/lib/parse.js b/eslint/babel-eslint-parser/lib/parse.js index 0763d7e056ac..14ee9ae17a2a 100644 --- a/eslint/babel-eslint-parser/lib/parse.js +++ b/eslint/babel-eslint-parser/lib/parse.js @@ -38,6 +38,9 @@ module.exports = function(code, options) { "classPrivateProperties", "bigInt", "optionalCatchBinding", + "throwExpressions", + "pipelineOperator", + "nullishCoalescingOperator", ], }; diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index 88c27bf9308f..2687f955f704 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -2,54 +2,53 @@ # yarn lockfile v1 -"@babel/code-frame@7.0.0-beta.31": - version "7.0.0-beta.31" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.31.tgz#473d021ecc573a2cce1c07d5b509d5215f46ba35" +"@babel/code-frame@7.0.0-beta.36": + version "7.0.0-beta.36" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.36.tgz#2349d7ec04b3a06945ae173280ef8579b63728e4" dependencies: chalk "^2.0.0" esutils "^2.0.2" js-tokens "^3.0.0" -"@babel/helper-function-name@7.0.0-beta.31": - version "7.0.0-beta.31" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.31.tgz#afe63ad799209989348b1109b44feb66aa245f57" +"@babel/helper-function-name@7.0.0-beta.36": + version "7.0.0-beta.36" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.36.tgz#366e3bc35147721b69009f803907c4d53212e88d" dependencies: - "@babel/helper-get-function-arity" "7.0.0-beta.31" - "@babel/template" "7.0.0-beta.31" - "@babel/traverse" "7.0.0-beta.31" - "@babel/types" "7.0.0-beta.31" + "@babel/helper-get-function-arity" "7.0.0-beta.36" + "@babel/template" "7.0.0-beta.36" + "@babel/types" "7.0.0-beta.36" -"@babel/helper-get-function-arity@7.0.0-beta.31": - version "7.0.0-beta.31" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.31.tgz#1176d79252741218e0aec872ada07efb2b37a493" +"@babel/helper-get-function-arity@7.0.0-beta.36": + version "7.0.0-beta.36" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.36.tgz#f5383bac9a96b274828b10d98900e84ee43e32b8" dependencies: - "@babel/types" "7.0.0-beta.31" + "@babel/types" "7.0.0-beta.36" -"@babel/template@7.0.0-beta.31": - version "7.0.0-beta.31" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.31.tgz#577bb29389f6c497c3e7d014617e7d6713f68bda" +"@babel/template@7.0.0-beta.36": + version "7.0.0-beta.36" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.36.tgz#02e903de5d68bd7899bce3c5b5447e59529abb00" dependencies: - "@babel/code-frame" "7.0.0-beta.31" - "@babel/types" "7.0.0-beta.31" - babylon "7.0.0-beta.31" + "@babel/code-frame" "7.0.0-beta.36" + "@babel/types" "7.0.0-beta.36" + babylon "7.0.0-beta.36" lodash "^4.2.0" -"@babel/traverse@7.0.0-beta.31": - version "7.0.0-beta.31" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.31.tgz#db399499ad74aefda014f0c10321ab255134b1df" +"@babel/traverse@7.0.0-beta.36": + version "7.0.0-beta.36" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.36.tgz#1dc6f8750e89b6b979de5fe44aa993b1a2192261" dependencies: - "@babel/code-frame" "7.0.0-beta.31" - "@babel/helper-function-name" "7.0.0-beta.31" - "@babel/types" "7.0.0-beta.31" - babylon "7.0.0-beta.31" + "@babel/code-frame" "7.0.0-beta.36" + "@babel/helper-function-name" "7.0.0-beta.36" + "@babel/types" "7.0.0-beta.36" + babylon "7.0.0-beta.36" debug "^3.0.1" - globals "^10.0.0" + globals "^11.1.0" invariant "^2.2.0" lodash "^4.2.0" -"@babel/types@7.0.0-beta.31": - version "7.0.0-beta.31" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.31.tgz#42c9c86784f674c173fb21882ca9643334029de4" +"@babel/types@7.0.0-beta.36": + version "7.0.0-beta.36" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.36.tgz#64f2004353de42adb72f9ebb4665fc35b5499d23" dependencies: esutils "^2.0.2" lodash "^4.2.0" @@ -218,9 +217,9 @@ babylon@7.0.0-beta.22: version "7.0.0-beta.22" resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.22.tgz#74f0ad82ed7c7c3cfeab74cf684f815104161b65" -babylon@7.0.0-beta.31: - version "7.0.0-beta.31" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.31.tgz#7ec10f81e0e456fd0f855ad60fa30c2ac454283f" +babylon@7.0.0-beta.36: + version "7.0.0-beta.36" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.36.tgz#3a3683ba6a9a1e02b0aa507c8e63435e39305b9e" balanced-match@^1.0.0: version "1.0.0" @@ -748,6 +747,10 @@ globals@^11.0.1: version "11.0.1" resolved "https://registry.yarnpkg.com/globals/-/globals-11.0.1.tgz#12a87bb010e5154396acc535e1e43fc753b0e5e8" +globals@^11.1.0: + version "11.1.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.1.0.tgz#632644457f5f0e3ae711807183700ebf2e4633e4" + globby@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d" From b6ce2b649f8e5ffcb75ba2c3f42c7cbf83f1a46c Mon Sep 17 00:00:00 2001 From: Kai Cataldo Date: Mon, 8 Jan 2018 18:06:57 -0500 Subject: [PATCH 406/569] 8.2.0 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 3c93db711381..04e02892eb55 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "8.1.2", + "version": "8.2.0", "description": "Custom parser for ESLint", "main": "lib/index.js", "files": [ From 23d12acd1524604d1db785b51d1981cc132c9130 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 8 Jan 2018 19:15:22 -0500 Subject: [PATCH 407/569] fix export change (babel/babel-eslint#571) --- eslint/babel-eslint-parser/lib/parse.js | 3 ++- .../test/non-regression.js | 20 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/lib/parse.js b/eslint/babel-eslint-parser/lib/parse.js index 14ee9ae17a2a..f29e6af155b5 100644 --- a/eslint/babel-eslint-parser/lib/parse.js +++ b/eslint/babel-eslint-parser/lib/parse.js @@ -26,7 +26,8 @@ module.exports = function(code, options) { "decorators", "doExpressions", "exponentiationOperator", - "exportExtensions", + "exportDefaultFrom", + "exportNamespaceFrom", "functionBind", "functionSent", "objectRestSpread", diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index da0f4158a405..db5bb59c1791 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1864,6 +1864,26 @@ describe("verify", () => { ); }); + it("exportDefaultFrom", () => { + verifyAndAssertMessages( + unpad(` + export v from "mod" + `), + {}, + [] + ); + }); + + it("exportNamespaceFrom", () => { + verifyAndAssertMessages( + unpad(` + export * as ns from "mod" + `), + {}, + [] + ); + }); + it("ignore eval in scope analysis", () => { verifyAndAssertMessages( unpad(` From 6d37c551dd2bf0fc7a15754400d685a7cf76045f Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 8 Jan 2018 19:15:40 -0500 Subject: [PATCH 408/569] 8.2.1 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 04e02892eb55..46f9462b2c08 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "8.2.0", + "version": "8.2.1", "description": "Custom parser for ESLint", "main": "lib/index.js", "files": [ From fbb7ff6e44dad0178fc8efd22663df108772d215 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Wed, 17 Jan 2018 15:10:55 +0900 Subject: [PATCH 409/569] Fix: wrong token type of ! and ~ (fixes babel/babel-eslint#576) (babel/babel-eslint#577) --- .../lib/babylon-to-espree/toToken.js | 3 ++- eslint/babel-eslint-parser/test/babel-eslint.js | 14 ++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/eslint/babel-eslint-parser/lib/babylon-to-espree/toToken.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/toToken.js index 9c5a49ef11dd..082aef3e3267 100644 --- a/eslint/babel-eslint-parser/lib/babylon-to-espree/toToken.js +++ b/eslint/babel-eslint-parser/lib/babylon-to-espree/toToken.js @@ -38,7 +38,8 @@ module.exports = function(token, tt, source) { type === tt.plusMin || type === tt.modulo || type === tt.exponent || - type === tt.prefix || + type === tt.bang || + type === tt.tilde || type === tt.doubleColon || type.isAssign ) { diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index db1b5222de09..c066ed280997 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -48,12 +48,6 @@ function parseAndAssertSame(code) { assertImplementsAST(esAST, babylonAST); } catch (err) { var traversal = err.message.slice(3, err.message.indexOf(":")); - if (esAST.tokens) { - delete esAST.tokens; - } - if (babylonAST.tokens) { - delete babylonAST.tokens; - } err.message += unpad(` espree: ${util.inspect(lookup(esAST, traversal, 2), { @@ -170,6 +164,14 @@ describe("babylon-to-espree", () => { parseAndAssertSame("a = 1"); }); + it("logical NOT", () => { + parseAndAssertSame("!0"); + }); + + it("bitwise NOT", () => { + parseAndAssertSame("~0"); + }); + it("class declaration", () => { parseAndAssertSame("class Foo {}"); }); From 7057e9fb73b3f6b127b50636240850418490571c Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Thu, 15 Feb 2018 21:39:42 -0600 Subject: [PATCH 410/569] Bump deps (babel/babel-eslint#591) --- eslint/babel-eslint-parser/package.json | 10 +-- eslint/babel-eslint-parser/yarn.lock | 105 +++++++++++++++--------- 2 files changed, 72 insertions(+), 43 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 46f9462b2c08..62edfc262c61 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -11,10 +11,10 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "@babel/code-frame": "7.0.0-beta.36", - "@babel/traverse": "7.0.0-beta.36", - "@babel/types": "7.0.0-beta.36", - "babylon": "7.0.0-beta.36", + "@babel/code-frame": "7.0.0-beta.40", + "@babel/traverse": "7.0.0-beta.40", + "@babel/types": "7.0.0-beta.40", + "babylon": "7.0.0-beta.40", "eslint-scope": "~3.7.1", "eslint-visitor-keys": "^1.0.0" }, @@ -48,7 +48,7 @@ "espree": "^3.5.2", "husky": "^0.14.0", "lint-staged": "^4.0.0", - "mocha": "^4.0.0", + "mocha": "^5.0.1", "prettier": "^1.4.4" }, "lint-staged": { diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index 2687f955f704..06890f7ee2b0 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -2,53 +2,70 @@ # yarn lockfile v1 -"@babel/code-frame@7.0.0-beta.36": - version "7.0.0-beta.36" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.36.tgz#2349d7ec04b3a06945ae173280ef8579b63728e4" +"@babel/code-frame@7.0.0-beta.40": + version "7.0.0-beta.40" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.40.tgz#37e2b0cf7c56026b4b21d3927cadf81adec32ac6" dependencies: - chalk "^2.0.0" - esutils "^2.0.2" - js-tokens "^3.0.0" + "@babel/highlight" "7.0.0-beta.40" + +"@babel/generator@7.0.0-beta.40": + version "7.0.0-beta.40" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0-beta.40.tgz#ab61f9556f4f71dbd1138949c795bb9a21e302ea" + dependencies: + "@babel/types" "7.0.0-beta.40" + jsesc "^2.5.1" + lodash "^4.2.0" + source-map "^0.5.0" + trim-right "^1.0.1" + +"@babel/helper-function-name@7.0.0-beta.40": + version "7.0.0-beta.40" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.40.tgz#9d033341ab16517f40d43a73f2d81fc431ccd7b6" + dependencies: + "@babel/helper-get-function-arity" "7.0.0-beta.40" + "@babel/template" "7.0.0-beta.40" + "@babel/types" "7.0.0-beta.40" -"@babel/helper-function-name@7.0.0-beta.36": - version "7.0.0-beta.36" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.36.tgz#366e3bc35147721b69009f803907c4d53212e88d" +"@babel/helper-get-function-arity@7.0.0-beta.40": + version "7.0.0-beta.40" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.40.tgz#ac0419cf067b0ec16453e1274f03878195791c6e" dependencies: - "@babel/helper-get-function-arity" "7.0.0-beta.36" - "@babel/template" "7.0.0-beta.36" - "@babel/types" "7.0.0-beta.36" + "@babel/types" "7.0.0-beta.40" -"@babel/helper-get-function-arity@7.0.0-beta.36": - version "7.0.0-beta.36" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.36.tgz#f5383bac9a96b274828b10d98900e84ee43e32b8" +"@babel/highlight@7.0.0-beta.40": + version "7.0.0-beta.40" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-beta.40.tgz#b43d67d76bf46e1d10d227f68cddcd263786b255" dependencies: - "@babel/types" "7.0.0-beta.36" + chalk "^2.0.0" + esutils "^2.0.2" + js-tokens "^3.0.0" -"@babel/template@7.0.0-beta.36": - version "7.0.0-beta.36" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.36.tgz#02e903de5d68bd7899bce3c5b5447e59529abb00" +"@babel/template@7.0.0-beta.40": + version "7.0.0-beta.40" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.40.tgz#034988c6424eb5c3268fe6a608626de1f4410fc8" dependencies: - "@babel/code-frame" "7.0.0-beta.36" - "@babel/types" "7.0.0-beta.36" - babylon "7.0.0-beta.36" + "@babel/code-frame" "7.0.0-beta.40" + "@babel/types" "7.0.0-beta.40" + babylon "7.0.0-beta.40" lodash "^4.2.0" -"@babel/traverse@7.0.0-beta.36": - version "7.0.0-beta.36" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.36.tgz#1dc6f8750e89b6b979de5fe44aa993b1a2192261" +"@babel/traverse@7.0.0-beta.40": + version "7.0.0-beta.40" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.40.tgz#d140e449b2e093ef9fe1a2eecc28421ffb4e521e" dependencies: - "@babel/code-frame" "7.0.0-beta.36" - "@babel/helper-function-name" "7.0.0-beta.36" - "@babel/types" "7.0.0-beta.36" - babylon "7.0.0-beta.36" + "@babel/code-frame" "7.0.0-beta.40" + "@babel/generator" "7.0.0-beta.40" + "@babel/helper-function-name" "7.0.0-beta.40" + "@babel/types" "7.0.0-beta.40" + babylon "7.0.0-beta.40" debug "^3.0.1" globals "^11.1.0" invariant "^2.2.0" lodash "^4.2.0" -"@babel/types@7.0.0-beta.36": - version "7.0.0-beta.36" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.36.tgz#64f2004353de42adb72f9ebb4665fc35b5499d23" +"@babel/types@7.0.0-beta.40": + version "7.0.0-beta.40" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.40.tgz#25c3d7aae14126abe05fcb098c65a66b6d6b8c14" dependencies: esutils "^2.0.2" lodash "^4.2.0" @@ -217,9 +234,9 @@ babylon@7.0.0-beta.22: version "7.0.0-beta.22" resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.22.tgz#74f0ad82ed7c7c3cfeab74cf684f815104161b65" -babylon@7.0.0-beta.36: - version "7.0.0-beta.36" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.36.tgz#3a3683ba6a9a1e02b0aa507c8e63435e39305b9e" +babylon@7.0.0-beta.40: + version "7.0.0-beta.40" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.40.tgz#91fc8cd56d5eb98b28e6fde41045f2957779940a" balanced-match@^1.0.0: version "1.0.0" @@ -960,6 +977,10 @@ jschardet@^1.4.2: version "1.4.2" resolved "https://registry.yarnpkg.com/jschardet/-/jschardet-1.4.2.tgz#2aa107f142af4121d145659d44f50830961e699a" +jsesc@^2.5.1: + version "2.5.1" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.1.tgz#e421a2a8e20d6b0819df28908f782526b96dd1fe" + json-schema-traverse@^0.3.0: version "0.3.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" @@ -1124,9 +1145,9 @@ mkdirp@0.5.1, mkdirp@^0.5.1: dependencies: minimist "0.0.8" -mocha@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-4.0.1.tgz#0aee5a95cf69a4618820f5e51fa31717117daf1b" +mocha@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-5.0.1.tgz#759b62c836b0732382a62b6b1fb245ec1bc943ac" dependencies: browser-stdout "1.3.0" commander "2.11.0" @@ -1458,6 +1479,10 @@ slice-ansi@0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" +source-map@^0.5.0: + version "0.5.7" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + spdx-correct@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40" @@ -1582,6 +1607,10 @@ to-fast-properties@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" +trim-right@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" + tryit@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/tryit/-/tryit-1.0.3.tgz#393be730a9446fd1ead6da59a014308f36c289cb" From c03d5c41a5d9f3d58f3820d98fcec9085f9910b6 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Tue, 20 Feb 2018 11:49:19 +0100 Subject: [PATCH 411/569] chore(package): update lint-staged to version 6.1.1 (babel/babel-eslint#592) Closes babel/babel-eslint#539 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 62edfc262c61..7ba9a610a2de 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -47,7 +47,7 @@ "eslint-plugin-prettier": "^2.1.2", "espree": "^3.5.2", "husky": "^0.14.0", - "lint-staged": "^4.0.0", + "lint-staged": "^6.1.1", "mocha": "^5.0.1", "prettier": "^1.4.4" }, From c27c2b6e68b5066de91cf95847472063c4251336 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Tue, 20 Feb 2018 11:54:09 +0100 Subject: [PATCH 412/569] Update dependencies --- eslint/babel-eslint-parser/.eslintrc.js | 2 +- eslint/babel-eslint-parser/.prettierrc | 3 + .../babel-eslint-parser/lib/analyze-scope.js | 4 +- eslint/babel-eslint-parser/package.json | 2 +- .../test/non-regression.js | 14 +- eslint/babel-eslint-parser/yarn.lock | 737 ++++++++++-------- 6 files changed, 404 insertions(+), 358 deletions(-) create mode 100644 eslint/babel-eslint-parser/.prettierrc diff --git a/eslint/babel-eslint-parser/.eslintrc.js b/eslint/babel-eslint-parser/.eslintrc.js index adce94d69a00..64dc12e693fe 100644 --- a/eslint/babel-eslint-parser/.eslintrc.js +++ b/eslint/babel-eslint-parser/.eslintrc.js @@ -7,7 +7,7 @@ module.exports = { rules: { "no-var": 0, "max-len": 0, - "prettier/prettier": ["error", { "trailingComma": "es5" }], + "prettier/prettier": "error", }, env: { node: true, diff --git a/eslint/babel-eslint-parser/.prettierrc b/eslint/babel-eslint-parser/.prettierrc new file mode 100644 index 000000000000..88a0e9a2990e --- /dev/null +++ b/eslint/babel-eslint-parser/.prettierrc @@ -0,0 +1,3 @@ +{ + "trailingComma": "es5" + } \ No newline at end of file diff --git a/eslint/babel-eslint-parser/lib/analyze-scope.js b/eslint/babel-eslint-parser/lib/analyze-scope.js index dd4cc3b35a5a..fb9f4d4e8c09 100644 --- a/eslint/babel-eslint-parser/lib/analyze-scope.js +++ b/eslint/babel-eslint-parser/lib/analyze-scope.js @@ -314,8 +314,8 @@ module.exports = function(ast, parserOptions) { directive: false, nodejsScope: ast.sourceType === "script" && - (parserOptions.ecmaFeatures && - parserOptions.ecmaFeatures.globalReturn) === true, + (parserOptions.ecmaFeatures && + parserOptions.ecmaFeatures.globalReturn) === true, impliedStrict: false, sourceType: ast.sourceType, ecmaVersion: parserOptions.ecmaVersion || 2018, diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 7ba9a610a2de..102de3554c86 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -39,7 +39,7 @@ "devDependencies": { "babel-eslint": "^8.0.0", "dedent": "^0.7.0", - "eslint": "^4.14.0", + "eslint": "npm:eslint@4.13.1", "eslint-config-babel": "^7.0.1", "eslint-old": "npm:eslint@4.13.1", "eslint-plugin-flowtype": "^2.30.3", diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index db5bb59c1791..9031a410f0eb 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -39,18 +39,16 @@ function verifyAndAssertMessagesWithSpecificESLint( if (messages.length !== expectedMessages.length) { throw new Error( - `Expected ${expectedMessages.length} message(s), got ${messages.length}\n${JSON.stringify( - messages, - null, - 2 - )}` + `Expected ${expectedMessages.length} message(s), got ${ + messages.length + }\n${JSON.stringify(messages, null, 2)}` ); } messages.forEach((message, i) => { - var formatedMessage = `${message.line}:${message.column} ${message.message}${message.ruleId - ? ` ${message.ruleId}` - : ""}`; + var formatedMessage = `${message.line}:${message.column} ${ + message.message + }${message.ruleId ? ` ${message.ruleId}` : ""}`; if (formatedMessage !== expectedMessages[i]) { throw new Error( unpad(` diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index 06890f7ee2b0..5fb449e52708 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -2,6 +2,14 @@ # yarn lockfile v1 +"@babel/code-frame@7.0.0-beta.36": + version "7.0.0-beta.36" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.36.tgz#2349d7ec04b3a06945ae173280ef8579b63728e4" + dependencies: + chalk "^2.0.0" + esutils "^2.0.2" + js-tokens "^3.0.0" + "@babel/code-frame@7.0.0-beta.40": version "7.0.0-beta.40" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.40.tgz#37e2b0cf7c56026b4b21d3927cadf81adec32ac6" @@ -18,6 +26,14 @@ source-map "^0.5.0" trim-right "^1.0.1" +"@babel/helper-function-name@7.0.0-beta.36": + version "7.0.0-beta.36" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.36.tgz#366e3bc35147721b69009f803907c4d53212e88d" + dependencies: + "@babel/helper-get-function-arity" "7.0.0-beta.36" + "@babel/template" "7.0.0-beta.36" + "@babel/types" "7.0.0-beta.36" + "@babel/helper-function-name@7.0.0-beta.40": version "7.0.0-beta.40" resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.40.tgz#9d033341ab16517f40d43a73f2d81fc431ccd7b6" @@ -26,6 +42,12 @@ "@babel/template" "7.0.0-beta.40" "@babel/types" "7.0.0-beta.40" +"@babel/helper-get-function-arity@7.0.0-beta.36": + version "7.0.0-beta.36" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.36.tgz#f5383bac9a96b274828b10d98900e84ee43e32b8" + dependencies: + "@babel/types" "7.0.0-beta.36" + "@babel/helper-get-function-arity@7.0.0-beta.40": version "7.0.0-beta.40" resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.40.tgz#ac0419cf067b0ec16453e1274f03878195791c6e" @@ -40,6 +62,15 @@ esutils "^2.0.2" js-tokens "^3.0.0" +"@babel/template@7.0.0-beta.36": + version "7.0.0-beta.36" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.36.tgz#02e903de5d68bd7899bce3c5b5447e59529abb00" + dependencies: + "@babel/code-frame" "7.0.0-beta.36" + "@babel/types" "7.0.0-beta.36" + babylon "7.0.0-beta.36" + lodash "^4.2.0" + "@babel/template@7.0.0-beta.40": version "7.0.0-beta.40" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.40.tgz#034988c6424eb5c3268fe6a608626de1f4410fc8" @@ -49,6 +80,19 @@ babylon "7.0.0-beta.40" lodash "^4.2.0" +"@babel/traverse@7.0.0-beta.36": + version "7.0.0-beta.36" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.36.tgz#1dc6f8750e89b6b979de5fe44aa993b1a2192261" + dependencies: + "@babel/code-frame" "7.0.0-beta.36" + "@babel/helper-function-name" "7.0.0-beta.36" + "@babel/types" "7.0.0-beta.36" + babylon "7.0.0-beta.36" + debug "^3.0.1" + globals "^11.1.0" + invariant "^2.2.0" + lodash "^4.2.0" + "@babel/traverse@7.0.0-beta.40": version "7.0.0-beta.40" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.40.tgz#d140e449b2e093ef9fe1a2eecc28421ffb4e521e" @@ -63,6 +107,14 @@ invariant "^2.2.0" lodash "^4.2.0" +"@babel/types@7.0.0-beta.36": + version "7.0.0-beta.36" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.36.tgz#64f2004353de42adb72f9ebb4665fc35b5499d23" + dependencies: + esutils "^2.0.2" + lodash "^4.2.0" + to-fast-properties "^2.0.0" + "@babel/types@7.0.0-beta.40": version "7.0.0-beta.40" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.40.tgz#25c3d7aae14126abe05fcb098c65a66b6d6b8c14" @@ -81,24 +133,17 @@ acorn@^3.0.4: version "3.3.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" -acorn@^5.2.1: - version "5.2.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.2.1.tgz#317ac7821826c22c702d66189ab8359675f135d7" - -ajv-keywords@^1.0.0: - version "1.5.1" - resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.1.tgz#314dd0a4b3368fad3dfcdc54ede6171b886daf3c" +acorn@^5.4.0: + version "5.4.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.4.1.tgz#fdc58d9d17f4a4e98d102ded826a9b9759125102" -ajv@^4.7.0: - version "4.11.8" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.8.tgz#82ffb02b29e662ae53bdc20af15947706739c536" - dependencies: - co "^4.6.0" - json-stable-stringify "^1.0.1" +ajv-keywords@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.1.tgz#617997fc5f60576894c435f940d819e135b80762" -ajv@^5.3.0: - version "5.4.0" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.4.0.tgz#32d1cf08dbc80c432f426f12e10b2511f6b46474" +ajv@^5.2.3, ajv@^5.3.0: + version "5.5.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" dependencies: co "^4.6.0" fast-deep-equal "^1.0.0" @@ -109,9 +154,9 @@ ansi-escapes@^1.0.0: version "1.4.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" -ansi-escapes@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-2.0.0.tgz#5bae52be424878dd9783e8910e3fc2922e83c81b" +ansi-escapes@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.0.0.tgz#ec3e8b4e9f8064fc02c3ac9b65f1c275bda8ef92" ansi-regex@^2.0.0: version "2.1.1" @@ -125,19 +170,23 @@ ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" -ansi-styles@^3.1.0: +ansi-styles@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88" dependencies: color-convert "^1.9.0" +any-observable@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/any-observable/-/any-observable-0.2.0.tgz#c67870058003579009083f54ac0abafb5c33d242" + app-root-path@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/app-root-path/-/app-root-path-2.0.1.tgz#cd62dcf8e4fd5a417efc664d2e5b10653c651b46" argparse@^1.0.7: - version "1.0.9" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86" + version "1.0.10" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" dependencies: sprintf-js "~1.0.2" @@ -155,84 +204,28 @@ arrify@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" -babel-code-frame@7.0.0-beta.0: - version "7.0.0-beta.0" - resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-7.0.0-beta.0.tgz#418a7b5f3f7dc9a4670e61b1158b4c5661bec98d" - dependencies: - chalk "^2.0.0" - esutils "^2.0.2" - js-tokens "^3.0.0" - babel-code-frame@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4" + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" dependencies: - chalk "^1.1.0" + chalk "^1.1.3" esutils "^2.0.2" - js-tokens "^3.0.0" + js-tokens "^3.0.2" babel-eslint@^8.0.0: - version "8.0.1" - resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-8.0.1.tgz#5d718be7a328625d006022eb293ed3008cbd6346" - dependencies: - babel-code-frame "7.0.0-beta.0" - babel-traverse "7.0.0-beta.0" - babel-types "7.0.0-beta.0" - babylon "7.0.0-beta.22" - -babel-helper-function-name@7.0.0-beta.0: - version "7.0.0-beta.0" - resolved "https://registry.yarnpkg.com/babel-helper-function-name/-/babel-helper-function-name-7.0.0-beta.0.tgz#d1b6779b647e5c5c31ebeb05e13b998e4d352d56" - dependencies: - babel-helper-get-function-arity "7.0.0-beta.0" - babel-template "7.0.0-beta.0" - babel-traverse "7.0.0-beta.0" - babel-types "7.0.0-beta.0" - -babel-helper-get-function-arity@7.0.0-beta.0: - version "7.0.0-beta.0" - resolved "https://registry.yarnpkg.com/babel-helper-get-function-arity/-/babel-helper-get-function-arity-7.0.0-beta.0.tgz#9d1ab7213bb5efe1ef1638a8ea1489969b5a8b6e" - dependencies: - babel-types "7.0.0-beta.0" - -babel-messages@7.0.0-beta.0: - version "7.0.0-beta.0" - resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-7.0.0-beta.0.tgz#6df01296e49fc8fbd0637394326a167f36da817b" - -babel-template@7.0.0-beta.0: - version "7.0.0-beta.0" - resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-7.0.0-beta.0.tgz#85083cf9e4395d5e48bf5154d7a8d6991cafecfb" - dependencies: - babel-traverse "7.0.0-beta.0" - babel-types "7.0.0-beta.0" - babylon "7.0.0-beta.22" - lodash "^4.2.0" - -babel-traverse@7.0.0-beta.0: - version "7.0.0-beta.0" - resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-7.0.0-beta.0.tgz#da14be9b762f62a2f060db464eaafdd8cd072a41" - dependencies: - babel-code-frame "7.0.0-beta.0" - babel-helper-function-name "7.0.0-beta.0" - babel-messages "7.0.0-beta.0" - babel-types "7.0.0-beta.0" - babylon "7.0.0-beta.22" - debug "^3.0.1" - globals "^10.0.0" - invariant "^2.2.0" - lodash "^4.2.0" - -babel-types@7.0.0-beta.0: - version "7.0.0-beta.0" - resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-7.0.0-beta.0.tgz#eb8b6e556470e6dcc4aef982d79ad229469b5169" - dependencies: - esutils "^2.0.2" - lodash "^4.2.0" - to-fast-properties "^2.0.0" + version "8.2.1" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-8.2.1.tgz#136888f3c109edc65376c23ebf494f36a3e03951" + dependencies: + "@babel/code-frame" "7.0.0-beta.36" + "@babel/traverse" "7.0.0-beta.36" + "@babel/types" "7.0.0-beta.36" + babylon "7.0.0-beta.36" + eslint-scope "~3.7.1" + eslint-visitor-keys "^1.0.0" -babylon@7.0.0-beta.22: - version "7.0.0-beta.22" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.22.tgz#74f0ad82ed7c7c3cfeab74cf684f815104161b65" +babylon@7.0.0-beta.36: + version "7.0.0-beta.36" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.36.tgz#3a3683ba6a9a1e02b0aa507c8e63435e39305b9e" babylon@7.0.0-beta.40: version "7.0.0-beta.40" @@ -243,8 +236,8 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" brace-expansion@^1.1.7: - version "1.1.8" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292" + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" dependencies: balanced-match "^1.0.0" concat-map "0.0.1" @@ -267,7 +260,7 @@ callsites@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" -chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: +chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" dependencies: @@ -277,29 +270,25 @@ chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" -chalk@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.0.1.tgz#dbec49436d2ae15f536114e76d14656cdbc0f44d" +chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0: + version "2.3.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.1.tgz#523fe2678aec7b04e8041909292fe8b17059b796" dependencies: - ansi-styles "^3.1.0" + ansi-styles "^3.2.0" escape-string-regexp "^1.0.5" - supports-color "^4.0.0" + supports-color "^5.2.0" -chalk@^2.1.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.0.tgz#b5ea48efc9c1793dccc9b4767c93914d3f2d52ba" - dependencies: - ansi-styles "^3.1.0" - escape-string-regexp "^1.0.5" - supports-color "^4.0.0" +chardet@^0.4.0: + version "0.4.2" + resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2" ci-info@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.0.0.tgz#dc5285f2b4e251821683681c381c3388f46ec534" + version "1.1.2" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.1.2.tgz#03561259db48d0474c8bdc90f5b47b068b6bbfb4" circular-json@^0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.1.tgz#be8b36aefccde8b3ca7aa2d6afc07a37242c0d2d" + version "0.3.3" + resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" cli-cursor@^1.0.2: version "1.0.2" @@ -325,8 +314,8 @@ cli-truncate@^0.2.1: string-width "^1.0.1" cli-width@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.1.0.tgz#b234ca209b29ef66fc518d9b98d5847b00edf00a" + version "2.2.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" co@^4.6.0: version "4.6.0" @@ -337,8 +326,8 @@ code-point-at@^1.0.0: resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" color-convert@^1.9.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.0.tgz#1accf97dd739b983bf994d56fec8f95853641b7a" + version "1.9.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.1.tgz#c1261107aeb2f294ebffec9ed9ecad529a6097ed" dependencies: color-name "^1.1.1" @@ -350,11 +339,9 @@ commander@2.11.0: version "2.11.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" -commander@^2.9.0: - version "2.9.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" - dependencies: - graceful-readlink ">= 1.0.0" +commander@^2.11.0, commander@^2.9.0: + version "2.14.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.14.1.tgz#2235123e37af8ca3c65df45b026dbd357b01b9aa" concat-map@0.0.1: version "0.0.1" @@ -376,18 +363,14 @@ core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" -cosmiconfig@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-1.1.0.tgz#0dea0f9804efdfb929fbb1b188e25553ea053d37" +cosmiconfig@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-4.0.0.tgz#760391549580bbd2df1e562bc177b13c290972dc" dependencies: - graceful-fs "^4.1.2" - js-yaml "^3.4.3" - minimist "^1.2.0" - object-assign "^4.0.1" - os-homedir "^1.0.1" - parse-json "^2.2.0" - pinkie-promise "^2.0.0" - require-from-string "^1.1.0" + is-directory "^0.3.1" + js-yaml "^3.9.0" + parse-json "^4.0.0" + require-from-string "^2.0.1" cross-spawn@^5.0.1, cross-spawn@^5.1.0: version "5.1.0" @@ -398,27 +381,21 @@ cross-spawn@^5.0.1, cross-spawn@^5.1.0: which "^1.2.9" date-fns@^1.27.2: - version "1.28.5" - resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.28.5.tgz#257cfc45d322df45ef5658665967ee841cd73faf" + version "1.29.0" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.29.0.tgz#12e609cdcb935127311d04d33334e2960a2a54e6" -debug@3.1.0, debug@^3.1.0: +debug@3.1.0, debug@^3.0.1, debug@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" dependencies: ms "2.0.0" -debug@^2.6.8: +debug@^2.6.8, debug@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" dependencies: ms "2.0.0" -debug@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/debug/-/debug-3.0.1.tgz#0564c612b521dc92d9f2988f0549e34f9c98db64" - dependencies: - ms "2.0.0" - dedent@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" @@ -450,9 +427,9 @@ doctrine@1.5.0: esutils "^2.0.2" isarray "^1.0.0" -doctrine@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.0.2.tgz#68f96ce8efc56cc42651f1faadb4f175273b0075" +doctrine@^2.0.2, doctrine@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" dependencies: esutils "^2.0.2" @@ -460,7 +437,7 @@ elegant-spinner@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/elegant-spinner/-/elegant-spinner-1.0.1.tgz#db043521c95d7e303fd8f345bedc3349cfb0729e" -error-ex@^1.2.0: +error-ex@^1.2.0, error-ex@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.1.tgz#f855a86ce61adc4e8621c3cda21e7a7612c3a8dc" dependencies: @@ -471,15 +448,15 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1 resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" eslint-config-babel@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/eslint-config-babel/-/eslint-config-babel-7.0.1.tgz#aac7b79f2f06f52358a5a764fdc01fde23718572" + version "7.0.2" + resolved "https://registry.yarnpkg.com/eslint-config-babel/-/eslint-config-babel-7.0.2.tgz#cbde74f61cee087d8cd6e607fcfa087869a02d99" eslint-import-resolver-node@^0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.1.tgz#4422574cde66a9a7b099938ee4d508a199e0e3cc" + version "0.3.2" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz#58f15fb839b8d0576ca980413476aab2472db66a" dependencies: - debug "^2.6.8" - resolve "^1.2.0" + debug "^2.6.9" + resolve "^1.5.0" eslint-module-utils@^2.1.1: version "2.1.1" @@ -488,7 +465,7 @@ eslint-module-utils@^2.1.1: debug "^2.6.8" pkg-dir "^1.0.0" -"eslint-old@npm:eslint@4.13.1": +"eslint-old@npm:eslint@4.13.1", "eslint@npm:eslint@4.13.1": version "4.13.1" resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.13.1.tgz#0055e0014464c7eb7878caf549ef2941992b444f" dependencies: @@ -531,8 +508,8 @@ eslint-module-utils@^2.1.1: text-table "~0.2.0" eslint-plugin-flowtype@^2.30.3: - version "2.34.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.34.0.tgz#b9875f314652e5081623c9d2b18a346bbb759c09" + version "2.45.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.45.0.tgz#20d8b15d1e1e71ea4e9498e8be3fc62c0752fcbf" dependencies: lodash "^4.15.0" @@ -552,11 +529,11 @@ eslint-plugin-import@^2.8.0: read-pkg-up "^2.0.0" eslint-plugin-prettier@^2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.1.2.tgz#4b90f4ee7f92bfbe2e926017e1ca40eb628965ea" + version "2.6.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.6.0.tgz#33e4e228bdb06142d03c560ce04ec23f6c767dd7" dependencies: fast-diff "^1.1.1" - jest-docblock "^20.0.1" + jest-docblock "^21.0.0" eslint-scope@^3.7.1, eslint-scope@~3.7.1: version "3.7.1" @@ -570,8 +547,8 @@ eslint-visitor-keys@^1.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" eslint@^4.14.0: - version "4.14.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.14.0.tgz#96609768d1dd23304faba2d94b7fefe5a5447a82" + version "4.18.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.18.0.tgz#ebd0ba795af6dc59aa5cee17938160af5950e051" dependencies: ajv "^5.3.0" babel-code-frame "^6.22.0" @@ -579,7 +556,7 @@ eslint@^4.14.0: concat-stream "^1.6.0" cross-spawn "^5.1.0" debug "^3.1.0" - doctrine "^2.0.2" + doctrine "^2.1.0" eslint-scope "^3.7.1" eslint-visitor-keys "^1.0.0" espree "^3.5.2" @@ -612,16 +589,12 @@ eslint@^4.14.0: text-table "~0.2.0" espree@^3.5.2: - version "3.5.2" - resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.2.tgz#756ada8b979e9dcfcdb30aad8d1a9304a905e1ca" + version "3.5.3" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.3.tgz#931e0af64e7fbbed26b050a29daad1fc64799fa6" dependencies: - acorn "^5.2.1" + acorn "^5.4.0" acorn-jsx "^3.0.0" -esprima@^3.1.1: - version "3.1.3" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" - esprima@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" @@ -647,9 +620,9 @@ esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" -execa@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" +execa@^0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.8.0.tgz#d8d76bbc1b55217ed190fd6dd49d3c774ecfc8da" dependencies: cross-spawn "^5.0.1" get-stream "^3.0.0" @@ -664,20 +637,20 @@ exit-hook@^1.0.0: resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8" external-editor@^2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.0.4.tgz#1ed9199da9cbfe2ef2f7a31b2fde8b0d12368972" + version "2.1.0" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.1.0.tgz#3d026a21b7f95b5726387d4200ac160d372c3b48" dependencies: + chardet "^0.4.0" iconv-lite "^0.4.17" - jschardet "^1.4.2" - tmp "^0.0.31" + tmp "^0.0.33" fast-deep-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz#96256a3bc975595eb36d82e9929d060d893439ff" fast-diff@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.1.1.tgz#0aea0e4e605b6a2189f0e936d4b7fbaf1b7cfd9b" + version "1.1.2" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.1.2.tgz#4b62c42b8e03de3f848460b639079920695d0154" fast-json-stable-stringify@^2.0.0: version "2.0.0" @@ -707,6 +680,10 @@ file-entry-cache@^2.0.0: flat-cache "^1.2.1" object-assign "^4.0.1" +find-parent-dir@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/find-parent-dir/-/find-parent-dir-0.3.0.tgz#33c44b429ab2b2f0646299c5f9f718f376ff8d54" + find-up@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" @@ -721,8 +698,8 @@ find-up@^2.0.0: locate-path "^2.0.0" flat-cache@^1.2.1: - version "1.2.2" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.2.2.tgz#fa86714e72c21db88601761ecf2f555d1abc6b96" + version "1.3.0" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.0.tgz#d3030b32b38154f4e3b7e9c709f490f7ef97c481" dependencies: circular-json "^0.3.1" del "^2.0.2" @@ -741,6 +718,10 @@ functional-red-black-tree@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" +get-own-enumerable-property-symbols@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-2.0.1.tgz#5c4ad87f2834c4b9b4e84549dc1e0650fb38c24b" + get-stream@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" @@ -756,17 +737,9 @@ glob@7.1.2, glob@^7.0.3, glob@^7.0.5, glob@^7.1.2: once "^1.3.0" path-is-absolute "^1.0.0" -globals@^10.0.0: - version "10.0.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-10.0.0.tgz#a5803a1abe923b52bc33a59cffeaf6e0748cf3f7" - -globals@^11.0.1: - version "11.0.1" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.0.1.tgz#12a87bb010e5154396acc535e1e43fc753b0e5e8" - -globals@^11.1.0: - version "11.1.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.1.0.tgz#632644457f5f0e3ae711807183700ebf2e4633e4" +globals@^11.0.1, globals@^11.1.0: + version "11.3.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.3.0.tgz#e04fdb7b9796d8adac9c8f64c14837b2313378b0" globby@^5.0.0: version "5.0.0" @@ -783,10 +756,6 @@ graceful-fs@^4.1.2: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" -"graceful-readlink@>= 1.0.0": - version "1.0.1" - resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" - growl@1.10.3: version "1.10.3" resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.3.tgz#1926ba90cf3edfe2adb4927f5880bc22c66c790f" @@ -801,6 +770,10 @@ has-flag@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + has@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28" @@ -816,20 +789,20 @@ hosted-git-info@^2.1.4: resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.5.0.tgz#6d60e34b3abbc8313062c3b798ef8d901a07af3c" husky@^0.14.0: - version "0.14.1" - resolved "https://registry.yarnpkg.com/husky/-/husky-0.14.1.tgz#8edba33e728ceed75343e88bb8002e4cbd8d1b40" + version "0.14.3" + resolved "https://registry.yarnpkg.com/husky/-/husky-0.14.3.tgz#c69ed74e2d2779769a17ba8399b54ce0b63c12c3" dependencies: is-ci "^1.0.10" normalize-path "^1.0.0" strip-indent "^2.0.0" iconv-lite@^0.4.17: - version "0.4.18" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.18.tgz#23d8656b16aae6742ac29732ea8f0336a4789cf2" + version "0.4.19" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" ignore@^3.3.3: - version "3.3.3" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.3.tgz#432352e57accd87ab3110e82d3fea0e47812156d" + version "3.3.7" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.7.tgz#612289bfb3c220e186a58118618d5be8c1bab021" imurmurhash@^0.1.4: version "0.1.4" @@ -842,8 +815,8 @@ indent-string@^2.1.0: repeating "^2.0.0" indent-string@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-3.1.0.tgz#08ff4334603388399b329e6b9538dc7a3cf5de7d" + version "3.2.0" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-3.2.0.tgz#4a5fd6d27cc332f37e5419a504dbb837105c9289" inflight@^1.0.4: version "1.0.6" @@ -857,11 +830,11 @@ inherits@2, inherits@^2.0.3, inherits@~2.0.3: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" inquirer@^3.0.6: - version "3.1.1" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.1.1.tgz#87621c4fba4072f48a8dd71c9f9df6f100b2d534" + version "3.3.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.3.0.tgz#9dd2f2ad765dcab1ff0443b491442a20ba227dc9" dependencies: - ansi-escapes "^2.0.0" - chalk "^1.0.0" + ansi-escapes "^3.0.0" + chalk "^2.0.0" cli-cursor "^2.1.0" cli-width "^2.0.0" external-editor "^2.0.4" @@ -871,13 +844,13 @@ inquirer@^3.0.6: run-async "^2.2.0" rx-lite "^4.0.8" rx-lite-aggregates "^4.0.8" - string-width "^2.0.0" - strip-ansi "^3.0.0" + string-width "^2.1.0" + strip-ansi "^4.0.0" through "^2.3.6" invariant@^2.2.0: - version "2.2.2" - resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" + version "2.2.3" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.3.tgz#1a827dfde7dcbd7c323f0ca826be8fa7c5e9d688" dependencies: loose-envify "^1.0.0" @@ -892,11 +865,19 @@ is-builtin-module@^1.0.0: builtin-modules "^1.0.0" is-ci@^1.0.10: - version "1.0.10" - resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.0.10.tgz#f739336b2632365061a9d48270cd56ae3369318e" + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.1.0.tgz#247e4162e7860cebbdaf30b774d6b0ac7dcfe7a5" dependencies: ci-info "^1.0.0" +is-directory@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/is-directory/-/is-directory-0.3.1.tgz#61339b6f2475fc772fd9c9d83f5c8575dc154ae1" + +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + is-finite@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" @@ -913,6 +894,22 @@ is-fullwidth-code-point@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" +is-glob@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.0.tgz#9521c76845cc2610a85203ddf080a958c2ffabc0" + dependencies: + is-extglob "^2.1.1" + +is-obj@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" + +is-observable@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/is-observable/-/is-observable-0.2.0.tgz#b361311d83c6e5d726cabf5e250b0237106f5ae2" + dependencies: + symbol-observable "^0.2.2" + is-path-cwd@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" @@ -924,8 +921,8 @@ is-path-in-cwd@^1.0.0: is-path-inside "^1.0.0" is-path-inside@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.0.tgz#fc06e5a1683fbda13de667aff717bbc10a48f37f" + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.1.tgz#8ef5b7de50437a3fdca6b4e865ef7aa55cb48036" dependencies: path-is-inside "^1.0.1" @@ -933,11 +930,13 @@ is-promise@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" -is-resolvable@^1.0.0: +is-regexp@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.0.0.tgz#8df57c61ea2e3c501408d100fb013cf8d6e0cc62" - dependencies: - tryit "^1.0.1" + resolved "https://registry.yarnpkg.com/is-regexp/-/is-regexp-1.0.0.tgz#fd2d883545c46bac5a633e7b9a09e87fa2cb5069" + +is-resolvable@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88" is-stream@^1.1.0: version "1.1.0" @@ -951,36 +950,42 @@ isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" -jest-docblock@^20.0.1: - version "20.0.3" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-20.0.3.tgz#17bea984342cc33d83c50fbe1545ea0efaa44712" +jest-docblock@^21.0.0: + version "21.2.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-21.2.0.tgz#51529c3b30d5fd159da60c27ceedc195faf8d414" -js-tokens@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7" +jest-get-type@^21.2.0: + version "21.2.0" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-21.2.0.tgz#f6376ab9db4b60d81e39f30749c6c466f40d4a23" -js-yaml@^3.4.3: - version "3.8.4" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.8.4.tgz#520b4564f86573ba96662af85a8cafa7b4b5a6f6" +jest-validate@^21.1.0: + version "21.2.1" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-21.2.1.tgz#cc0cbca653cd54937ba4f2a111796774530dd3c7" dependencies: - argparse "^1.0.7" - esprima "^3.1.1" + chalk "^2.0.1" + jest-get-type "^21.2.0" + leven "^2.1.0" + pretty-format "^21.2.1" -js-yaml@^3.9.1: +js-tokens@^3.0.0, js-tokens@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" + +js-yaml@^3.9.0, js-yaml@^3.9.1: version "3.10.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc" dependencies: argparse "^1.0.7" esprima "^4.0.0" -jschardet@^1.4.2: - version "1.4.2" - resolved "https://registry.yarnpkg.com/jschardet/-/jschardet-1.4.2.tgz#2aa107f142af4121d145659d44f50830961e699a" - jsesc@^2.5.1: version "2.5.1" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.1.tgz#e421a2a8e20d6b0819df28908f782526b96dd1fe" +json-parse-better-errors@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.1.tgz#50183cd1b2d25275de069e9e71b467ac9eab973a" + json-schema-traverse@^0.3.0: version "0.3.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" @@ -989,15 +994,9 @@ json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" -json-stable-stringify@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" - dependencies: - jsonify "~0.0.0" - -jsonify@~0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" +leven@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" levn@^0.3.0, levn@~0.3.0: version "0.3.0" @@ -1006,27 +1005,38 @@ levn@^0.3.0, levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" -lint-staged@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-4.0.0.tgz#c15669f598614a6e68090303e175a799d48e0d85" +lint-staged@^6.1.1: + version "6.1.1" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-6.1.1.tgz#cd08c4d9b8ccc2d37198d1c47ce77d22be6cf324" dependencies: app-root-path "^2.0.0" - cosmiconfig "^1.1.0" - execa "^0.7.0" - listr "^0.12.0" - lodash.chunk "^4.2.0" + chalk "^2.1.0" + commander "^2.11.0" + cosmiconfig "^4.0.0" + debug "^3.1.0" + dedent "^0.7.0" + execa "^0.8.0" + find-parent-dir "^0.3.0" + is-glob "^4.0.0" + jest-validate "^21.1.0" + listr "^0.13.0" + lodash "^4.17.4" + log-symbols "^2.0.0" minimatch "^3.0.0" npm-which "^3.0.1" p-map "^1.1.1" - staged-git-files "0.0.4" + path-is-inside "^1.0.2" + pify "^3.0.0" + staged-git-files "1.0.0" + stringify-object "^3.2.0" listr-silent-renderer@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/listr-silent-renderer/-/listr-silent-renderer-1.1.1.tgz#924b5a3757153770bf1a8e3fbf74b8bbf3f9242e" -listr-update-renderer@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/listr-update-renderer/-/listr-update-renderer-0.2.0.tgz#ca80e1779b4e70266807e8eed1ad6abe398550f9" +listr-update-renderer@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/listr-update-renderer/-/listr-update-renderer-0.4.0.tgz#344d980da2ca2e8b145ba305908f32ae3f4cc8a7" dependencies: chalk "^1.1.3" cli-truncate "^0.2.1" @@ -1038,33 +1048,34 @@ listr-update-renderer@^0.2.0: strip-ansi "^3.0.1" listr-verbose-renderer@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/listr-verbose-renderer/-/listr-verbose-renderer-0.4.0.tgz#44dc01bb0c34a03c572154d4d08cde9b1dc5620f" + version "0.4.1" + resolved "https://registry.yarnpkg.com/listr-verbose-renderer/-/listr-verbose-renderer-0.4.1.tgz#8206f4cf6d52ddc5827e5fd14989e0e965933a35" dependencies: chalk "^1.1.3" cli-cursor "^1.0.2" date-fns "^1.27.2" figures "^1.7.0" -listr@^0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/listr/-/listr-0.12.0.tgz#6bce2c0f5603fa49580ea17cd6a00cc0e5fa451a" +listr@^0.13.0: + version "0.13.0" + resolved "https://registry.yarnpkg.com/listr/-/listr-0.13.0.tgz#20bb0ba30bae660ee84cc0503df4be3d5623887d" dependencies: chalk "^1.1.3" cli-truncate "^0.2.1" figures "^1.7.0" indent-string "^2.1.0" + is-observable "^0.2.0" is-promise "^2.1.0" is-stream "^1.1.0" listr-silent-renderer "^1.1.1" - listr-update-renderer "^0.2.0" + listr-update-renderer "^0.4.0" listr-verbose-renderer "^0.4.0" log-symbols "^1.0.2" log-update "^1.0.2" ora "^0.2.3" p-map "^1.1.1" - rxjs "^5.0.0-beta.11" - stream-to-observable "^0.1.0" + rxjs "^5.4.2" + stream-to-observable "^0.2.0" strip-ansi "^3.0.1" load-json-file@^2.0.0: @@ -1083,17 +1094,13 @@ locate-path@^2.0.0: p-locate "^2.0.0" path-exists "^3.0.0" -lodash.chunk@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/lodash.chunk/-/lodash.chunk-4.2.0.tgz#66e5ce1f76ed27b4303d8c6512e8d1216e8106bc" - lodash.cond@^4.3.0: version "4.5.2" resolved "https://registry.yarnpkg.com/lodash.cond/-/lodash.cond-4.5.2.tgz#f471a1da486be60f6ab955d17115523dd1d255d5" -lodash@^4.0.0, lodash@^4.15.0, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0: - version "4.17.4" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" +lodash@^4.15.0, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0: + version "4.17.5" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" log-symbols@^1.0.2: version "1.0.2" @@ -1101,6 +1108,12 @@ log-symbols@^1.0.2: dependencies: chalk "^1.0.0" +log-symbols@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a" + dependencies: + chalk "^2.0.1" + log-update@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/log-update/-/log-update-1.0.2.tgz#19929f64c4093d2d2e7075a1dad8af59c296b8d1" @@ -1122,8 +1135,8 @@ lru-cache@^4.0.1: yallist "^2.1.2" mimic-fn@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18" + version "1.2.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: version "3.0.4" @@ -1135,10 +1148,6 @@ minimist@0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" -minimist@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" - mkdirp@0.5.1, mkdirp@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" @@ -1186,8 +1195,8 @@ normalize-path@^1.0.0: resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-1.0.0.tgz#32d0e472f91ff345701c15a8311018d3b0a90379" npm-path@^2.0.2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/npm-path/-/npm-path-2.0.3.tgz#15cff4e1c89a38da77f56f6055b24f975dfb2bbe" + version "2.0.4" + resolved "https://registry.yarnpkg.com/npm-path/-/npm-path-2.0.4.tgz#c641347a5ff9d6a09e4d9bce5580c4f505278e64" dependencies: which "^1.2.10" @@ -1249,11 +1258,7 @@ ora@^0.2.3: cli-spinners "^0.1.2" object-assign "^4.0.1" -os-homedir@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" - -os-tmpdir@~1.0.1: +os-tmpdir@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" @@ -1262,8 +1267,10 @@ p-finally@^1.0.0: resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" p-limit@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.1.0.tgz#b07ff2d9a5d88bec806035895a2bab66a27988bc" + version "1.2.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.2.0.tgz#0e92b6bedcb59f022c13d0f1949dc82d15909f1c" + dependencies: + p-try "^1.0.0" p-locate@^2.0.0: version "2.0.0" @@ -1272,8 +1279,12 @@ p-locate@^2.0.0: p-limit "^1.1.0" p-map@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/p-map/-/p-map-1.1.1.tgz#05f5e4ae97a068371bc2a5cc86bfbdbc19c4ae7a" + version "1.2.0" + resolved "https://registry.yarnpkg.com/p-map/-/p-map-1.2.0.tgz#e4e94f311eabbc8633a1e79908165fca26241b6b" + +p-try@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" parse-json@^2.2.0: version "2.2.0" @@ -1281,6 +1292,13 @@ parse-json@^2.2.0: dependencies: error-ex "^1.2.0" +parse-json@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" + dependencies: + error-ex "^1.3.1" + json-parse-better-errors "^1.0.1" + path-exists@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" @@ -1317,6 +1335,10 @@ pify@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" +pify@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" + pinkie-promise@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" @@ -1342,12 +1364,19 @@ prelude-ls@~1.1.2: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" prettier@^1.4.4: - version "1.4.4" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.4.4.tgz#a8d1447b14c9bf67e6d420dcadd10fb9a4fad65a" + version "1.10.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.10.2.tgz#1af8356d1842276a99a5b5529c82dd9e9ad3cc93" -process-nextick-args@~1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" +pretty-format@^21.2.1: + version "21.2.1" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-21.2.1.tgz#ae5407f3cf21066cd011aa1ba5fce7b6a2eddb36" + dependencies: + ansi-regex "^3.0.0" + ansi-styles "^3.2.0" + +process-nextick-args@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" progress@^2.0.0: version "2.0.0" @@ -1373,15 +1402,15 @@ read-pkg@^2.0.0: path-type "^2.0.0" readable-stream@^2.2.2: - version "2.3.2" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.2.tgz#5a04df05e4f57fe3f0dc68fdd11dc5c97c7e6f4d" + version "2.3.4" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.4.tgz#c946c3f47fa7d8eabc0b6150f4a12f69a4574071" dependencies: core-util-is "~1.0.0" inherits "~2.0.3" isarray "~1.0.0" - process-nextick-args "~1.0.6" - safe-buffer "~5.1.0" - string_decoder "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.0.3" util-deprecate "~1.0.1" repeating@^2.0.0: @@ -1390,9 +1419,9 @@ repeating@^2.0.0: dependencies: is-finite "^1.0.0" -require-from-string@^1.1.0: - version "1.2.1" - resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-1.2.1.tgz#529c9ccef27380adfec9a2f965b649bbee636418" +require-from-string@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.1.tgz#c545233e9d7da6616e9d59adfb39fc9f588676ff" require-uncached@^1.0.3: version "1.0.3" @@ -1405,7 +1434,7 @@ resolve-from@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" -resolve@^1.2.0: +resolve@^1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36" dependencies: @@ -1426,8 +1455,8 @@ restore-cursor@^2.0.0: signal-exit "^3.0.2" rimraf@^2.2.8: - version "2.6.1" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d" + version "2.6.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" dependencies: glob "^7.0.5" @@ -1447,19 +1476,19 @@ rx-lite@*, rx-lite@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444" -rxjs@^5.0.0-beta.11: - version "5.4.1" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.4.1.tgz#b62f757f279445d265a18a58fb0a70dc90e91626" +rxjs@^5.4.2: + version "5.5.6" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.5.6.tgz#e31fb96d6fd2ff1fd84bcea8ae9c02d007179c02" dependencies: - symbol-observable "^1.0.1" + symbol-observable "1.0.1" -safe-buffer@~5.1.0: +safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" "semver@2 || 3 || 4 || 5", semver@^5.3.0: - version "5.4.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" + version "5.5.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" shebang-command@^1.2.0: version "1.2.0" @@ -1479,6 +1508,12 @@ slice-ansi@0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" +slice-ansi@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d" + dependencies: + is-fullwidth-code-point "^2.0.0" + source-map@^0.5.0: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" @@ -1501,13 +1536,15 @@ sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" -staged-git-files@0.0.4: - version "0.0.4" - resolved "https://registry.yarnpkg.com/staged-git-files/-/staged-git-files-0.0.4.tgz#d797e1b551ca7a639dec0237dc6eb4bb9be17d35" +staged-git-files@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/staged-git-files/-/staged-git-files-1.0.0.tgz#cdb847837c1fcc52c08a872d4883cc0877668a80" -stream-to-observable@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/stream-to-observable/-/stream-to-observable-0.1.0.tgz#45bf1d9f2d7dc09bed81f1c307c430e68b84cffe" +stream-to-observable@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/stream-to-observable/-/stream-to-observable-0.2.0.tgz#59d6ea393d87c2c0ddac10aa0d561bc6ba6f0e10" + dependencies: + any-observable "^0.2.0" string-width@^1.0.1: version "1.0.2" @@ -1517,19 +1554,27 @@ string-width@^1.0.1: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -string-width@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.0.0.tgz#635c5436cc72a6e0c387ceca278d4e2eec52687e" +string-width@^2.1.0, string-width@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" dependencies: is-fullwidth-code-point "^2.0.0" - strip-ansi "^3.0.0" + strip-ansi "^4.0.0" -string_decoder@~1.0.0: +string_decoder@~1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.3.tgz#0fc67d7c141825de94282dd536bec6b9bce860ab" dependencies: safe-buffer "~5.1.0" +stringify-object@^3.2.0: + version "3.2.2" + resolved "https://registry.yarnpkg.com/stringify-object/-/stringify-object-3.2.2.tgz#9853052e5a88fb605a44cd27445aa257ad7ffbcd" + dependencies: + get-own-enumerable-property-symbols "^2.0.1" + is-obj "^1.0.1" + is-regexp "^1.0.0" + strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" @@ -1568,26 +1613,30 @@ supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" -supports-color@^4.0.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.2.1.tgz#65a4bb2631e90e02420dba5554c375a4754bb836" +supports-color@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.2.0.tgz#b0d5333b1184dd3666cbe5aa0b45c5ac7ac17a4a" dependencies: - has-flag "^2.0.0" + has-flag "^3.0.0" -symbol-observable@^1.0.1: - version "1.0.4" - resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.4.tgz#29bf615d4aa7121bdd898b22d4b3f9bc4e2aa03d" +symbol-observable@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.1.tgz#8340fc4702c3122df5d22288f88283f513d3fdd4" + +symbol-observable@^0.2.2: + version "0.2.4" + resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-0.2.4.tgz#95a83db26186d6af7e7a18dbd9760a2f86d08f40" table@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/table/-/table-4.0.1.tgz#a8116c133fac2c61f4a420ab6cdf5c4d61f0e435" + version "4.0.2" + resolved "https://registry.yarnpkg.com/table/-/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36" dependencies: - ajv "^4.7.0" - ajv-keywords "^1.0.0" - chalk "^1.1.1" - lodash "^4.0.0" - slice-ansi "0.0.4" - string-width "^2.0.0" + ajv "^5.2.3" + ajv-keywords "^2.1.0" + chalk "^2.1.0" + lodash "^4.17.4" + slice-ansi "1.0.0" + string-width "^2.1.1" text-table@~0.2.0: version "0.2.0" @@ -1597,11 +1646,11 @@ through@^2.3.6: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" -tmp@^0.0.31: - version "0.0.31" - resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.31.tgz#8f38ab9438e17315e5dbd8b3657e8bfb277ae4a7" +tmp@^0.0.33: + version "0.0.33" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" dependencies: - os-tmpdir "~1.0.1" + os-tmpdir "~1.0.2" to-fast-properties@^2.0.0: version "2.0.0" @@ -1611,10 +1660,6 @@ trim-right@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" -tryit@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/tryit/-/tryit-1.0.3.tgz#393be730a9446fd1ead6da59a014308f36c289cb" - type-check@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" @@ -1637,8 +1682,8 @@ validate-npm-package-license@^3.0.1: spdx-expression-parse "~1.0.0" which@^1.2.10, which@^1.2.9: - version "1.2.14" - resolved "https://registry.yarnpkg.com/which/-/which-1.2.14.tgz#9a87c4378f03e827cecaf1acdf56c736c01c14e5" + version "1.3.0" + resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a" dependencies: isexe "^2.0.0" From 1bd58fa018b080117f0bcc7acf43ecb6f8d37a2d Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Tue, 20 Feb 2018 11:56:40 +0100 Subject: [PATCH 413/569] Allow newer versions of babel --- eslint/babel-eslint-parser/package.json | 8 ++-- eslint/babel-eslint-parser/yarn.lock | 52 +++---------------------- 2 files changed, 9 insertions(+), 51 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 102de3554c86..143915540dbb 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -11,10 +11,10 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "@babel/code-frame": "7.0.0-beta.40", - "@babel/traverse": "7.0.0-beta.40", - "@babel/types": "7.0.0-beta.40", - "babylon": "7.0.0-beta.40", + "@babel/code-frame": "^7.0.0-beta.40", + "@babel/traverse": "^7.0.0-beta.40", + "@babel/types": "^7.0.0-beta.40", + "babylon": "^7.0.0-beta.40", "eslint-scope": "~3.7.1", "eslint-visitor-keys": "^1.0.0" }, diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index 5fb449e52708..5e44c4e1fd33 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -10,7 +10,7 @@ esutils "^2.0.2" js-tokens "^3.0.0" -"@babel/code-frame@7.0.0-beta.40": +"@babel/code-frame@7.0.0-beta.40", "@babel/code-frame@^7.0.0-beta.40": version "7.0.0-beta.40" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.40.tgz#37e2b0cf7c56026b4b21d3927cadf81adec32ac6" dependencies: @@ -93,7 +93,7 @@ invariant "^2.2.0" lodash "^4.2.0" -"@babel/traverse@7.0.0-beta.40": +"@babel/traverse@^7.0.0-beta.40": version "7.0.0-beta.40" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.40.tgz#d140e449b2e093ef9fe1a2eecc28421ffb4e521e" dependencies: @@ -115,7 +115,7 @@ lodash "^4.2.0" to-fast-properties "^2.0.0" -"@babel/types@7.0.0-beta.40": +"@babel/types@7.0.0-beta.40", "@babel/types@^7.0.0-beta.40": version "7.0.0-beta.40" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.40.tgz#25c3d7aae14126abe05fcb098c65a66b6d6b8c14" dependencies: @@ -227,7 +227,7 @@ babylon@7.0.0-beta.36: version "7.0.0-beta.36" resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.36.tgz#3a3683ba6a9a1e02b0aa507c8e63435e39305b9e" -babylon@7.0.0-beta.40: +babylon@7.0.0-beta.40, babylon@^7.0.0-beta.40: version "7.0.0-beta.40" resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.40.tgz#91fc8cd56d5eb98b28e6fde41045f2957779940a" @@ -427,7 +427,7 @@ doctrine@1.5.0: esutils "^2.0.2" isarray "^1.0.0" -doctrine@^2.0.2, doctrine@^2.1.0: +doctrine@^2.0.2: version "2.1.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" dependencies: @@ -546,48 +546,6 @@ eslint-visitor-keys@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" -eslint@^4.14.0: - version "4.18.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.18.0.tgz#ebd0ba795af6dc59aa5cee17938160af5950e051" - dependencies: - ajv "^5.3.0" - babel-code-frame "^6.22.0" - chalk "^2.1.0" - concat-stream "^1.6.0" - cross-spawn "^5.1.0" - debug "^3.1.0" - doctrine "^2.1.0" - eslint-scope "^3.7.1" - eslint-visitor-keys "^1.0.0" - espree "^3.5.2" - esquery "^1.0.0" - esutils "^2.0.2" - file-entry-cache "^2.0.0" - functional-red-black-tree "^1.0.1" - glob "^7.1.2" - globals "^11.0.1" - ignore "^3.3.3" - imurmurhash "^0.1.4" - inquirer "^3.0.6" - is-resolvable "^1.0.0" - js-yaml "^3.9.1" - json-stable-stringify-without-jsonify "^1.0.1" - levn "^0.3.0" - lodash "^4.17.4" - minimatch "^3.0.2" - mkdirp "^0.5.1" - natural-compare "^1.4.0" - optionator "^0.8.2" - path-is-inside "^1.0.2" - pluralize "^7.0.0" - progress "^2.0.0" - require-uncached "^1.0.3" - semver "^5.3.0" - strip-ansi "^4.0.0" - strip-json-comments "~2.0.1" - table "^4.0.1" - text-table "~0.2.0" - espree@^3.5.2: version "3.5.3" resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.3.tgz#931e0af64e7fbbed26b050a29daad1fc64799fa6" From f75f7a0601a02615bc9bfc1b2459e6feebcb8c16 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Tue, 20 Feb 2018 11:57:07 +0100 Subject: [PATCH 414/569] 8.2.2 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 143915540dbb..d857ca0a9b99 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "8.2.1", + "version": "8.2.2", "description": "Custom parser for ESLint", "main": "lib/index.js", "files": [ From b2c065976b68697661299e03f3fbdcfec16dfc0f Mon Sep 17 00:00:00 2001 From: Bary Levi Date: Fri, 13 Apr 2018 18:23:03 +0300 Subject: [PATCH 415/569] Save babel beta packages as exact versions (babel/babel-eslint#606) [skip ci] --- eslint/babel-eslint-parser/package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index d857ca0a9b99..8b25a9968de5 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -11,10 +11,10 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "@babel/code-frame": "^7.0.0-beta.40", - "@babel/traverse": "^7.0.0-beta.40", - "@babel/types": "^7.0.0-beta.40", - "babylon": "^7.0.0-beta.40", + "@babel/code-frame": "7.0.0-beta.40", + "@babel/traverse": "7.0.0-beta.40", + "@babel/types": "7.0.0-beta.40", + "babylon": "7.0.0-beta.40", "eslint-scope": "~3.7.1", "eslint-visitor-keys": "^1.0.0" }, From 2f7aea98eb1165b2ac7980e8b19f172f4d79023b Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 13 Apr 2018 11:23:59 -0400 Subject: [PATCH 416/569] lock to beta.44 --- eslint/babel-eslint-parser/package.json | 8 +-- eslint/babel-eslint-parser/yarn.lock | 91 +++++++++++++------------ 2 files changed, 53 insertions(+), 46 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 8b25a9968de5..7f62231b3063 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -11,10 +11,10 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "@babel/code-frame": "7.0.0-beta.40", - "@babel/traverse": "7.0.0-beta.40", - "@babel/types": "7.0.0-beta.40", - "babylon": "7.0.0-beta.40", + "@babel/code-frame": "7.0.0-beta.44", + "@babel/traverse": "7.0.0-beta.44", + "@babel/types": "7.0.0-beta.44", + "babylon": "7.0.0-beta.44", "eslint-scope": "~3.7.1", "eslint-visitor-keys": "^1.0.0" }, diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index 5e44c4e1fd33..53c3bceda635 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -10,17 +10,17 @@ esutils "^2.0.2" js-tokens "^3.0.0" -"@babel/code-frame@7.0.0-beta.40", "@babel/code-frame@^7.0.0-beta.40": - version "7.0.0-beta.40" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.40.tgz#37e2b0cf7c56026b4b21d3927cadf81adec32ac6" +"@babel/code-frame@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.44.tgz#2a02643368de80916162be70865c97774f3adbd9" dependencies: - "@babel/highlight" "7.0.0-beta.40" + "@babel/highlight" "7.0.0-beta.44" -"@babel/generator@7.0.0-beta.40": - version "7.0.0-beta.40" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0-beta.40.tgz#ab61f9556f4f71dbd1138949c795bb9a21e302ea" +"@babel/generator@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0-beta.44.tgz#c7e67b9b5284afcf69b309b50d7d37f3e5033d42" dependencies: - "@babel/types" "7.0.0-beta.40" + "@babel/types" "7.0.0-beta.44" jsesc "^2.5.1" lodash "^4.2.0" source-map "^0.5.0" @@ -34,13 +34,13 @@ "@babel/template" "7.0.0-beta.36" "@babel/types" "7.0.0-beta.36" -"@babel/helper-function-name@7.0.0-beta.40": - version "7.0.0-beta.40" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.40.tgz#9d033341ab16517f40d43a73f2d81fc431ccd7b6" +"@babel/helper-function-name@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.44.tgz#e18552aaae2231100a6e485e03854bc3532d44dd" dependencies: - "@babel/helper-get-function-arity" "7.0.0-beta.40" - "@babel/template" "7.0.0-beta.40" - "@babel/types" "7.0.0-beta.40" + "@babel/helper-get-function-arity" "7.0.0-beta.44" + "@babel/template" "7.0.0-beta.44" + "@babel/types" "7.0.0-beta.44" "@babel/helper-get-function-arity@7.0.0-beta.36": version "7.0.0-beta.36" @@ -48,15 +48,21 @@ dependencies: "@babel/types" "7.0.0-beta.36" -"@babel/helper-get-function-arity@7.0.0-beta.40": - version "7.0.0-beta.40" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.40.tgz#ac0419cf067b0ec16453e1274f03878195791c6e" +"@babel/helper-get-function-arity@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.44.tgz#d03ca6dd2b9f7b0b1e6b32c56c72836140db3a15" dependencies: - "@babel/types" "7.0.0-beta.40" + "@babel/types" "7.0.0-beta.44" -"@babel/highlight@7.0.0-beta.40": - version "7.0.0-beta.40" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-beta.40.tgz#b43d67d76bf46e1d10d227f68cddcd263786b255" +"@babel/helper-split-export-declaration@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.44.tgz#c0b351735e0fbcb3822c8ad8db4e583b05ebd9dc" + dependencies: + "@babel/types" "7.0.0-beta.44" + +"@babel/highlight@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-beta.44.tgz#18c94ce543916a80553edcdcf681890b200747d5" dependencies: chalk "^2.0.0" esutils "^2.0.2" @@ -71,13 +77,13 @@ babylon "7.0.0-beta.36" lodash "^4.2.0" -"@babel/template@7.0.0-beta.40": - version "7.0.0-beta.40" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.40.tgz#034988c6424eb5c3268fe6a608626de1f4410fc8" +"@babel/template@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.44.tgz#f8832f4fdcee5d59bf515e595fc5106c529b394f" dependencies: - "@babel/code-frame" "7.0.0-beta.40" - "@babel/types" "7.0.0-beta.40" - babylon "7.0.0-beta.40" + "@babel/code-frame" "7.0.0-beta.44" + "@babel/types" "7.0.0-beta.44" + babylon "7.0.0-beta.44" lodash "^4.2.0" "@babel/traverse@7.0.0-beta.36": @@ -93,16 +99,17 @@ invariant "^2.2.0" lodash "^4.2.0" -"@babel/traverse@^7.0.0-beta.40": - version "7.0.0-beta.40" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.40.tgz#d140e449b2e093ef9fe1a2eecc28421ffb4e521e" +"@babel/traverse@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.44.tgz#a970a2c45477ad18017e2e465a0606feee0d2966" dependencies: - "@babel/code-frame" "7.0.0-beta.40" - "@babel/generator" "7.0.0-beta.40" - "@babel/helper-function-name" "7.0.0-beta.40" - "@babel/types" "7.0.0-beta.40" - babylon "7.0.0-beta.40" - debug "^3.0.1" + "@babel/code-frame" "7.0.0-beta.44" + "@babel/generator" "7.0.0-beta.44" + "@babel/helper-function-name" "7.0.0-beta.44" + "@babel/helper-split-export-declaration" "7.0.0-beta.44" + "@babel/types" "7.0.0-beta.44" + babylon "7.0.0-beta.44" + debug "^3.1.0" globals "^11.1.0" invariant "^2.2.0" lodash "^4.2.0" @@ -115,9 +122,9 @@ lodash "^4.2.0" to-fast-properties "^2.0.0" -"@babel/types@7.0.0-beta.40", "@babel/types@^7.0.0-beta.40": - version "7.0.0-beta.40" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.40.tgz#25c3d7aae14126abe05fcb098c65a66b6d6b8c14" +"@babel/types@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.44.tgz#6b1b164591f77dec0a0342aca995f2d046b3a757" dependencies: esutils "^2.0.2" lodash "^4.2.0" @@ -227,9 +234,9 @@ babylon@7.0.0-beta.36: version "7.0.0-beta.36" resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.36.tgz#3a3683ba6a9a1e02b0aa507c8e63435e39305b9e" -babylon@7.0.0-beta.40, babylon@^7.0.0-beta.40: - version "7.0.0-beta.40" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.40.tgz#91fc8cd56d5eb98b28e6fde41045f2957779940a" +babylon@7.0.0-beta.44: + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.44.tgz#89159e15e6e30c5096e22d738d8c0af8a0e8ca1d" balanced-match@^1.0.0: version "1.0.0" From b2bc4fe4f468a8b2ee6e42fb441978b6a2447eba Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 13 Apr 2018 11:25:03 -0400 Subject: [PATCH 417/569] 8.2.3 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 7f62231b3063..62977e549a23 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "8.2.2", + "version": "8.2.3", "description": "Custom parser for ESLint", "main": "lib/index.js", "files": [ From cadb22334e87a182767381151abcff59b1052935 Mon Sep 17 00:00:00 2001 From: Ankur Oberoi Date: Fri, 13 Apr 2018 09:26:41 -0700 Subject: [PATCH 418/569] updates readme for latest eslint & babel-eslint (babel/babel-eslint#607) [skip ci] --- eslint/babel-eslint-parser/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index 23f13c3b1080..4dbfc84f072b 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -47,6 +47,7 @@ It just needs to export a `parse` method that takes in a string of code and outp ESLint | babel-eslint ------------ | ------------- +4.x | >= 6.x 3.x | >= 6.x 2.x | >= 6.x 1.x | >= 5.x @@ -56,9 +57,9 @@ ESLint | babel-eslint Ensure that you have substituted the correct version lock for `eslint` and `babel-eslint` into this command: ```sh -$ npm install eslint@3.x babel-eslint@7 --save-dev +$ npm install eslint@4.x babel-eslint@8 --save-dev # or -$ yarn add eslint@3.x babel-eslint@7 -D +$ yarn add eslint@4.x babel-eslint@8 -D ``` ### Setup From 735abb06b4a15998aeb462337ea09f394aa19dd2 Mon Sep 17 00:00:00 2001 From: jmurretxactly <35241735+jmurretxactly@users.noreply.github.com> Date: Tue, 8 May 2018 05:52:59 -0600 Subject: [PATCH 419/569] don't require unpad per test fixture, fixes babel/babel-eslint#572 (babel/babel-eslint#618) --- .../test/non-regression.js | 915 ++++++++---------- 1 file changed, 381 insertions(+), 534 deletions(-) diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 9031a410f0eb..2a23ee58d00d 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -51,11 +51,11 @@ function verifyAndAssertMessagesWithSpecificESLint( }${message.ruleId ? ` ${message.ruleId}` : ""}`; if (formatedMessage !== expectedMessages[i]) { throw new Error( - unpad(` + ` Message ${i} does not match: Expected: ${expectedMessages[i]} Actual: ${formatedMessage} - `) + ` ); } }); @@ -69,9 +69,9 @@ function verifyAndAssertMessages( overrideConfig ) { verifyAndAssertMessagesWithSpecificESLint( - code, - rules, - expectedMessages, + unpad(`${code}`), + rules || {}, + expectedMessages || [], sourceType, overrideConfig, new eslint.Linter() @@ -80,7 +80,7 @@ function verifyAndAssertMessages( describe("verify", () => { it("arrow function support (issue #1)", () => { - verifyAndAssertMessages("describe('stuff', () => {});", {}, []); + verifyAndAssertMessages("describe('stuff', () => {});"); }); it("EOL validation (issue #2)", () => { @@ -99,63 +99,50 @@ describe("verify", () => { it("Modules support (issue #5)", () => { verifyAndAssertMessages( - unpad(` + ` import Foo from 'foo'; export default Foo; export const c = 'c'; export class Store {} - `), - {}, - [] + ` ); }); it("Rest parameters (issue #7)", () => { - verifyAndAssertMessages( - "function foo(...args) { return args; }", - { "no-undef": 1 }, - [] - ); + verifyAndAssertMessages("function foo(...args) { return args; }", { + "no-undef": 1, + }); }); it("Exported classes should be used (issue #8)", () => { - verifyAndAssertMessages( - "class Foo {} module.exports = Foo;", - { "no-unused-vars": 1 }, - [] - ); + verifyAndAssertMessages("class Foo {} module.exports = Foo;", { + "no-unused-vars": 1, + }); }); it("super keyword in class (issue #10)", () => { - verifyAndAssertMessages( - "class Foo { constructor() { super() } }", - { "no-undef": 1 }, - [] - ); + verifyAndAssertMessages("class Foo { constructor() { super() } }", { + "no-undef": 1, + }); }); it("Rest parameter in destructuring assignment (issue #11)", () => { verifyAndAssertMessages( "const [a, ...rest] = ['1', '2', '3']; module.exports = rest;", - { "no-undef": 1 }, - [] + { "no-undef": 1 } ); }); it("JSX attribute names marked as variables (issue #12)", () => { - verifyAndAssertMessages( - 'module.exports =
', - { "no-undef": 1 }, - [] - ); + verifyAndAssertMessages('module.exports =
', { + "no-undef": 1, + }); }); it("Multiple destructured assignment with compound properties (issue #16)", () => { - verifyAndAssertMessages( - "module.exports = { ...a.a, ...a.b };", - { "no-dupe-keys": 1 }, - [] - ); + verifyAndAssertMessages("module.exports = { ...a.a, ...a.b };", { + "no-dupe-keys": 1, + }); }); it("Arrow function with non-block bodies (issue #20)", () => { @@ -168,40 +155,33 @@ describe("verify", () => { }); it("#242", () => { - verifyAndAssertMessages( - '"use strict"; asdf;', - { "no-irregular-whitespace": 1 }, - [], - {} - ); + verifyAndAssertMessages('"use strict"; asdf;', { + "no-irregular-whitespace": 1, + }); }); it("await keyword (issue #22)", () => { - verifyAndAssertMessages( - "async function foo() { await bar(); }", - { "no-unused-expressions": 1 }, - [] - ); + verifyAndAssertMessages("async function foo() { await bar(); }", { + "no-unused-expressions": 1, + }); }); it("arrow functions (issue #27)", () => { - verifyAndAssertMessages( - "[1, 2, 3].map(i => i * 2);", - { "func-names": 1, "space-before-blocks": 1 }, - [] - ); + verifyAndAssertMessages("[1, 2, 3].map(i => i * 2);", { + "func-names": 1, + "space-before-blocks": 1, + }); }); it("comment with padded-blocks (issue #33)", () => { verifyAndAssertMessages( - unpad(` + ` if (a) { // i'm a comment! let b = c } - `), - { "padded-blocks": [1, "never"] }, - [] + `, + { "padded-blocks": [1, "never"] } ); }); @@ -209,22 +189,21 @@ describe("verify", () => { it("check regular function", () => { verifyAndAssertMessages( "function a(b, c) { b += 1; c += 1; return b + c; } a;", - { "no-unused-vars": 1, "no-undef": 1 }, - [] + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("type alias", () => { - verifyAndAssertMessages("type SomeNewType = any;", { "no-undef": 1 }, []); + verifyAndAssertMessages("type SomeNewType = any;", { "no-undef": 1 }); }); it("type cast expression #102", () => { - verifyAndAssertMessages("for (let a of (a: Array)) {}", {}, []); + verifyAndAssertMessages("for (let a of (a: Array)) {}"); }); it("multiple nullable type annotations and return #108", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; import type Foo3 from 'foo'; @@ -232,20 +211,19 @@ describe("verify", () => { console.log(foo, foo2); } log(1, 2); - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("interface declaration", () => { verifyAndAssertMessages( - unpad(` + ` interface Foo {}; interface Bar { foo: Foo, }; - `), + `, { "no-unused-vars": 1, "no-undef": 1 }, ["2:11 'Bar' is defined but never used. no-unused-vars"] ); @@ -253,14 +231,14 @@ describe("verify", () => { it("type parameter bounds (classes)", () => { verifyAndAssertMessages( - unpad(` + ` import type {Foo, Foo2} from 'foo'; import Base from 'base'; class Log extends Base { messages: {[T1]: T2}; } new Log(); - `), + `, { "no-unused-vars": 1, "no-undef": 1 }, ["3:34 'T4' is defined but never used. no-unused-vars"] ); @@ -268,12 +246,12 @@ describe("verify", () => { it("type parameter scope (classes)", () => { verifyAndAssertMessages( - unpad(` + ` T; class Foo {} T; new Foo(); - `), + `, { "no-unused-vars": 1, "no-undef": 1 }, [ "1:1 'T' is not defined. no-undef", @@ -285,12 +263,12 @@ describe("verify", () => { it("type parameter bounds (interfaces)", () => { verifyAndAssertMessages( - unpad(` + ` import type {Foo, Foo2, Bar} from ''; interface Log extends Bar { messages: {[T1]: T2}; } - `), + `, { "no-unused-vars": 1, "no-undef": 1 }, [ "2:11 'Log' is defined but never used. no-unused-vars", @@ -301,12 +279,12 @@ describe("verify", () => { it("type parameter scope (interfaces)", () => { verifyAndAssertMessages( - unpad(` + ` T; interface Foo {}; T; Foo; - `), + `, { "no-unused-vars": 1, "no-undef": 1 }, [ "1:1 'T' is not defined. no-undef", @@ -318,13 +296,13 @@ describe("verify", () => { it("type parameter bounds (type aliases)", () => { verifyAndAssertMessages( - unpad(` + ` import type {Foo, Foo2, Foo3} from 'foo'; type Log = { messages: {[T1]: T2}; delay: Foo3; }; - `), + `, { "no-unused-vars": 1, "no-undef": 1 }, [ "2:6 'Log' is defined but never used. no-unused-vars", @@ -335,12 +313,12 @@ describe("verify", () => { it("type parameter scope (type aliases)", () => { verifyAndAssertMessages( - unpad(` + ` T; type Foo = {}; T; Foo; - `), + `, { "no-unused-vars": 1, "no-undef": 1 }, [ "1:1 'T' is not defined. no-undef", @@ -352,12 +330,12 @@ describe("verify", () => { it("type parameter bounds (functions)", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; function log(a: T1, b: T2): T3 { return a + b; } log(1, 2); - `), + `, { "no-unused-vars": 1, "no-undef": 1 }, ["3:37 'T4' is defined but never used. no-unused-vars"] ); @@ -365,12 +343,12 @@ describe("verify", () => { it("type parameter scope (functions)", () => { verifyAndAssertMessages( - unpad(` + ` T; function log() {} T; log; - `), + `, { "no-unused-vars": 1, "no-undef": 1 }, [ "1:1 'T' is not defined. no-undef", @@ -382,60 +360,56 @@ describe("verify", () => { it("nested type annotations", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; function foo(callback: () => Foo) { return callback(); } foo(); - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("type in var declaration", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var x: Foo = 1; x; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("object type annotation", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var a: {numVal: Foo}; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("object property types", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; var a = { circle: (null : ?{ setNativeProps(props: Foo): Foo2 }) }; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("namespaced types", () => { verifyAndAssertMessages( - unpad(` + ` var React = require('react-native'); var b = { openExternalExample: (null: ?React.Component) @@ -445,132 +419,121 @@ describe("verify", () => { }; b; c; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("ArrayTypeAnnotation", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var x: Foo[]; x; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("ClassImplements", () => { verifyAndAssertMessages( - unpad(` + ` import type Bar from 'foo'; export default class Foo implements Bar {} - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("type alias creates declaration + usage", () => { verifyAndAssertMessages( - unpad(` + ` type Foo = any; var x : Foo = 1; x; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("type alias with type parameters", () => { verifyAndAssertMessages( - unpad(` + ` import type Bar from 'foo'; import type Foo3 from 'foo'; type Foo = Bar var x : Foo = 1; x; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("export type alias", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo2 from 'foo'; export type Foo = Foo2; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("polymorphpic types #109", () => { verifyAndAssertMessages( "export default function groupByEveryN(array: Array, n: number): Array> { n; }", - { "no-unused-vars": 1, "no-undef": 1 }, - [] + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("types definition from import", () => { verifyAndAssertMessages( - unpad(` + ` import type Promise from 'bluebird'; type Operation = () => Promise; x: Operation; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("polymorphpic/generic types for class #123", () => { verifyAndAssertMessages( - unpad(` + ` class Box { value: T; } var box = new Box(); console.log(box.value); - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("polymorphpic/generic types for function #123", () => { verifyAndAssertMessages( - unpad(` + ` export function identity(value) { var a: T = value; a; } - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("polymorphpic/generic types for type alias #123", () => { verifyAndAssertMessages( - unpad(` + ` import Bar from './Bar'; type Foo = Bar; var x: Foo = 1; console.log(x); - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("polymorphpic/generic types - outside of fn scope #123", () => { verifyAndAssertMessages( - unpad(` + ` export function foo(value) { value; }; var b: T = 1; b; - `), + `, { "no-unused-vars": 1, "no-undef": 1 }, [ "1:21 'T' is defined but never used. no-unused-vars", @@ -581,10 +544,10 @@ describe("verify", () => { it("polymorphpic/generic types - extending unknown #123", () => { verifyAndAssertMessages( - unpad(` + ` import Bar from 'bar'; export class Foo extends Bar {} - `), + `, { "no-unused-vars": 1, "no-undef": 1 }, ["2:30 'T' is not defined. no-undef"] ); @@ -592,24 +555,23 @@ describe("verify", () => { it("support declarations #132", () => { verifyAndAssertMessages( - unpad(` + ` declare class A { static () : number } declare module B { declare var x: number; } declare function foo(): void; declare var bar A; B; foo(); bar; - `), - { "no-undef": 1, "no-unused-vars": 1 }, - [] + `, + { "no-undef": 1, "no-unused-vars": 1 } ); }); it("supports type spreading", () => { verifyAndAssertMessages( - unpad(` + ` type U = {}; type T = {a: number, ...U, ...V}; - `), + `, { "no-undef": 1, "no-unused-vars": 1 }, [ "2:6 'T' is defined but never used. no-unused-vars", @@ -620,615 +582,554 @@ describe("verify", () => { it("1", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; export default function(a: Foo, b: ?Foo2, c){ a; b; c; } - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("2", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; export default function(a: () => Foo){ a; } - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("3", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; export default function(a: (_:Foo) => Foo2){ a; } - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("4", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; import type Foo3 from 'foo'; export default function(a: (_1:Foo, _2:Foo2) => Foo3){ a; } - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("5", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; export default function(a: (_1:Foo, ...foo:Array) => number){ a; } - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("6", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; export default function(): Foo {} - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("7", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; export default function():() => Foo {} - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("8", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; export default function():(_?:Foo) => Foo2{} - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("9", () => { verifyAndAssertMessages( "export default function (a: T1, b: T2) { b; }", - { "no-unused-vars": 1, "no-undef": 1 }, - [] + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("10", () => { verifyAndAssertMessages( "var a=function(a: T1, b: T2) {return a + b;}; a;", - { "no-unused-vars": 1, "no-undef": 1 }, - [] + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("11", () => { - verifyAndAssertMessages( - "var a={*id(x: T): T { x; }}; a;", - { "no-unused-vars": 1, "no-undef": 1 }, - [] - ); + verifyAndAssertMessages("var a={*id(x: T): T { x; }}; a;", { + "no-unused-vars": 1, + "no-undef": 1, + }); }); it("12", () => { - verifyAndAssertMessages( - "var a={async id(x: T): T { x; }}; a;", - { "no-unused-vars": 1, "no-undef": 1 }, - [] - ); + verifyAndAssertMessages("var a={async id(x: T): T { x; }}; a;", { + "no-unused-vars": 1, + "no-undef": 1, + }); }); it("13", () => { - verifyAndAssertMessages( - "var a={123(x: T): T { x; }}; a;", - { "no-unused-vars": 1, "no-undef": 1 }, - [] - ); + verifyAndAssertMessages("var a={123(x: T): T { x; }}; a;", { + "no-unused-vars": 1, + "no-undef": 1, + }); }); it("14", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; export default class Bar {set fooProp(value:Foo):Foo2{ value; }} - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("15", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo2 from 'foo'; export default class Foo {get fooProp(): Foo2{}} - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("16", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var numVal:Foo; numVal; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("17", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var a: {numVal: Foo;}; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("18", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; import type Foo3 from 'foo'; var a: ?{numVal: Foo; [indexer: Foo2]: Foo3}; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("19", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; var a: {numVal: Foo; subObj?: ?{strVal: Foo2}}; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("20", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; import type Foo3 from 'foo'; import type Foo4 from 'foo'; var a: { [a: Foo]: Foo2; [b: Foo3]: Foo4; }; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("21", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; import type Foo3 from 'foo'; var a: {add(x:Foo, ...y:Array): Foo3}; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("22", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; import type Foo3 from 'foo'; var a: { id(x: Foo2): Foo3; }; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("23", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var a:Array = [1, 2, 3]; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("24", () => { verifyAndAssertMessages( - unpad(` + ` import type Baz from 'baz'; export default class Bar extends Baz { }; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("25", () => { verifyAndAssertMessages( "export default class Bar { bar(): T { return 42; }}", - { "no-unused-vars": 1, "no-undef": 1 }, - [] + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("26", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; export default class Bar { static prop1:Foo; prop2:Foo2; } - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("27", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; var x : Foo | Foo2 = 4; x; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("28", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; var x : () => Foo | () => Foo2; x; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("29", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; var x: typeof Foo | number = Foo2; x; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("30", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var {x}: {x: Foo; } = { x: 'hello' }; x; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("31", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var [x]: Array = [ 'hello' ]; x; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("32", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; export default function({x}: { x: Foo; }) { x; } - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("33", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; function foo([x]: Array) { x; } foo(); - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("34", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; var a: Map >; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("35", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var a: ?Promise[]; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("36", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; var a:(...rest:Array) => Foo2; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("37", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; import type Foo3 from 'foo'; import type Foo4 from 'foo'; var a: (x: Foo2, ...y:Foo3[]) => Foo4; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("38", () => { verifyAndAssertMessages( - unpad(` + ` import type {foo, bar} from 'baz'; foo; bar; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("39", () => { verifyAndAssertMessages( - unpad(` + ` import type {foo as bar} from 'baz'; bar; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("40", () => { verifyAndAssertMessages( - unpad(` + ` import type from 'foo'; type; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("41", () => { verifyAndAssertMessages( - unpad(` + ` import type, {foo} from 'bar'; type; foo; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("43", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var a: Foo[]; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("44", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var a: ?Foo[]; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("45", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var a: (?Foo)[]; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("46", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var a: () => Foo[]; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("47", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var a: (() => Foo)[]; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("48", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var a: typeof Foo[]; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("49", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; import type Foo3 from 'foo'; var a : [Foo, Foo2,] = [123, 'duck',]; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); }); it("class usage", () => { - verifyAndAssertMessages( - "class Lol {} module.exports = Lol;", - { "no-unused-vars": 1 }, - [] - ); + verifyAndAssertMessages("class Lol {} module.exports = Lol;", { + "no-unused-vars": 1, + }); }); it("class definition: gaearon/redux#24", () => { verifyAndAssertMessages( - unpad(` + ` export default function root(stores) { return DecoratedComponent => class ReduxRootDecorator { a() { DecoratedComponent; stores; } }; } - `), - { "no-undef": 1, "no-unused-vars": 1 }, - [] + `, + { "no-undef": 1, "no-unused-vars": 1 } ); }); it("class properties #71", () => { - verifyAndAssertMessages( - "class Lol { foo = 'bar'; }", - { "no-undef": 1 }, - [] - ); + verifyAndAssertMessages("class Lol { foo = 'bar'; }", { "no-undef": 1 }); }); it("template strings #31", () => { - verifyAndAssertMessages( - "console.log(`${a}, b`);", - { "comma-spacing": 1 }, - [] - ); + verifyAndAssertMessages("console.log(`${a}, b`);", { "comma-spacing": 1 }); }); it("template with destructuring #31", () => { verifyAndAssertMessages( - unpad(` + ` module.exports = { render() { var {name} = this.props; return Math.max(null, \`Name: \${name}, Name: \${name}\`); } }; - `), - { "comma-spacing": 1 }, - [] + `, + { "comma-spacing": 1 } ); }); describe("decorators #72", () => { it("class declaration", () => { verifyAndAssertMessages( - unpad(` + ` import classDeclaration from 'decorator'; import decoratorParameter from 'decorator'; @classDeclaration((parameter) => parameter) @classDeclaration(decoratorParameter) @classDeclaration export class TextareaAutosize {} - `), - { "no-unused-vars": 1 }, - [] + `, + { "no-unused-vars": 1 } ); }); it("method definition", () => { verifyAndAssertMessages( - unpad(` + ` import classMethodDeclarationA from 'decorator'; import decoratorParameter from 'decorator'; export class TextareaAutosize { @@ -1239,15 +1140,14 @@ describe("verify", () => { e(); } } - `), - { "no-unused-vars": 1 }, - [] + `, + { "no-unused-vars": 1 } ); }); it("method definition get/set", () => { verifyAndAssertMessages( - unpad(` + ` import classMethodDeclarationA from 'decorator'; import decoratorParameter from 'decorator'; export class TextareaAutosize { @@ -1260,15 +1160,14 @@ describe("verify", () => { @classMethodDeclarationA set bar(val) { val; } } - `), - { "no-unused-vars": 1 }, - [] + `, + { "no-unused-vars": 1 } ); }); it("object property", () => { verifyAndAssertMessages( - unpad(` + ` import classMethodDeclarationA from 'decorator'; import decoratorParameter from 'decorator'; var obj = { @@ -1280,15 +1179,14 @@ describe("verify", () => { } }; obj; - `), - { "no-unused-vars": 1 }, - [] + `, + { "no-unused-vars": 1 } ); }); it("object property get/set", () => { verifyAndAssertMessages( - unpad(` + ` import classMethodDeclarationA from 'decorator'; import decoratorParameter from 'decorator'; var obj = { @@ -1302,9 +1200,8 @@ describe("verify", () => { set bar(val) { val; } }; obj; - `), - { "no-unused-vars": 1 }, - [] + `, + { "no-unused-vars": 1 } ); }); }); @@ -1321,40 +1218,35 @@ describe("verify", () => { it.skip("visits excluded properties left of spread #95", () => { verifyAndAssertMessages( "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", - { "no-unused-vars": 1 }, - [] + { "no-unused-vars": 1 } ); }); it.skip("visits excluded properties left of spread #210", () => { verifyAndAssertMessages( "const props = { yo: 'yo' }; const { ...otherProps } = props;", - { "no-unused-vars": 1 }, - [] + { "no-unused-vars": 1 } ); }); it("does not mark spread variables false-positive", () => { verifyAndAssertMessages( "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", - { "no-undef": 1, "no-redeclare": 1 }, - [] + { "no-undef": 1, "no-redeclare": 1 } ); }); it("does not mark spread variables false-positive", () => { verifyAndAssertMessages( "const props = { yo: 'yo' }; const { ...otherProps } = props;", - { "no-undef": 1, "no-redeclare": 1 }, - [] + { "no-undef": 1, "no-redeclare": 1 } ); }); it("does not mark spread variables as use-before-define #249", () => { verifyAndAssertMessages( "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", - { "no-use-before-define": 1 }, - [] + { "no-use-before-define": 1 } ); }); @@ -1368,55 +1260,48 @@ describe("verify", () => { it("don't warn no-unused-vars with spread #142", () => { verifyAndAssertMessages( - unpad(` + ` export default function test(data) { return { foo: 'bar', ...data }; } - `), - { "no-undef": 1, "no-unused-vars": 1 }, - [] + `, + { "no-undef": 1, "no-unused-vars": 1 } ); }); it("excludes comment tokens #153", () => { verifyAndAssertMessages( - unpad(` + ` var a = [ 1, 2, // a trailing comment makes this line fail comma-dangle (always-multiline) ]; - `), - { "comma-dangle": [2, "always-multiline"] }, - [] + `, + { "comma-dangle": [2, "always-multiline"] } ); verifyAndAssertMessages( - unpad(` + ` switch (a) { // A comment here makes the above line fail brace-style case 1: console.log(a); } - `), - { "brace-style": 2 }, - [] + `, + { "brace-style": 2 } ); }); it("ternary and parens #149", () => { - verifyAndAssertMessages( - "true ? (true) : false;", - { "space-infix-ops": 1 }, - [] - ); + verifyAndAssertMessages("true ? (true) : false;", { "space-infix-ops": 1 }); }); it("line comment space-in-parens #124", () => { verifyAndAssertMessages( - unpad(` + ` React.createClass({ render() { // return ( @@ -1424,15 +1309,14 @@ describe("verify", () => { // ); // <-- this is the line that is reported } }); - `), - { "space-in-parens": 1 }, - [] + `, + { "space-in-parens": 1 } ); }); it("block comment space-in-parens #124", () => { verifyAndAssertMessages( - unpad(` + ` React.createClass({ render() { /* @@ -1442,31 +1326,27 @@ describe("verify", () => { */ } }); - `), - { "space-in-parens": 1 }, - [] + `, + { "space-in-parens": 1 } ); }); it("no no-undef error with rest #11", () => { - verifyAndAssertMessages( - "const [a, ...rest] = ['1', '2', '3']; a; rest;", - { "no-undef": 1, "no-unused-vars": 1 }, - [] - ); + verifyAndAssertMessages("const [a, ...rest] = ['1', '2', '3']; a; rest;", { + "no-undef": 1, + "no-unused-vars": 1, + }); }); it("async function with space-before-function-paren #168", () => { - verifyAndAssertMessages( - "it('handles updates', async function() {});", - { "space-before-function-paren": [1, "never"] }, - [] - ); + verifyAndAssertMessages("it('handles updates', async function() {});", { + "space-before-function-paren": [1, "never"], + }); }); it("default param flow type no-unused-vars #184", () => { verifyAndAssertMessages( - unpad(` + ` type ResolveOptionType = { depth?: number, identifier?: string @@ -1477,46 +1357,44 @@ describe("verify", () => { ): Object { options; } - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("no-use-before-define #192", () => { verifyAndAssertMessages( - unpad(` + ` console.log(x); var x = 1; - `), + `, { "no-use-before-define": 1 }, ["1:13 'x' was used before it was defined. no-use-before-define"] ); }); it("jsx and stringliteral #216", () => { - verifyAndAssertMessages("
", {}, []); + verifyAndAssertMessages("
"); }); it("getter/setter #218", () => { verifyAndAssertMessages( - unpad(` + ` class Person { set a (v) { } } - `), + `, { "space-before-function-paren": 1, "keyword-spacing": [1, { before: true }], indent: 1, - }, - [] + } ); }); it("getter/setter #220", () => { verifyAndAssertMessages( - unpad(` + ` var B = { get x () { return this.ecks; @@ -1525,32 +1403,30 @@ describe("verify", () => { this.ecks = ecks; } }; - `), - { "no-dupe-keys": 1 }, - [] + `, + { "no-dupe-keys": 1 } ); }); it("fixes issues with flow types and ObjectPattern", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'bar'; export default class Foobar { foo({ bar }: Foo) { bar; } bar({ foo }: Foo) { foo; } } - `), - { "no-unused-vars": 1, "no-shadow": 1 }, - [] + `, + { "no-unused-vars": 1, "no-shadow": 1 } ); }); it("correctly detects redeclares if in script mode #217", () => { verifyAndAssertMessages( - unpad(` + ` var a = 321; var a = 123; - `), + `, { "no-redeclare": 1 }, ["2:5 'a' is already defined. no-redeclare"], "script" @@ -1559,10 +1435,10 @@ describe("verify", () => { it("correctly detects redeclares if in module mode #217", () => { verifyAndAssertMessages( - unpad(` + ` var a = 321; var a = 123; - `), + `, { "no-redeclare": 1 }, ["2:5 'a' is already defined. no-redeclare"], "module" @@ -1612,11 +1488,11 @@ describe("verify", () => { it("allowImportExportEverywhere option (#327)", () => { verifyAndAssertMessages( - unpad(` + ` if (true) { import Foo from 'foo'; } function foo() { import Bar from 'bar'; } switch (a) { case 1: import FooBar from 'foobar'; } - `), + `, {}, [], "module", @@ -1642,21 +1518,19 @@ describe("verify", () => { }); it("new.target is not reported as undef #235", () => { - verifyAndAssertMessages( - "function foo () { return new.target }", - { "no-undef": 1 }, - [] - ); + verifyAndAssertMessages("function foo () { return new.target }", { + "no-undef": 1, + }); }); it("decorator does not create TypeError #229", () => { verifyAndAssertMessages( - unpad(` + ` class A { @test f() {} } - `), + `, { "no-undef": 1 }, ["2:4 'test' is not defined. no-undef"] ); @@ -1664,18 +1538,17 @@ describe("verify", () => { it("Flow definition does not trigger warnings #223", () => { verifyAndAssertMessages( - unpad(` + ` import { Map as $Map } from 'immutable'; function myFunction($state: $Map, { a, b, c } : { a: ?Object, b: ?Object, c: $Map }) {} - `), - { "no-dupe-args": 1, "no-redeclare": 1, "no-shadow": 1 }, - [] + `, + { "no-dupe-args": 1, "no-redeclare": 1, "no-shadow": 1 } ); }); it("newline-before-return with comments #289", () => { verifyAndAssertMessages( - unpad(` + ` function a() { if (b) { /* eslint-disable no-console */ @@ -1685,55 +1558,51 @@ describe("verify", () => { return hasGlobal; } - `), - { "newline-before-return": 1 }, - [] + `, + { "newline-before-return": 1 } ); }); it("spaced-comment with shebang #163", () => { verifyAndAssertMessages( - unpad(` + ` #!/usr/bin/env babel-node import {spawn} from 'foobar'; - `), - { "spaced-comment": 1 }, - [] + `, + { "spaced-comment": 1 } ); }); describe("Class Property Declarations", () => { it("no-redeclare false positive 1", () => { verifyAndAssertMessages( - unpad(` + ` class Group { static propTypes = {}; } class TypicalForm { static propTypes = {}; } - `), - { "no-redeclare": 1 }, - [] + `, + { "no-redeclare": 1 } ); }); it("no-redeclare false positive 2", () => { verifyAndAssertMessages( - unpad(` + ` function validate() {} class MyComponent { static validate = validate; } - `), - { "no-redeclare": 1 }, - [] + `, + { "no-redeclare": 1 } ); }); it("check references", () => { verifyAndAssertMessages( - unpad(` + ` var a; class A { prop1; @@ -1741,7 +1610,7 @@ describe("verify", () => { prop3 = b; } new A - `), + `, { "no-undef": 1, "no-unused-vars": 1, "no-redeclare": 1 }, ["5:11 'b' is not defined. no-undef"] ); @@ -1749,148 +1618,126 @@ describe("verify", () => { }); it("dynamic import support", () => { - verifyAndAssertMessages("import('test-module').then(() => {})", {}, []); + verifyAndAssertMessages("import('test-module').then(() => {})"); }); it("regex with es6 unicodeCodePointEscapes", () => { verifyAndAssertMessages( - "string.replace(/[\u{0000A0}-\u{10FFFF}<>&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`);", - {}, - [] + "string.replace(/[\u{0000A0}-\u{10FFFF}<>&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`);" ); }); describe("private class properties", () => { it("should not be undefined", () => { verifyAndAssertMessages( - unpad(` + ` class C { #d = 1; } - `), - { "no-undef": 1 }, - [] + `, + { "no-undef": 1 } ); }); it("should not be unused", () => { verifyAndAssertMessages( - unpad(` + ` export class C { #d = 1; } - `), - { "no-unused-vars": 1 }, - [] + `, + { "no-unused-vars": 1 } ); }); }); it("flow types on class method should be visited correctly", () => { verifyAndAssertMessages( - unpad(` + ` import type NodeType from 'foo'; class NodeUtils { finishNodeAt(node: T): T { return node; } } new NodeUtils(); - `), - { "no-unused-vars": 1 }, - [] + `, + { "no-unused-vars": 1 } ); }); it("works with dynamicImport", () => { verifyAndAssertMessages( - unpad(` + ` import('a'); - `), - {}, - [] + ` ); }); it("works with numericSeparator", () => { verifyAndAssertMessages( - unpad(` + ` 1_000 - `), - {}, - [] + ` ); }); it("works with optionalChaining", () => { verifyAndAssertMessages( - unpad(` + ` a?.b - `), - {}, - [] + ` ); }); it("works with import.meta", () => { verifyAndAssertMessages( - unpad(` + ` import.meta - `), - {}, - [] + ` ); }); it("works with classPrivateProperties", () => { verifyAndAssertMessages( - unpad(` + ` class A { #a = 1; } - `), - {}, - [] + ` ); }); it("works with optionalCatchBinding", () => { verifyAndAssertMessages( - unpad(` + ` try {} catch {} try {} catch {} finally {} - `), - {}, - [] + ` ); }); it("exportDefaultFrom", () => { verifyAndAssertMessages( - unpad(` + ` export v from "mod" - `), - {}, - [] + ` ); }); it("exportNamespaceFrom", () => { verifyAndAssertMessages( - unpad(` + ` export * as ns from "mod" - `), - {}, - [] + ` ); }); it("ignore eval in scope analysis", () => { verifyAndAssertMessages( - unpad(` + ` const a = 1; console.log(a); eval(''); - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); }); From 3477626973a24e18c6fc40b97c7855078ab4e3b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Fri, 15 Jun 2018 15:31:43 +0100 Subject: [PATCH 420/569] Add support for the optional chaining operator (babel/babel-eslint#630) --- eslint/babel-eslint-parser/lib/patch-eslint-scope.js | 4 ++++ eslint/babel-eslint-parser/test/non-regression.js | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/eslint/babel-eslint-parser/lib/patch-eslint-scope.js b/eslint/babel-eslint-parser/lib/patch-eslint-scope.js index aec71fc6ca70..2bf2b350ff03 100644 --- a/eslint/babel-eslint-parser/lib/patch-eslint-scope.js +++ b/eslint/babel-eslint-parser/lib/patch-eslint-scope.js @@ -233,6 +233,10 @@ function monkeypatch(modules) { // visit ClassPrivateProperty as a Property. referencer.prototype.ClassPrivateProperty = visitClassProperty; + // visit OptionalMemberExpression as a MemberExpression. + referencer.prototype.OptionalMemberExpression = + referencer.prototype.MemberExpression; + // visit flow type in FunctionDeclaration, FunctionExpression, ArrowFunctionExpression var visitFunction = referencer.prototype.visitFunction; referencer.prototype.visitFunction = function(node) { diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 2a23ee58d00d..687af37cc4c9 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1651,6 +1651,18 @@ describe("verify", () => { }); }); + describe("optional chaining operator", () => { + it("should not be undefined #595", () => { + verifyAndAssertMessages( + ` + const foo = {}; + foo?.bar; + `, + { "no-undef": 1 } + ); + }); + }); + it("flow types on class method should be visited correctly", () => { verifyAndAssertMessages( ` From 99968db2b1485e8ab580523b6d228eccee048cb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Fri, 15 Jun 2018 15:42:05 +0100 Subject: [PATCH 421/569] Fix token types for experimental operators (babel/babel-eslint#632) * Added failing tests * Recognized nullish coalescing, optional chaining and pipeline operators as Punctuator tokens --- .../lib/babylon-to-espree/toToken.js | 3 ++ .../babel-eslint-parser/test/babel-eslint.js | 30 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/eslint/babel-eslint-parser/lib/babylon-to-espree/toToken.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/toToken.js index 082aef3e3267..44c73529a111 100644 --- a/eslint/babel-eslint-parser/lib/babylon-to-espree/toToken.js +++ b/eslint/babel-eslint-parser/lib/babylon-to-espree/toToken.js @@ -19,16 +19,19 @@ module.exports = function(token, tt, source) { type === tt.bracketR || type === tt.ellipsis || type === tt.arrow || + type === tt.pipeline || type === tt.star || type === tt.incDec || type === tt.colon || type === tt.question || + type === tt.questionDot || type === tt.template || type === tt.backQuote || type === tt.dollarBraceL || type === tt.at || type === tt.logicalOR || type === tt.logicalAND || + type === tt.nullishCoalescing || type === tt.bitwiseOR || type === tt.bitwiseXOR || type === tt.bitwiseAND || diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index c066ed280997..b0a2cd10f2ad 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -256,6 +256,36 @@ describe("babylon-to-espree", () => { parseAndAssertSame("export { foo as bar };"); }); + // Espree doesn't support the optional chaining operator yet + it("optional chaining operator (token)", () => { + const code = "foo?.bar"; + var babylonAST = babelEslint.parseForESLint(code, { + eslintVisitorKeys: true, + eslintScopeManager: true, + }).ast; + assert.strictEqual(babylonAST.tokens[1].type, "Punctuator"); + }); + + // Espree doesn't support the nullish coalescing operator yet + it("nullish coalescing operator (token)", () => { + const code = "foo ?? bar"; + var babylonAST = babelEslint.parseForESLint(code, { + eslintVisitorKeys: true, + eslintScopeManager: true, + }).ast; + assert.strictEqual(babylonAST.tokens[1].type, "Punctuator"); + }); + + // Espree doesn't support the pipeline operator yet + it("pipeline operator (token)", () => { + const code = "foo |> bar"; + var babylonAST = babelEslint.parseForESLint(code, { + eslintVisitorKeys: true, + eslintScopeManager: true, + }).ast; + assert.strictEqual(babylonAST.tokens[1].type, "Punctuator"); + }); + it.skip("empty program with line comment", () => { parseAndAssertSame("// single comment"); }); From 077bea0a45f97d451129d0e3e8c46fbdb2a72123 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Mon, 18 Jun 2018 16:46:31 -0500 Subject: [PATCH 422/569] Fix converting template types to handle nested templates (babel/babel-eslint#610) Fixes https://github.com/babel/babel-eslint/issues/603 (and the fixture from https://github.com/babel/babel-eslint/issues/609 works). Reworks our code that converts the format of Babylon template tokens to be a bit more robust, especially with things like nested templates with arrows. (Adapted the logic from https://github.com/eslint/espree/blob/master/lib/token-translator.js) --- eslint/babel-eslint-parser/.prettierignore | 1 + .../babylon-to-espree/convertTemplateType.js | 147 +++++++++--------- .../lib/babylon-to-espree/index.js | 5 - .../lib/babylon-to-espree/toTokens.js | 15 +- .../babel-eslint-parser/test/babel-eslint.js | 10 +- .../test/non-regression.js | 12 ++ 6 files changed, 95 insertions(+), 95 deletions(-) create mode 100644 eslint/babel-eslint-parser/.prettierignore diff --git a/eslint/babel-eslint-parser/.prettierignore b/eslint/babel-eslint-parser/.prettierignore new file mode 100644 index 000000000000..a6c57f5fb2ff --- /dev/null +++ b/eslint/babel-eslint-parser/.prettierignore @@ -0,0 +1 @@ +*.json diff --git a/eslint/babel-eslint-parser/lib/babylon-to-espree/convertTemplateType.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/convertTemplateType.js index d8892f997260..accde61e56d6 100644 --- a/eslint/babel-eslint-parser/lib/babylon-to-espree/convertTemplateType.js +++ b/eslint/babel-eslint-parser/lib/babylon-to-espree/convertTemplateType.js @@ -1,99 +1,92 @@ "use strict"; module.exports = function(tokens, tt) { - var startingToken = 0; - var currentToken = 0; - var numBraces = 0; // track use of {} - var numBackQuotes = 0; // track number of nested templates + let curlyBrace = null; + let templateTokens = []; + const result = []; - function isBackQuote(token) { - return tokens[token].type === tt.backQuote; - } - - function isTemplateStarter(token) { - return ( - isBackQuote(token) || - // only can be a template starter when in a template already - (tokens[token].type === tt.braceR && numBackQuotes > 0) - ); - } - - function isTemplateEnder(token) { - return isBackQuote(token) || tokens[token].type === tt.dollarBraceL; - } + function addTemplateType() { + const start = templateTokens[0]; + const end = templateTokens[templateTokens.length - 1]; - // append the values between start and end - function createTemplateValue(start, end) { - var value = ""; - while (start <= end) { - if (tokens[start].value) { - value += tokens[start].value; - } else if (tokens[start].type !== tt.template) { - value += tokens[start].type.label; + const value = templateTokens.reduce((result, token) => { + if (token.value) { + result += token.value; + } else if (token.type !== tt.template) { + result += token.type.label; } - start++; - } - return value; - } - // create Template token - function replaceWithTemplateType(start, end) { - var templateToken = { + return result; + }, ""); + + result.push({ type: "Template", - value: createTemplateValue(start, end), - start: tokens[start].start, - end: tokens[end].end, + value: value, + start: start.start, + end: end.end, loc: { - start: tokens[start].loc.start, - end: tokens[end].loc.end, + start: start.loc.start, + end: end.loc.end, }, - }; + }); - // put new token in place of old tokens - tokens.splice(start, end - start + 1, templateToken); + templateTokens = []; } - function trackNumBraces(token) { - if (tokens[token].type === tt.braceL) { - numBraces++; - } else if (tokens[token].type === tt.braceR) { - numBraces--; - } - } + tokens.forEach(token => { + switch (token.type) { + case tt.backQuote: + if (curlyBrace) { + result.push(curlyBrace); + curlyBrace = null; + } - while (startingToken < tokens.length) { - // template start: check if ` or } - if (isTemplateStarter(startingToken) && numBraces === 0) { - if (isBackQuote(startingToken)) { - numBackQuotes++; - } + templateTokens.push(token); - currentToken = startingToken + 1; + if (templateTokens.length > 1) { + addTemplateType(); + } - // check if token after template start is "template" - if ( - currentToken >= tokens.length - 1 || - tokens[currentToken].type !== tt.template - ) { break; - } - // template end: find ` or ${ - while (!isTemplateEnder(currentToken)) { - if (currentToken >= tokens.length - 1) { - break; + case tt.dollarBraceL: + templateTokens.push(token); + addTemplateType(); + break; + + case tt.braceR: + if (curlyBrace) { + result.push(curlyBrace); } - currentToken++; - } - if (isBackQuote(currentToken)) { - numBackQuotes--; - } - // template start and end found: create new token - replaceWithTemplateType(startingToken, currentToken); - } else if (numBackQuotes > 0) { - trackNumBraces(startingToken); + curlyBrace = token; + break; + + case tt.template: + if (curlyBrace) { + templateTokens.push(curlyBrace); + curlyBrace = null; + } + + templateTokens.push(token); + break; + + case tt.eof: + if (curlyBrace) { + result.push(curlyBrace); + } + + break; + + default: + if (curlyBrace) { + result.push(curlyBrace); + curlyBrace = null; + } + + result.push(token); } - startingToken++; - } + }); + + return result; }; diff --git a/eslint/babel-eslint-parser/lib/babylon-to-espree/index.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/index.js index ecd8eee6f1d8..6d6e12bfc086 100644 --- a/eslint/babel-eslint-parser/lib/babylon-to-espree/index.js +++ b/eslint/babel-eslint-parser/lib/babylon-to-espree/index.js @@ -6,11 +6,6 @@ var toTokens = require("./toTokens"); var toAST = require("./toAST"); module.exports = function(ast, traverse, tt, code) { - // remove EOF token, eslint doesn't use this for anything and it interferes - // with some rules see https://github.com/babel/babel-eslint/issues/2 - // todo: find a more elegant way to do this - ast.tokens.pop(); - // convert tokens ast.tokens = toTokens(ast.tokens, tt, code); diff --git a/eslint/babel-eslint-parser/lib/babylon-to-espree/toTokens.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/toTokens.js index a863b871b0a8..bb30819bacf7 100644 --- a/eslint/babel-eslint-parser/lib/babylon-to-espree/toTokens.js +++ b/eslint/babel-eslint-parser/lib/babylon-to-espree/toTokens.js @@ -4,16 +4,7 @@ var convertTemplateType = require("./convertTemplateType"); var toToken = require("./toToken"); module.exports = function(tokens, tt, code) { - // transform tokens to type "Template" - convertTemplateType(tokens, tt); - - var transformedTokens = []; - for (var i = 0; i < tokens.length; i++) { - var token = tokens[i]; - if (token.type !== "CommentLine" && token.type !== "CommentBlock") { - transformedTokens.push(toToken(token, tt, code)); - } - } - - return transformedTokens; + return convertTemplateType(tokens, tt) + .filter(t => t.type !== "CommentLine" && t.type !== "CommentBlock") + .map(t => toToken(t, tt, code)); }; diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index b0a2cd10f2ad..98b7e939288b 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -62,7 +62,7 @@ function parseAndAssertSame(code) { `); throw err; } - // assert.equal(esAST, babylonAST); + //assert.equal(esAST, babylonAST); } describe("babylon-to-espree", () => { @@ -158,6 +158,14 @@ describe("babylon-to-espree", () => { }; `); }); + + it("template with arrow returning template #603", () => { + parseAndAssertSame(` + var a = \`\${() => { + \`\${''}\` + }}\`; + `); + }); }); it("simple expression", () => { diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 687af37cc4c9..af36963e5cf2 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1112,6 +1112,18 @@ describe("verify", () => { ); }); + it("template with arrow returning template #603", () => { + verifyAndAssertMessages( + ` + var a = \`\${() => { + \`\${''}\` + }}\`; + `, + { indent: 1 }, + [] + ); + }); + describe("decorators #72", () => { it("class declaration", () => { verifyAndAssertMessages( From da43afb5deb8453c4e4ce2ee670e81ff2fb3f50e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Pallar=C3=A9s?= Date: Wed, 6 Jun 2018 00:18:13 +0200 Subject: [PATCH 423/569] refactor: rename babylon to @babel/parser --- eslint/babel-eslint-parser/lib/parse.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/lib/parse.js b/eslint/babel-eslint-parser/lib/parse.js index f29e6af155b5..013de92dce06 100644 --- a/eslint/babel-eslint-parser/lib/parse.js +++ b/eslint/babel-eslint-parser/lib/parse.js @@ -1,8 +1,8 @@ "use strict"; var babylonToEspree = require("./babylon-to-espree"); -var parse = require("babylon").parse; -var tt = require("babylon").tokTypes; +var parse = require("@babel/parser").parse; +var tt = require("@babel/parser").tokTypes; var traverse = require("@babel/traverse").default; var codeFrameColumns = require("@babel/code-frame").codeFrameColumns; From 85d8f7047851a7a9063294578712d5dbe40c3c15 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Mon, 11 Jun 2018 08:47:15 -0500 Subject: [PATCH 424/569] Bump Babel deps --- eslint/babel-eslint-parser/lib/parse.js | 2 +- eslint/babel-eslint-parser/package.json | 8 +- eslint/babel-eslint-parser/yarn.lock | 106 ++++++++++++------------ 3 files changed, 60 insertions(+), 56 deletions(-) diff --git a/eslint/babel-eslint-parser/lib/parse.js b/eslint/babel-eslint-parser/lib/parse.js index 013de92dce06..25105ca254bd 100644 --- a/eslint/babel-eslint-parser/lib/parse.js +++ b/eslint/babel-eslint-parser/lib/parse.js @@ -23,7 +23,7 @@ module.exports = function(code, options) { "asyncGenerators", "classConstructorCall", "classProperties", - "decorators", + "decorators-legacy", "doExpressions", "exponentiationOperator", "exportDefaultFrom", diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 62977e549a23..d22222b1ded8 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -11,10 +11,10 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "@babel/code-frame": "7.0.0-beta.44", - "@babel/traverse": "7.0.0-beta.44", - "@babel/types": "7.0.0-beta.44", - "babylon": "7.0.0-beta.44", + "@babel/code-frame": "7.0.0-beta.51", + "@babel/parser": "7.0.0-beta.51", + "@babel/traverse": "7.0.0-beta.51", + "@babel/types": "7.0.0-beta.51", "eslint-scope": "~3.7.1", "eslint-visitor-keys": "^1.0.0" }, diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index 53c3bceda635..0b1731fbaaaa 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -10,19 +10,19 @@ esutils "^2.0.2" js-tokens "^3.0.0" -"@babel/code-frame@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.44.tgz#2a02643368de80916162be70865c97774f3adbd9" +"@babel/code-frame@7.0.0-beta.51": + version "7.0.0-beta.51" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.51.tgz#bd71d9b192af978df915829d39d4094456439a0c" dependencies: - "@babel/highlight" "7.0.0-beta.44" + "@babel/highlight" "7.0.0-beta.51" -"@babel/generator@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0-beta.44.tgz#c7e67b9b5284afcf69b309b50d7d37f3e5033d42" +"@babel/generator@7.0.0-beta.51": + version "7.0.0-beta.51" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0-beta.51.tgz#6c7575ffde761d07485e04baedc0392c6d9e30f6" dependencies: - "@babel/types" "7.0.0-beta.44" + "@babel/types" "7.0.0-beta.51" jsesc "^2.5.1" - lodash "^4.2.0" + lodash "^4.17.5" source-map "^0.5.0" trim-right "^1.0.1" @@ -34,13 +34,13 @@ "@babel/template" "7.0.0-beta.36" "@babel/types" "7.0.0-beta.36" -"@babel/helper-function-name@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.44.tgz#e18552aaae2231100a6e485e03854bc3532d44dd" +"@babel/helper-function-name@7.0.0-beta.51": + version "7.0.0-beta.51" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.51.tgz#21b4874a227cf99ecafcc30a90302da5a2640561" dependencies: - "@babel/helper-get-function-arity" "7.0.0-beta.44" - "@babel/template" "7.0.0-beta.44" - "@babel/types" "7.0.0-beta.44" + "@babel/helper-get-function-arity" "7.0.0-beta.51" + "@babel/template" "7.0.0-beta.51" + "@babel/types" "7.0.0-beta.51" "@babel/helper-get-function-arity@7.0.0-beta.36": version "7.0.0-beta.36" @@ -48,26 +48,30 @@ dependencies: "@babel/types" "7.0.0-beta.36" -"@babel/helper-get-function-arity@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.44.tgz#d03ca6dd2b9f7b0b1e6b32c56c72836140db3a15" +"@babel/helper-get-function-arity@7.0.0-beta.51": + version "7.0.0-beta.51" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.51.tgz#3281b2d045af95c172ce91b20825d85ea4676411" dependencies: - "@babel/types" "7.0.0-beta.44" + "@babel/types" "7.0.0-beta.51" -"@babel/helper-split-export-declaration@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.44.tgz#c0b351735e0fbcb3822c8ad8db4e583b05ebd9dc" +"@babel/helper-split-export-declaration@7.0.0-beta.51": + version "7.0.0-beta.51" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.51.tgz#8a6c3f66c4d265352fc077484f9f6e80a51ab978" dependencies: - "@babel/types" "7.0.0-beta.44" + "@babel/types" "7.0.0-beta.51" -"@babel/highlight@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-beta.44.tgz#18c94ce543916a80553edcdcf681890b200747d5" +"@babel/highlight@7.0.0-beta.51": + version "7.0.0-beta.51" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-beta.51.tgz#e8844ae25a1595ccfd42b89623b4376ca06d225d" dependencies: chalk "^2.0.0" esutils "^2.0.2" js-tokens "^3.0.0" +"@babel/parser@7.0.0-beta.51": + version "7.0.0-beta.51" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.0.0-beta.51.tgz#27cec2df409df60af58270ed8f6aa55409ea86f6" + "@babel/template@7.0.0-beta.36": version "7.0.0-beta.36" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.36.tgz#02e903de5d68bd7899bce3c5b5447e59529abb00" @@ -77,14 +81,14 @@ babylon "7.0.0-beta.36" lodash "^4.2.0" -"@babel/template@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.44.tgz#f8832f4fdcee5d59bf515e595fc5106c529b394f" +"@babel/template@7.0.0-beta.51": + version "7.0.0-beta.51" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.51.tgz#9602a40aebcf357ae9677e2532ef5fc810f5fbff" dependencies: - "@babel/code-frame" "7.0.0-beta.44" - "@babel/types" "7.0.0-beta.44" - babylon "7.0.0-beta.44" - lodash "^4.2.0" + "@babel/code-frame" "7.0.0-beta.51" + "@babel/parser" "7.0.0-beta.51" + "@babel/types" "7.0.0-beta.51" + lodash "^4.17.5" "@babel/traverse@7.0.0-beta.36": version "7.0.0-beta.36" @@ -99,20 +103,20 @@ invariant "^2.2.0" lodash "^4.2.0" -"@babel/traverse@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.44.tgz#a970a2c45477ad18017e2e465a0606feee0d2966" +"@babel/traverse@7.0.0-beta.51": + version "7.0.0-beta.51" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.51.tgz#981daf2cec347a6231d3aa1d9e1803b03aaaa4a8" dependencies: - "@babel/code-frame" "7.0.0-beta.44" - "@babel/generator" "7.0.0-beta.44" - "@babel/helper-function-name" "7.0.0-beta.44" - "@babel/helper-split-export-declaration" "7.0.0-beta.44" - "@babel/types" "7.0.0-beta.44" - babylon "7.0.0-beta.44" + "@babel/code-frame" "7.0.0-beta.51" + "@babel/generator" "7.0.0-beta.51" + "@babel/helper-function-name" "7.0.0-beta.51" + "@babel/helper-split-export-declaration" "7.0.0-beta.51" + "@babel/parser" "7.0.0-beta.51" + "@babel/types" "7.0.0-beta.51" debug "^3.1.0" globals "^11.1.0" invariant "^2.2.0" - lodash "^4.2.0" + lodash "^4.17.5" "@babel/types@7.0.0-beta.36": version "7.0.0-beta.36" @@ -122,12 +126,12 @@ lodash "^4.2.0" to-fast-properties "^2.0.0" -"@babel/types@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.44.tgz#6b1b164591f77dec0a0342aca995f2d046b3a757" +"@babel/types@7.0.0-beta.51": + version "7.0.0-beta.51" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.51.tgz#d802b7b543b5836c778aa691797abf00f3d97ea9" dependencies: esutils "^2.0.2" - lodash "^4.2.0" + lodash "^4.17.5" to-fast-properties "^2.0.0" acorn-jsx@^3.0.0: @@ -234,10 +238,6 @@ babylon@7.0.0-beta.36: version "7.0.0-beta.36" resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.36.tgz#3a3683ba6a9a1e02b0aa507c8e63435e39305b9e" -babylon@7.0.0-beta.44: - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.44.tgz#89159e15e6e30c5096e22d738d8c0af8a0e8ca1d" - balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" @@ -1067,6 +1067,10 @@ lodash@^4.15.0, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0: version "4.17.5" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" +lodash@^4.17.5: + version "4.17.10" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7" + log-symbols@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-1.0.2.tgz#376ff7b58ea3086a0f09facc74617eca501e1a18" From b537da9b53524169dc994e45d533a3e9b90f08a6 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Fri, 15 Jun 2018 16:39:58 -0500 Subject: [PATCH 425/569] Drop node4 in travis --- eslint/babel-eslint-parser/.travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/eslint/babel-eslint-parser/.travis.yml b/eslint/babel-eslint-parser/.travis.yml index ad63884c93b7..d973f98e1b60 100644 --- a/eslint/babel-eslint-parser/.travis.yml +++ b/eslint/babel-eslint-parser/.travis.yml @@ -3,7 +3,6 @@ language: node_js node_js: - "8" - "6" - - "4" matrix: fast_finish: true From 6a6c2bad5071662c7fd4d98521bb0e6309e739f5 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Fri, 22 Jun 2018 11:03:15 -0500 Subject: [PATCH 426/569] Support OptionalMemberExpression with scope too (babel/babel-eslint#634) --- .../babel-eslint-parser/lib/analyze-scope.js | 5 ++ eslint/babel-eslint-parser/package.json | 2 +- eslint/babel-eslint-parser/yarn.lock | 64 ++++++++++++++++++- 3 files changed, 67 insertions(+), 4 deletions(-) diff --git a/eslint/babel-eslint-parser/lib/analyze-scope.js b/eslint/babel-eslint-parser/lib/analyze-scope.js index fb9f4d4e8c09..9b2a40d6dbf4 100644 --- a/eslint/babel-eslint-parser/lib/analyze-scope.js +++ b/eslint/babel-eslint-parser/lib/analyze-scope.js @@ -181,6 +181,11 @@ class Referencer extends OriginalReferencer { this._visitDeclareX(node); } + // visit OptionalMemberExpression as a MemberExpression. + OptionalMemberExpression(node) { + super.MemberExpression(node); + } + _visitClassProperty(node) { this._visitTypeAnnotation(node.typeAnnotation); this.visitProperty(node); diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index d22222b1ded8..cd21bd483288 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -39,7 +39,7 @@ "devDependencies": { "babel-eslint": "^8.0.0", "dedent": "^0.7.0", - "eslint": "npm:eslint@4.13.1", + "eslint": "npm:eslint@4.19.1", "eslint-config-babel": "^7.0.1", "eslint-old": "npm:eslint@4.13.1", "eslint-plugin-flowtype": "^2.30.3", diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index 0b1731fbaaaa..bdad6e39ad94 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -148,6 +148,10 @@ acorn@^5.4.0: version "5.4.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.4.1.tgz#fdc58d9d17f4a4e98d102ded826a9b9759125102" +acorn@^5.5.0: + version "5.7.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.1.tgz#f095829297706a7c9776958c0afc8930a9b9d9d8" + ajv-keywords@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.1.tgz#617997fc5f60576894c435f940d819e135b80762" @@ -434,7 +438,7 @@ doctrine@1.5.0: esutils "^2.0.2" isarray "^1.0.0" -doctrine@^2.0.2: +doctrine@^2.0.2, doctrine@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" dependencies: @@ -472,7 +476,7 @@ eslint-module-utils@^2.1.1: debug "^2.6.8" pkg-dir "^1.0.0" -"eslint-old@npm:eslint@4.13.1", "eslint@npm:eslint@4.13.1": +"eslint-old@npm:eslint@4.13.1": version "4.13.1" resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.13.1.tgz#0055e0014464c7eb7878caf549ef2941992b444f" dependencies: @@ -553,6 +557,49 @@ eslint-visitor-keys@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" +"eslint@npm:eslint@4.19.1": + version "4.19.1" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.19.1.tgz#32d1d653e1d90408854bfb296f076ec7e186a300" + dependencies: + ajv "^5.3.0" + babel-code-frame "^6.22.0" + chalk "^2.1.0" + concat-stream "^1.6.0" + cross-spawn "^5.1.0" + debug "^3.1.0" + doctrine "^2.1.0" + eslint-scope "^3.7.1" + eslint-visitor-keys "^1.0.0" + espree "^3.5.4" + esquery "^1.0.0" + esutils "^2.0.2" + file-entry-cache "^2.0.0" + functional-red-black-tree "^1.0.1" + glob "^7.1.2" + globals "^11.0.1" + ignore "^3.3.3" + imurmurhash "^0.1.4" + inquirer "^3.0.6" + is-resolvable "^1.0.0" + js-yaml "^3.9.1" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.3.0" + lodash "^4.17.4" + minimatch "^3.0.2" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + optionator "^0.8.2" + path-is-inside "^1.0.2" + pluralize "^7.0.0" + progress "^2.0.0" + regexpp "^1.0.1" + require-uncached "^1.0.3" + semver "^5.3.0" + strip-ansi "^4.0.0" + strip-json-comments "~2.0.1" + table "4.0.2" + text-table "~0.2.0" + espree@^3.5.2: version "3.5.3" resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.3.tgz#931e0af64e7fbbed26b050a29daad1fc64799fa6" @@ -560,6 +607,13 @@ espree@^3.5.2: acorn "^5.4.0" acorn-jsx "^3.0.0" +espree@^3.5.4: + version "3.5.4" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.4.tgz#b0f447187c8a8bed944b815a660bddf5deb5d1a7" + dependencies: + acorn "^5.5.0" + acorn-jsx "^3.0.0" + esprima@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" @@ -1382,6 +1436,10 @@ readable-stream@^2.2.2: string_decoder "~1.0.3" util-deprecate "~1.0.1" +regexpp@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-1.1.0.tgz#0e3516dd0b7904f413d2d4193dce4618c3a689ab" + repeating@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" @@ -1596,7 +1654,7 @@ symbol-observable@^0.2.2: version "0.2.4" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-0.2.4.tgz#95a83db26186d6af7e7a18dbd9760a2f86d08f40" -table@^4.0.1: +table@4.0.2, table@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/table/-/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36" dependencies: From 42d07696831c09e3a2fc5fb8266919e167ce827e Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Fri, 22 Jun 2018 11:12:54 -0500 Subject: [PATCH 427/569] Add test for template string with object with template string inside (babel/babel-eslint#639) Closes https://github.com/babel/babel-eslint/pull/538. Fixes https://github.com/babel/babel-eslint/issues/537. Now that https://github.com/babel/babel-eslint/pull/610 has landed, I wanted to make sure this case was covered. --- eslint/babel-eslint-parser/test/babel-eslint.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 98b7e939288b..99b03f25c7ea 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -166,6 +166,10 @@ describe("babylon-to-espree", () => { }}\`; `); }); + + it("template string with object with template string inside", () => { + parseAndAssertSame("`${ { a:`${2}` } }`"); + }); }); it("simple expression", () => { From 92507e598fa62b5da1681d201eb2793252b1f420 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Fri, 22 Jun 2018 13:39:23 -0500 Subject: [PATCH 428/569] 8.2.4 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index cd21bd483288..d0a790bc162d 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "8.2.3", + "version": "8.2.4", "description": "Custom parser for ESLint", "main": "lib/index.js", "files": [ From 9342a5b74c91119e1b20a0ae96b3d1f87272edcd Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Sat, 23 Jun 2018 08:20:08 -0500 Subject: [PATCH 429/569] Revert bump to babel 51 (babel/babel-eslint#640) --- eslint/babel-eslint-parser/.travis.yml | 1 + eslint/babel-eslint-parser/lib/parse.js | 6 +- eslint/babel-eslint-parser/package.json | 8 +- eslint/babel-eslint-parser/yarn.lock | 106 ++++++++++++------------ 4 files changed, 59 insertions(+), 62 deletions(-) diff --git a/eslint/babel-eslint-parser/.travis.yml b/eslint/babel-eslint-parser/.travis.yml index d973f98e1b60..ad63884c93b7 100644 --- a/eslint/babel-eslint-parser/.travis.yml +++ b/eslint/babel-eslint-parser/.travis.yml @@ -3,6 +3,7 @@ language: node_js node_js: - "8" - "6" + - "4" matrix: fast_finish: true diff --git a/eslint/babel-eslint-parser/lib/parse.js b/eslint/babel-eslint-parser/lib/parse.js index 25105ca254bd..f29e6af155b5 100644 --- a/eslint/babel-eslint-parser/lib/parse.js +++ b/eslint/babel-eslint-parser/lib/parse.js @@ -1,8 +1,8 @@ "use strict"; var babylonToEspree = require("./babylon-to-espree"); -var parse = require("@babel/parser").parse; -var tt = require("@babel/parser").tokTypes; +var parse = require("babylon").parse; +var tt = require("babylon").tokTypes; var traverse = require("@babel/traverse").default; var codeFrameColumns = require("@babel/code-frame").codeFrameColumns; @@ -23,7 +23,7 @@ module.exports = function(code, options) { "asyncGenerators", "classConstructorCall", "classProperties", - "decorators-legacy", + "decorators", "doExpressions", "exponentiationOperator", "exportDefaultFrom", diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index d0a790bc162d..1ff8dda5d6bf 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -11,10 +11,10 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "@babel/code-frame": "7.0.0-beta.51", - "@babel/parser": "7.0.0-beta.51", - "@babel/traverse": "7.0.0-beta.51", - "@babel/types": "7.0.0-beta.51", + "@babel/code-frame": "7.0.0-beta.44", + "@babel/traverse": "7.0.0-beta.44", + "@babel/types": "7.0.0-beta.44", + "babylon": "7.0.0-beta.44", "eslint-scope": "~3.7.1", "eslint-visitor-keys": "^1.0.0" }, diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index bdad6e39ad94..35d317871554 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -10,19 +10,19 @@ esutils "^2.0.2" js-tokens "^3.0.0" -"@babel/code-frame@7.0.0-beta.51": - version "7.0.0-beta.51" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.51.tgz#bd71d9b192af978df915829d39d4094456439a0c" +"@babel/code-frame@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.44.tgz#2a02643368de80916162be70865c97774f3adbd9" dependencies: - "@babel/highlight" "7.0.0-beta.51" + "@babel/highlight" "7.0.0-beta.44" -"@babel/generator@7.0.0-beta.51": - version "7.0.0-beta.51" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0-beta.51.tgz#6c7575ffde761d07485e04baedc0392c6d9e30f6" +"@babel/generator@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0-beta.44.tgz#c7e67b9b5284afcf69b309b50d7d37f3e5033d42" dependencies: - "@babel/types" "7.0.0-beta.51" + "@babel/types" "7.0.0-beta.44" jsesc "^2.5.1" - lodash "^4.17.5" + lodash "^4.2.0" source-map "^0.5.0" trim-right "^1.0.1" @@ -34,13 +34,13 @@ "@babel/template" "7.0.0-beta.36" "@babel/types" "7.0.0-beta.36" -"@babel/helper-function-name@7.0.0-beta.51": - version "7.0.0-beta.51" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.51.tgz#21b4874a227cf99ecafcc30a90302da5a2640561" +"@babel/helper-function-name@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.44.tgz#e18552aaae2231100a6e485e03854bc3532d44dd" dependencies: - "@babel/helper-get-function-arity" "7.0.0-beta.51" - "@babel/template" "7.0.0-beta.51" - "@babel/types" "7.0.0-beta.51" + "@babel/helper-get-function-arity" "7.0.0-beta.44" + "@babel/template" "7.0.0-beta.44" + "@babel/types" "7.0.0-beta.44" "@babel/helper-get-function-arity@7.0.0-beta.36": version "7.0.0-beta.36" @@ -48,30 +48,26 @@ dependencies: "@babel/types" "7.0.0-beta.36" -"@babel/helper-get-function-arity@7.0.0-beta.51": - version "7.0.0-beta.51" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.51.tgz#3281b2d045af95c172ce91b20825d85ea4676411" +"@babel/helper-get-function-arity@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.44.tgz#d03ca6dd2b9f7b0b1e6b32c56c72836140db3a15" dependencies: - "@babel/types" "7.0.0-beta.51" + "@babel/types" "7.0.0-beta.44" -"@babel/helper-split-export-declaration@7.0.0-beta.51": - version "7.0.0-beta.51" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.51.tgz#8a6c3f66c4d265352fc077484f9f6e80a51ab978" +"@babel/helper-split-export-declaration@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.44.tgz#c0b351735e0fbcb3822c8ad8db4e583b05ebd9dc" dependencies: - "@babel/types" "7.0.0-beta.51" + "@babel/types" "7.0.0-beta.44" -"@babel/highlight@7.0.0-beta.51": - version "7.0.0-beta.51" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-beta.51.tgz#e8844ae25a1595ccfd42b89623b4376ca06d225d" +"@babel/highlight@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-beta.44.tgz#18c94ce543916a80553edcdcf681890b200747d5" dependencies: chalk "^2.0.0" esutils "^2.0.2" js-tokens "^3.0.0" -"@babel/parser@7.0.0-beta.51": - version "7.0.0-beta.51" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.0.0-beta.51.tgz#27cec2df409df60af58270ed8f6aa55409ea86f6" - "@babel/template@7.0.0-beta.36": version "7.0.0-beta.36" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.36.tgz#02e903de5d68bd7899bce3c5b5447e59529abb00" @@ -81,14 +77,14 @@ babylon "7.0.0-beta.36" lodash "^4.2.0" -"@babel/template@7.0.0-beta.51": - version "7.0.0-beta.51" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.51.tgz#9602a40aebcf357ae9677e2532ef5fc810f5fbff" +"@babel/template@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.44.tgz#f8832f4fdcee5d59bf515e595fc5106c529b394f" dependencies: - "@babel/code-frame" "7.0.0-beta.51" - "@babel/parser" "7.0.0-beta.51" - "@babel/types" "7.0.0-beta.51" - lodash "^4.17.5" + "@babel/code-frame" "7.0.0-beta.44" + "@babel/types" "7.0.0-beta.44" + babylon "7.0.0-beta.44" + lodash "^4.2.0" "@babel/traverse@7.0.0-beta.36": version "7.0.0-beta.36" @@ -103,20 +99,20 @@ invariant "^2.2.0" lodash "^4.2.0" -"@babel/traverse@7.0.0-beta.51": - version "7.0.0-beta.51" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.51.tgz#981daf2cec347a6231d3aa1d9e1803b03aaaa4a8" +"@babel/traverse@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.44.tgz#a970a2c45477ad18017e2e465a0606feee0d2966" dependencies: - "@babel/code-frame" "7.0.0-beta.51" - "@babel/generator" "7.0.0-beta.51" - "@babel/helper-function-name" "7.0.0-beta.51" - "@babel/helper-split-export-declaration" "7.0.0-beta.51" - "@babel/parser" "7.0.0-beta.51" - "@babel/types" "7.0.0-beta.51" + "@babel/code-frame" "7.0.0-beta.44" + "@babel/generator" "7.0.0-beta.44" + "@babel/helper-function-name" "7.0.0-beta.44" + "@babel/helper-split-export-declaration" "7.0.0-beta.44" + "@babel/types" "7.0.0-beta.44" + babylon "7.0.0-beta.44" debug "^3.1.0" globals "^11.1.0" invariant "^2.2.0" - lodash "^4.17.5" + lodash "^4.2.0" "@babel/types@7.0.0-beta.36": version "7.0.0-beta.36" @@ -126,12 +122,12 @@ lodash "^4.2.0" to-fast-properties "^2.0.0" -"@babel/types@7.0.0-beta.51": - version "7.0.0-beta.51" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.51.tgz#d802b7b543b5836c778aa691797abf00f3d97ea9" +"@babel/types@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.44.tgz#6b1b164591f77dec0a0342aca995f2d046b3a757" dependencies: esutils "^2.0.2" - lodash "^4.17.5" + lodash "^4.2.0" to-fast-properties "^2.0.0" acorn-jsx@^3.0.0: @@ -242,6 +238,10 @@ babylon@7.0.0-beta.36: version "7.0.0-beta.36" resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.36.tgz#3a3683ba6a9a1e02b0aa507c8e63435e39305b9e" +babylon@7.0.0-beta.44: + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.44.tgz#89159e15e6e30c5096e22d738d8c0af8a0e8ca1d" + balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" @@ -1121,10 +1121,6 @@ lodash@^4.15.0, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0: version "4.17.5" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" -lodash@^4.17.5: - version "4.17.10" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7" - log-symbols@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-1.0.2.tgz#376ff7b58ea3086a0f09facc74617eca501e1a18" From 8dae11e6d25d87963e402df9d3635e129cb933f3 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Sat, 23 Jun 2018 08:20:40 -0500 Subject: [PATCH 430/569] 8.2.5 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 1ff8dda5d6bf..fddc854a36bf 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "8.2.4", + "version": "8.2.5", "description": "Custom parser for ESLint", "main": "lib/index.js", "files": [ From 4f9e2a5be6c8eec78c85d0722cce1f6a8014c16c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Fri, 29 Jun 2018 14:26:43 +0100 Subject: [PATCH 431/569] Breaking: Upgraded Babel to 7.0.0-beta.51 (babel/babel-eslint#642) * Upgraded Babel to 7.0.0-beta.51, with changes to decorators * Removed support for Node 4 and added it for Node 10 * nit: fix typo [skip ci] --- eslint/babel-eslint-parser/.travis.yml | 2 +- eslint/babel-eslint-parser/lib/parse.js | 11 +- eslint/babel-eslint-parser/package.json | 10 +- .../test/non-regression.js | 112 ++++++++++++++++-- eslint/babel-eslint-parser/yarn.lock | 106 +++++++++-------- 5 files changed, 168 insertions(+), 73 deletions(-) diff --git a/eslint/babel-eslint-parser/.travis.yml b/eslint/babel-eslint-parser/.travis.yml index ad63884c93b7..218432b1103f 100644 --- a/eslint/babel-eslint-parser/.travis.yml +++ b/eslint/babel-eslint-parser/.travis.yml @@ -1,9 +1,9 @@ sudo: false language: node_js node_js: + - "10" - "8" - "6" - - "4" matrix: fast_finish: true diff --git a/eslint/babel-eslint-parser/lib/parse.js b/eslint/babel-eslint-parser/lib/parse.js index f29e6af155b5..67809026456c 100644 --- a/eslint/babel-eslint-parser/lib/parse.js +++ b/eslint/babel-eslint-parser/lib/parse.js @@ -1,12 +1,15 @@ "use strict"; var babylonToEspree = require("./babylon-to-espree"); -var parse = require("babylon").parse; -var tt = require("babylon").tokTypes; +var parse = require("@babel/parser").parse; +var tt = require("@babel/parser").tokTypes; var traverse = require("@babel/traverse").default; var codeFrameColumns = require("@babel/code-frame").codeFrameColumns; module.exports = function(code, options) { + const legacyDecorators = + options.ecmaFeatures && options.ecmaFeatures.legacyDecorators; + var opts = { codeFrame: options.hasOwnProperty("codeFrame") ? options.codeFrame : true, sourceType: options.sourceType, @@ -16,14 +19,14 @@ module.exports = function(code, options) { ranges: true, tokens: true, plugins: [ - "flow", + ["flow", { all: true }], "jsx", "estree", "asyncFunctions", "asyncGenerators", "classConstructorCall", "classProperties", - "decorators", + legacyDecorators ? "decorators-legacy" : "decorators", "doExpressions", "exponentiationOperator", "exportDefaultFrom", diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index fddc854a36bf..8dbe0f65238d 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -11,10 +11,10 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "@babel/code-frame": "7.0.0-beta.44", - "@babel/traverse": "7.0.0-beta.44", - "@babel/types": "7.0.0-beta.44", - "babylon": "7.0.0-beta.44", + "@babel/code-frame": "7.0.0-beta.51", + "@babel/parser": "7.0.0-beta.51", + "@babel/traverse": "7.0.0-beta.51", + "@babel/types": "7.0.0-beta.51", "eslint-scope": "~3.7.1", "eslint-visitor-keys": "^1.0.0" }, @@ -30,7 +30,7 @@ "author": "Sebastian McKenzie ", "license": "MIT", "engines": { - "node": ">=4" + "node": ">=6" }, "bugs": { "url": "https://github.com/babel/babel-eslint/issues" diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index af36963e5cf2..8bafb5547f83 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -476,7 +476,7 @@ describe("verify", () => { ); }); - it("polymorphpic types #109", () => { + it("polymorphic types #109", () => { verifyAndAssertMessages( "export default function groupByEveryN(array: Array, n: number): Array> { n; }", { "no-unused-vars": 1, "no-undef": 1 } @@ -494,7 +494,7 @@ describe("verify", () => { ); }); - it("polymorphpic/generic types for class #123", () => { + it("polymorphic/generic types for class #123", () => { verifyAndAssertMessages( ` class Box { @@ -507,7 +507,7 @@ describe("verify", () => { ); }); - it("polymorphpic/generic types for function #123", () => { + it("polymorphic/generic types for function #123", () => { verifyAndAssertMessages( ` export function identity(value) { @@ -518,7 +518,7 @@ describe("verify", () => { ); }); - it("polymorphpic/generic types for type alias #123", () => { + it("polymorphic/generic types for type alias #123", () => { verifyAndAssertMessages( ` import Bar from './Bar'; @@ -528,7 +528,7 @@ describe("verify", () => { ); }); - it("polymorphpic/generic types - outside of fn scope #123", () => { + it("polymorphic/generic types - outside of fn scope #123", () => { verifyAndAssertMessages( ` export function foo(value) { value; }; @@ -542,7 +542,7 @@ describe("verify", () => { ); }); - it("polymorphpic/generic types - extending unknown #123", () => { + it("polymorphic/generic types - extending unknown #123", () => { verifyAndAssertMessages( ` import Bar from 'bar'; @@ -553,6 +553,16 @@ describe("verify", () => { ); }); + it("polymorphic/generic types - function calls", () => { + verifyAndAssertMessages( + ` + function f(): T {} + f(); + `, + { "no-unused-vars": 1, "no-undef": 1 } + ); + }); + it("support declarations #132", () => { verifyAndAssertMessages( ` @@ -1124,9 +1134,32 @@ describe("verify", () => { ); }); - describe("decorators #72", () => { + describe("decorators #72 (legacy)", () => { + function verifyDecoratorsLegacyAndAssertMessages( + code, + rules, + expectedMessages, + sourceType + ) { + const overrideConfig = { + parserOptions: { + ecmaFeatures: { + legacyDecorators: true, + }, + sourceType, + }, + }; + return verifyAndAssertMessages( + code, + rules, + expectedMessages, + sourceType, + overrideConfig + ); + } + it("class declaration", () => { - verifyAndAssertMessages( + verifyDecoratorsLegacyAndAssertMessages( ` import classDeclaration from 'decorator'; import decoratorParameter from 'decorator'; @@ -1140,7 +1173,7 @@ describe("verify", () => { }); it("method definition", () => { - verifyAndAssertMessages( + verifyDecoratorsLegacyAndAssertMessages( ` import classMethodDeclarationA from 'decorator'; import decoratorParameter from 'decorator'; @@ -1158,7 +1191,7 @@ describe("verify", () => { }); it("method definition get/set", () => { - verifyAndAssertMessages( + verifyDecoratorsLegacyAndAssertMessages( ` import classMethodDeclarationA from 'decorator'; import decoratorParameter from 'decorator'; @@ -1178,7 +1211,7 @@ describe("verify", () => { }); it("object property", () => { - verifyAndAssertMessages( + verifyDecoratorsLegacyAndAssertMessages( ` import classMethodDeclarationA from 'decorator'; import decoratorParameter from 'decorator'; @@ -1197,7 +1230,7 @@ describe("verify", () => { }); it("object property get/set", () => { - verifyAndAssertMessages( + verifyDecoratorsLegacyAndAssertMessages( ` import classMethodDeclarationA from 'decorator'; import decoratorParameter from 'decorator'; @@ -1218,6 +1251,61 @@ describe("verify", () => { }); }); + describe("decorators #72", () => { + it("class declaration", () => { + verifyAndAssertMessages( + ` + import classDeclaration from 'decorator'; + import decoratorParameter from 'decorator'; + export + @classDeclaration((parameter) => parameter) + @classDeclaration(decoratorParameter) + @classDeclaration + class TextareaAutosize {} + `, + { "no-unused-vars": 1 } + ); + }); + + it("method definition", () => { + verifyAndAssertMessages( + ` + import classMethodDeclarationA from 'decorator'; + import decoratorParameter from 'decorator'; + export class TextareaAutosize { + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + methodDeclaration(e) { + e(); + } + } + `, + { "no-unused-vars": 1 } + ); + }); + + it("method definition get/set", () => { + verifyAndAssertMessages( + ` + import classMethodDeclarationA from 'decorator'; + import decoratorParameter from 'decorator'; + export class TextareaAutosize { + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + get bar() { } + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + set bar(val) { val; } + } + `, + { "no-unused-vars": 1 } + ); + }); + }); + it("detects minimal no-unused-vars case #120", () => { verifyAndAssertMessages("var unused;", { "no-unused-vars": 1 }, [ "1:5 'unused' is defined but never used. no-unused-vars", diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index 35d317871554..bdad6e39ad94 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -10,19 +10,19 @@ esutils "^2.0.2" js-tokens "^3.0.0" -"@babel/code-frame@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.44.tgz#2a02643368de80916162be70865c97774f3adbd9" +"@babel/code-frame@7.0.0-beta.51": + version "7.0.0-beta.51" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.51.tgz#bd71d9b192af978df915829d39d4094456439a0c" dependencies: - "@babel/highlight" "7.0.0-beta.44" + "@babel/highlight" "7.0.0-beta.51" -"@babel/generator@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0-beta.44.tgz#c7e67b9b5284afcf69b309b50d7d37f3e5033d42" +"@babel/generator@7.0.0-beta.51": + version "7.0.0-beta.51" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0-beta.51.tgz#6c7575ffde761d07485e04baedc0392c6d9e30f6" dependencies: - "@babel/types" "7.0.0-beta.44" + "@babel/types" "7.0.0-beta.51" jsesc "^2.5.1" - lodash "^4.2.0" + lodash "^4.17.5" source-map "^0.5.0" trim-right "^1.0.1" @@ -34,13 +34,13 @@ "@babel/template" "7.0.0-beta.36" "@babel/types" "7.0.0-beta.36" -"@babel/helper-function-name@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.44.tgz#e18552aaae2231100a6e485e03854bc3532d44dd" +"@babel/helper-function-name@7.0.0-beta.51": + version "7.0.0-beta.51" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.51.tgz#21b4874a227cf99ecafcc30a90302da5a2640561" dependencies: - "@babel/helper-get-function-arity" "7.0.0-beta.44" - "@babel/template" "7.0.0-beta.44" - "@babel/types" "7.0.0-beta.44" + "@babel/helper-get-function-arity" "7.0.0-beta.51" + "@babel/template" "7.0.0-beta.51" + "@babel/types" "7.0.0-beta.51" "@babel/helper-get-function-arity@7.0.0-beta.36": version "7.0.0-beta.36" @@ -48,26 +48,30 @@ dependencies: "@babel/types" "7.0.0-beta.36" -"@babel/helper-get-function-arity@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.44.tgz#d03ca6dd2b9f7b0b1e6b32c56c72836140db3a15" +"@babel/helper-get-function-arity@7.0.0-beta.51": + version "7.0.0-beta.51" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.51.tgz#3281b2d045af95c172ce91b20825d85ea4676411" dependencies: - "@babel/types" "7.0.0-beta.44" + "@babel/types" "7.0.0-beta.51" -"@babel/helper-split-export-declaration@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.44.tgz#c0b351735e0fbcb3822c8ad8db4e583b05ebd9dc" +"@babel/helper-split-export-declaration@7.0.0-beta.51": + version "7.0.0-beta.51" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.51.tgz#8a6c3f66c4d265352fc077484f9f6e80a51ab978" dependencies: - "@babel/types" "7.0.0-beta.44" + "@babel/types" "7.0.0-beta.51" -"@babel/highlight@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-beta.44.tgz#18c94ce543916a80553edcdcf681890b200747d5" +"@babel/highlight@7.0.0-beta.51": + version "7.0.0-beta.51" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-beta.51.tgz#e8844ae25a1595ccfd42b89623b4376ca06d225d" dependencies: chalk "^2.0.0" esutils "^2.0.2" js-tokens "^3.0.0" +"@babel/parser@7.0.0-beta.51": + version "7.0.0-beta.51" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.0.0-beta.51.tgz#27cec2df409df60af58270ed8f6aa55409ea86f6" + "@babel/template@7.0.0-beta.36": version "7.0.0-beta.36" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.36.tgz#02e903de5d68bd7899bce3c5b5447e59529abb00" @@ -77,14 +81,14 @@ babylon "7.0.0-beta.36" lodash "^4.2.0" -"@babel/template@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.44.tgz#f8832f4fdcee5d59bf515e595fc5106c529b394f" +"@babel/template@7.0.0-beta.51": + version "7.0.0-beta.51" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.51.tgz#9602a40aebcf357ae9677e2532ef5fc810f5fbff" dependencies: - "@babel/code-frame" "7.0.0-beta.44" - "@babel/types" "7.0.0-beta.44" - babylon "7.0.0-beta.44" - lodash "^4.2.0" + "@babel/code-frame" "7.0.0-beta.51" + "@babel/parser" "7.0.0-beta.51" + "@babel/types" "7.0.0-beta.51" + lodash "^4.17.5" "@babel/traverse@7.0.0-beta.36": version "7.0.0-beta.36" @@ -99,20 +103,20 @@ invariant "^2.2.0" lodash "^4.2.0" -"@babel/traverse@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.44.tgz#a970a2c45477ad18017e2e465a0606feee0d2966" +"@babel/traverse@7.0.0-beta.51": + version "7.0.0-beta.51" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.51.tgz#981daf2cec347a6231d3aa1d9e1803b03aaaa4a8" dependencies: - "@babel/code-frame" "7.0.0-beta.44" - "@babel/generator" "7.0.0-beta.44" - "@babel/helper-function-name" "7.0.0-beta.44" - "@babel/helper-split-export-declaration" "7.0.0-beta.44" - "@babel/types" "7.0.0-beta.44" - babylon "7.0.0-beta.44" + "@babel/code-frame" "7.0.0-beta.51" + "@babel/generator" "7.0.0-beta.51" + "@babel/helper-function-name" "7.0.0-beta.51" + "@babel/helper-split-export-declaration" "7.0.0-beta.51" + "@babel/parser" "7.0.0-beta.51" + "@babel/types" "7.0.0-beta.51" debug "^3.1.0" globals "^11.1.0" invariant "^2.2.0" - lodash "^4.2.0" + lodash "^4.17.5" "@babel/types@7.0.0-beta.36": version "7.0.0-beta.36" @@ -122,12 +126,12 @@ lodash "^4.2.0" to-fast-properties "^2.0.0" -"@babel/types@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.44.tgz#6b1b164591f77dec0a0342aca995f2d046b3a757" +"@babel/types@7.0.0-beta.51": + version "7.0.0-beta.51" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.51.tgz#d802b7b543b5836c778aa691797abf00f3d97ea9" dependencies: esutils "^2.0.2" - lodash "^4.2.0" + lodash "^4.17.5" to-fast-properties "^2.0.0" acorn-jsx@^3.0.0: @@ -238,10 +242,6 @@ babylon@7.0.0-beta.36: version "7.0.0-beta.36" resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.36.tgz#3a3683ba6a9a1e02b0aa507c8e63435e39305b9e" -babylon@7.0.0-beta.44: - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.44.tgz#89159e15e6e30c5096e22d738d8c0af8a0e8ca1d" - balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" @@ -1121,6 +1121,10 @@ lodash@^4.15.0, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0: version "4.17.5" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" +lodash@^4.17.5: + version "4.17.10" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7" + log-symbols@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-1.0.2.tgz#376ff7b58ea3086a0f09facc74617eca501e1a18" From 28c45078665f7303a27878e0e8f5a54eda5cae39 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Fri, 29 Jun 2018 08:37:18 -0500 Subject: [PATCH 432/569] 9.0.0-beta.1 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 8dbe0f65238d..6db3f8de4ea9 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "8.2.5", + "version": "9.0.0-beta.1", "description": "Custom parser for ESLint", "main": "lib/index.js", "files": [ From dcf55cb730679585708dd838020bd0ef38c55fce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Fri, 6 Jul 2018 14:50:59 +0100 Subject: [PATCH 433/569] Upgrade Babel to v7.0.0-beta.52 (babel/babel-eslint#650) * Upgrade Babel to v7.0.0-beta.52 * Fixed failing test --- eslint/babel-eslint-parser/package.json | 8 +- .../test/non-regression.js | 3 +- eslint/babel-eslint-parser/yarn.lock | 92 +++++++++---------- 3 files changed, 52 insertions(+), 51 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 6db3f8de4ea9..8e0e599626d7 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -11,10 +11,10 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "@babel/code-frame": "7.0.0-beta.51", - "@babel/parser": "7.0.0-beta.51", - "@babel/traverse": "7.0.0-beta.51", - "@babel/types": "7.0.0-beta.51", + "@babel/code-frame": "7.0.0-beta.52", + "@babel/parser": "7.0.0-beta.52", + "@babel/traverse": "7.0.0-beta.52", + "@babel/types": "7.0.0-beta.52", "eslint-scope": "~3.7.1", "eslint-visitor-keys": "^1.0.0" }, diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 8bafb5547f83..5fc30b488098 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -559,7 +559,8 @@ describe("verify", () => { function f(): T {} f(); `, - { "no-unused-vars": 1, "no-undef": 1 } + { "no-unused-vars": 1, "no-undef": 1 }, + ["2:3 'T' is not defined. no-undef"] ); }); diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index bdad6e39ad94..b8e413905452 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -10,17 +10,17 @@ esutils "^2.0.2" js-tokens "^3.0.0" -"@babel/code-frame@7.0.0-beta.51": - version "7.0.0-beta.51" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.51.tgz#bd71d9b192af978df915829d39d4094456439a0c" +"@babel/code-frame@7.0.0-beta.52": + version "7.0.0-beta.52" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.52.tgz#192483bfa0d1e467c101571c21029ccb74af2801" dependencies: - "@babel/highlight" "7.0.0-beta.51" + "@babel/highlight" "7.0.0-beta.52" -"@babel/generator@7.0.0-beta.51": - version "7.0.0-beta.51" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0-beta.51.tgz#6c7575ffde761d07485e04baedc0392c6d9e30f6" +"@babel/generator@7.0.0-beta.52": + version "7.0.0-beta.52" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0-beta.52.tgz#26968f12fad818cd974c849b286b437e1e8ccd91" dependencies: - "@babel/types" "7.0.0-beta.51" + "@babel/types" "7.0.0-beta.52" jsesc "^2.5.1" lodash "^4.17.5" source-map "^0.5.0" @@ -34,13 +34,13 @@ "@babel/template" "7.0.0-beta.36" "@babel/types" "7.0.0-beta.36" -"@babel/helper-function-name@7.0.0-beta.51": - version "7.0.0-beta.51" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.51.tgz#21b4874a227cf99ecafcc30a90302da5a2640561" +"@babel/helper-function-name@7.0.0-beta.52": + version "7.0.0-beta.52" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.52.tgz#a867a58ff571b25772b2d799b32866058573c450" dependencies: - "@babel/helper-get-function-arity" "7.0.0-beta.51" - "@babel/template" "7.0.0-beta.51" - "@babel/types" "7.0.0-beta.51" + "@babel/helper-get-function-arity" "7.0.0-beta.52" + "@babel/template" "7.0.0-beta.52" + "@babel/types" "7.0.0-beta.52" "@babel/helper-get-function-arity@7.0.0-beta.36": version "7.0.0-beta.36" @@ -48,29 +48,29 @@ dependencies: "@babel/types" "7.0.0-beta.36" -"@babel/helper-get-function-arity@7.0.0-beta.51": - version "7.0.0-beta.51" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.51.tgz#3281b2d045af95c172ce91b20825d85ea4676411" +"@babel/helper-get-function-arity@7.0.0-beta.52": + version "7.0.0-beta.52" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.52.tgz#1c0cda58e0b75f45e92eafbd8fe189a4eee92b74" dependencies: - "@babel/types" "7.0.0-beta.51" + "@babel/types" "7.0.0-beta.52" -"@babel/helper-split-export-declaration@7.0.0-beta.51": - version "7.0.0-beta.51" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.51.tgz#8a6c3f66c4d265352fc077484f9f6e80a51ab978" +"@babel/helper-split-export-declaration@7.0.0-beta.52": + version "7.0.0-beta.52" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.52.tgz#4aac4f30ea6384af3676e04b5246727632e460df" dependencies: - "@babel/types" "7.0.0-beta.51" + "@babel/types" "7.0.0-beta.52" -"@babel/highlight@7.0.0-beta.51": - version "7.0.0-beta.51" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-beta.51.tgz#e8844ae25a1595ccfd42b89623b4376ca06d225d" +"@babel/highlight@7.0.0-beta.52": + version "7.0.0-beta.52" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-beta.52.tgz#ef24931432f06155e7bc39cdb8a6b37b4a28b3d0" dependencies: chalk "^2.0.0" esutils "^2.0.2" js-tokens "^3.0.0" -"@babel/parser@7.0.0-beta.51": - version "7.0.0-beta.51" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.0.0-beta.51.tgz#27cec2df409df60af58270ed8f6aa55409ea86f6" +"@babel/parser@7.0.0-beta.52": + version "7.0.0-beta.52" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.0.0-beta.52.tgz#4e935b62cd9bf872bd37bcf1f63d82fe7b0237a2" "@babel/template@7.0.0-beta.36": version "7.0.0-beta.36" @@ -81,13 +81,13 @@ babylon "7.0.0-beta.36" lodash "^4.2.0" -"@babel/template@7.0.0-beta.51": - version "7.0.0-beta.51" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.51.tgz#9602a40aebcf357ae9677e2532ef5fc810f5fbff" +"@babel/template@7.0.0-beta.52": + version "7.0.0-beta.52" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.52.tgz#44e18fac38251f57f92511d6748f095ab02f996e" dependencies: - "@babel/code-frame" "7.0.0-beta.51" - "@babel/parser" "7.0.0-beta.51" - "@babel/types" "7.0.0-beta.51" + "@babel/code-frame" "7.0.0-beta.52" + "@babel/parser" "7.0.0-beta.52" + "@babel/types" "7.0.0-beta.52" lodash "^4.17.5" "@babel/traverse@7.0.0-beta.36": @@ -103,16 +103,16 @@ invariant "^2.2.0" lodash "^4.2.0" -"@babel/traverse@7.0.0-beta.51": - version "7.0.0-beta.51" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.51.tgz#981daf2cec347a6231d3aa1d9e1803b03aaaa4a8" +"@babel/traverse@7.0.0-beta.52": + version "7.0.0-beta.52" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.52.tgz#9b8ba994f7264d9847858ad2feecc2738c5e2ef3" dependencies: - "@babel/code-frame" "7.0.0-beta.51" - "@babel/generator" "7.0.0-beta.51" - "@babel/helper-function-name" "7.0.0-beta.51" - "@babel/helper-split-export-declaration" "7.0.0-beta.51" - "@babel/parser" "7.0.0-beta.51" - "@babel/types" "7.0.0-beta.51" + "@babel/code-frame" "7.0.0-beta.52" + "@babel/generator" "7.0.0-beta.52" + "@babel/helper-function-name" "7.0.0-beta.52" + "@babel/helper-split-export-declaration" "7.0.0-beta.52" + "@babel/parser" "7.0.0-beta.52" + "@babel/types" "7.0.0-beta.52" debug "^3.1.0" globals "^11.1.0" invariant "^2.2.0" @@ -126,9 +126,9 @@ lodash "^4.2.0" to-fast-properties "^2.0.0" -"@babel/types@7.0.0-beta.51": - version "7.0.0-beta.51" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.51.tgz#d802b7b543b5836c778aa691797abf00f3d97ea9" +"@babel/types@7.0.0-beta.52": + version "7.0.0-beta.52" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.52.tgz#a3e5620b1534b253a50abcf2222b520e23b16da2" dependencies: esutils "^2.0.2" lodash "^4.17.5" From a17917810d55b7b49793a5425f955c4d4ad20943 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Fri, 6 Jul 2018 17:20:52 +0100 Subject: [PATCH 434/569] Merge pull request babel/babel-eslint#645 from rubennorte/support-new-flow-syntax-in-scope-analysis Support new flow syntax in scope analysis --- eslint/babel-eslint-parser/test/non-regression.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 5fc30b488098..4c43b29f3f71 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -564,6 +564,17 @@ describe("verify", () => { ); }); + it("polymorphic/generic types - function calls #644", () => { + verifyAndAssertMessages( + ` + import type {Type} from 'Type'; + function f(): T {} + f(); + `, + { "no-unused-vars": 1, "no-undef": 1 } + ); + }); + it("support declarations #132", () => { verifyAndAssertMessages( ` From a1f945805294d1b7b8635ee7af352d88b3a7645a Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Fri, 6 Jul 2018 11:24:45 -0500 Subject: [PATCH 435/569] 9.0.0-beta.2 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 8e0e599626d7..135a5a9e5ee7 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "9.0.0-beta.1", + "version": "9.0.0-beta.2", "description": "Custom parser for ESLint", "main": "lib/index.js", "files": [ From e675cd7445910b7642dbbfa764ec13ac0412b7f6 Mon Sep 17 00:00:00 2001 From: Mark Tse Date: Thu, 12 Jul 2018 09:49:43 -0400 Subject: [PATCH 436/569] chore - fixing eslint-scope to a safe version; resolves babel/babel-eslint#656. (babel/babel-eslint#657) --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 135a5a9e5ee7..3097247907a1 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -15,7 +15,7 @@ "@babel/parser": "7.0.0-beta.52", "@babel/traverse": "7.0.0-beta.52", "@babel/types": "7.0.0-beta.52", - "eslint-scope": "~3.7.1", + "eslint-scope": "3.7.1", "eslint-visitor-keys": "^1.0.0" }, "scripts": { From 098ab73be1be98bb9afd7e44b2813ff2ae6b03b9 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 12 Jul 2018 09:50:30 -0400 Subject: [PATCH 437/569] update lock --- eslint/babel-eslint-parser/yarn.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index b8e413905452..9c4248eb9517 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -546,7 +546,7 @@ eslint-plugin-prettier@^2.1.2: fast-diff "^1.1.1" jest-docblock "^21.0.0" -eslint-scope@^3.7.1, eslint-scope@~3.7.1: +eslint-scope@3.7.1, eslint-scope@^3.7.1, eslint-scope@~3.7.1: version "3.7.1" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" dependencies: From 35c49ddf9756cbf0d6a97fe535e1906ddf0bb2ac Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 12 Jul 2018 09:50:58 -0400 Subject: [PATCH 438/569] 9.0.0-beta.3 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 3097247907a1..e96898619667 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "9.0.0-beta.2", + "version": "9.0.0-beta.3", "description": "Custom parser for ESLint", "main": "lib/index.js", "files": [ From 6ab458b512be9f2ceaece08a34a2c4e33acea693 Mon Sep 17 00:00:00 2001 From: Leo Yin Date: Wed, 22 Aug 2018 04:00:17 +0800 Subject: [PATCH 439/569] build(deps): upgrade @babel/* to 7.0.0-rc.2 (babel/babel-eslint#668) --- eslint/babel-eslint-parser/lib/parse.js | 6 +- eslint/babel-eslint-parser/package.json | 8 +- eslint/babel-eslint-parser/yarn.lock | 126 ++++++++++++------------ 3 files changed, 72 insertions(+), 68 deletions(-) diff --git a/eslint/babel-eslint-parser/lib/parse.js b/eslint/babel-eslint-parser/lib/parse.js index 67809026456c..b416c490e7e0 100644 --- a/eslint/babel-eslint-parser/lib/parse.js +++ b/eslint/babel-eslint-parser/lib/parse.js @@ -26,7 +26,9 @@ module.exports = function(code, options) { "asyncGenerators", "classConstructorCall", "classProperties", - legacyDecorators ? "decorators-legacy" : "decorators", + legacyDecorators + ? "decorators-legacy" + : ["decorators", { decoratorsBeforeExport: false }], "doExpressions", "exponentiationOperator", "exportDefaultFrom", @@ -43,7 +45,7 @@ module.exports = function(code, options) { "bigInt", "optionalCatchBinding", "throwExpressions", - "pipelineOperator", + ["pipelineOperator", { proposal: "minimal" }], "nullishCoalescingOperator", ], }; diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index e96898619667..22a113de1677 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -11,10 +11,10 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "@babel/code-frame": "7.0.0-beta.52", - "@babel/parser": "7.0.0-beta.52", - "@babel/traverse": "7.0.0-beta.52", - "@babel/types": "7.0.0-beta.52", + "@babel/code-frame": "7.0.0-rc.2", + "@babel/parser": "7.0.0-rc.2", + "@babel/traverse": "7.0.0-rc.2", + "@babel/types": "7.0.0-rc.2", "eslint-scope": "3.7.1", "eslint-visitor-keys": "^1.0.0" }, diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index 9c4248eb9517..00e6f39f3622 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -10,19 +10,19 @@ esutils "^2.0.2" js-tokens "^3.0.0" -"@babel/code-frame@7.0.0-beta.52": - version "7.0.0-beta.52" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.52.tgz#192483bfa0d1e467c101571c21029ccb74af2801" +"@babel/code-frame@7.0.0-rc.2": + version "7.0.0-rc.2" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-rc.2.tgz#12b6daeb408238360744649d16c0e9fa7ab3859e" dependencies: - "@babel/highlight" "7.0.0-beta.52" + "@babel/highlight" "7.0.0-rc.2" -"@babel/generator@7.0.0-beta.52": - version "7.0.0-beta.52" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0-beta.52.tgz#26968f12fad818cd974c849b286b437e1e8ccd91" +"@babel/generator@7.0.0-rc.2": + version "7.0.0-rc.2" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0-rc.2.tgz#7aed8fb4ef1bdcc168225096b5b431744ba76bf8" dependencies: - "@babel/types" "7.0.0-beta.52" + "@babel/types" "7.0.0-rc.2" jsesc "^2.5.1" - lodash "^4.17.5" + lodash "^4.17.10" source-map "^0.5.0" trim-right "^1.0.1" @@ -34,13 +34,13 @@ "@babel/template" "7.0.0-beta.36" "@babel/types" "7.0.0-beta.36" -"@babel/helper-function-name@7.0.0-beta.52": - version "7.0.0-beta.52" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.52.tgz#a867a58ff571b25772b2d799b32866058573c450" +"@babel/helper-function-name@7.0.0-rc.2": + version "7.0.0-rc.2" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-rc.2.tgz#ad7bb9df383c5f53e4bf38c0fe0c7f93e6a27729" dependencies: - "@babel/helper-get-function-arity" "7.0.0-beta.52" - "@babel/template" "7.0.0-beta.52" - "@babel/types" "7.0.0-beta.52" + "@babel/helper-get-function-arity" "7.0.0-rc.2" + "@babel/template" "7.0.0-rc.2" + "@babel/types" "7.0.0-rc.2" "@babel/helper-get-function-arity@7.0.0-beta.36": version "7.0.0-beta.36" @@ -48,29 +48,29 @@ dependencies: "@babel/types" "7.0.0-beta.36" -"@babel/helper-get-function-arity@7.0.0-beta.52": - version "7.0.0-beta.52" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.52.tgz#1c0cda58e0b75f45e92eafbd8fe189a4eee92b74" +"@babel/helper-get-function-arity@7.0.0-rc.2": + version "7.0.0-rc.2" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-rc.2.tgz#323cb82e2d805b40c0c36be1dfcb8ffcbd0434f3" dependencies: - "@babel/types" "7.0.0-beta.52" + "@babel/types" "7.0.0-rc.2" -"@babel/helper-split-export-declaration@7.0.0-beta.52": - version "7.0.0-beta.52" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.52.tgz#4aac4f30ea6384af3676e04b5246727632e460df" +"@babel/helper-split-export-declaration@7.0.0-rc.2": + version "7.0.0-rc.2" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-rc.2.tgz#726b2dec4e46baeab32db67caa6e88b6521464f8" dependencies: - "@babel/types" "7.0.0-beta.52" + "@babel/types" "7.0.0-rc.2" -"@babel/highlight@7.0.0-beta.52": - version "7.0.0-beta.52" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-beta.52.tgz#ef24931432f06155e7bc39cdb8a6b37b4a28b3d0" +"@babel/highlight@7.0.0-rc.2": + version "7.0.0-rc.2" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-rc.2.tgz#0af688a69e3709d9cf392e1837cda18c08d34d4f" dependencies: chalk "^2.0.0" esutils "^2.0.2" - js-tokens "^3.0.0" + js-tokens "^4.0.0" -"@babel/parser@7.0.0-beta.52": - version "7.0.0-beta.52" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.0.0-beta.52.tgz#4e935b62cd9bf872bd37bcf1f63d82fe7b0237a2" +"@babel/parser@7.0.0-rc.2": + version "7.0.0-rc.2" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.0.0-rc.2.tgz#a98c01af5834e71d48a5108e3aeeee333cdf26c4" "@babel/template@7.0.0-beta.36": version "7.0.0-beta.36" @@ -81,14 +81,13 @@ babylon "7.0.0-beta.36" lodash "^4.2.0" -"@babel/template@7.0.0-beta.52": - version "7.0.0-beta.52" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.52.tgz#44e18fac38251f57f92511d6748f095ab02f996e" +"@babel/template@7.0.0-rc.2": + version "7.0.0-rc.2" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-rc.2.tgz#53f6be6c1336ddc7744625c9bdca9d10be5d5d72" dependencies: - "@babel/code-frame" "7.0.0-beta.52" - "@babel/parser" "7.0.0-beta.52" - "@babel/types" "7.0.0-beta.52" - lodash "^4.17.5" + "@babel/code-frame" "7.0.0-rc.2" + "@babel/parser" "7.0.0-rc.2" + "@babel/types" "7.0.0-rc.2" "@babel/traverse@7.0.0-beta.36": version "7.0.0-beta.36" @@ -103,20 +102,19 @@ invariant "^2.2.0" lodash "^4.2.0" -"@babel/traverse@7.0.0-beta.52": - version "7.0.0-beta.52" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.52.tgz#9b8ba994f7264d9847858ad2feecc2738c5e2ef3" +"@babel/traverse@7.0.0-rc.2": + version "7.0.0-rc.2" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-rc.2.tgz#6e54ebe82aa1b3b3cf5ec05594bc14d7c59c9766" dependencies: - "@babel/code-frame" "7.0.0-beta.52" - "@babel/generator" "7.0.0-beta.52" - "@babel/helper-function-name" "7.0.0-beta.52" - "@babel/helper-split-export-declaration" "7.0.0-beta.52" - "@babel/parser" "7.0.0-beta.52" - "@babel/types" "7.0.0-beta.52" + "@babel/code-frame" "7.0.0-rc.2" + "@babel/generator" "7.0.0-rc.2" + "@babel/helper-function-name" "7.0.0-rc.2" + "@babel/helper-split-export-declaration" "7.0.0-rc.2" + "@babel/parser" "7.0.0-rc.2" + "@babel/types" "7.0.0-rc.2" debug "^3.1.0" globals "^11.1.0" - invariant "^2.2.0" - lodash "^4.17.5" + lodash "^4.17.10" "@babel/types@7.0.0-beta.36": version "7.0.0-beta.36" @@ -126,12 +124,12 @@ lodash "^4.2.0" to-fast-properties "^2.0.0" -"@babel/types@7.0.0-beta.52": - version "7.0.0-beta.52" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.52.tgz#a3e5620b1534b253a50abcf2222b520e23b16da2" +"@babel/types@7.0.0-rc.2": + version "7.0.0-rc.2" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-rc.2.tgz#8e025b78764cee8751823e308558a3ca144ebd9d" dependencies: esutils "^2.0.2" - lodash "^4.17.5" + lodash "^4.17.10" to-fast-properties "^2.0.0" acorn-jsx@^3.0.0: @@ -548,7 +546,7 @@ eslint-plugin-prettier@^2.1.2: eslint-scope@3.7.1, eslint-scope@^3.7.1, eslint-scope@~3.7.1: version "3.7.1" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" + resolved "http://registry.npm.taobao.org/eslint-scope/download/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" dependencies: esrecurse "^4.1.0" estraverse "^4.1.1" @@ -712,7 +710,7 @@ find-up@^1.0.0: find-up@^2.0.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + resolved "http://registry.npm.taobao.org/find-up/download/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" dependencies: locate-path "^2.0.0" @@ -921,7 +919,7 @@ is-glob@^4.0.0: is-obj@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" + resolved "http://registry.npm.taobao.org/is-obj/download/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" is-observable@^0.2.0: version "0.2.0" @@ -990,6 +988,10 @@ js-tokens@^3.0.0, js-tokens@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" +js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + js-yaml@^3.9.0, js-yaml@^3.9.1: version "3.10.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc" @@ -1121,9 +1123,9 @@ lodash@^4.15.0, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0: version "4.17.5" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" -lodash@^4.17.5: +lodash@^4.17.10: version "4.17.10" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7" + resolved "http://registry.npm.taobao.org/lodash/download/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7" log-symbols@^1.0.2: version "1.0.2" @@ -1198,7 +1200,7 @@ ms@2.0.0: mute-stream@0.0.7: version "0.0.7" - resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" + resolved "http://registry.npm.taobao.org/mute-stream/download/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" natural-compare@^1.4.0: version "1.4.0" @@ -1206,7 +1208,7 @@ natural-compare@^1.4.0: normalize-package-data@^2.3.2: version "2.4.0" - resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f" + resolved "http://registry.npm.taobao.org/normalize-package-data/download/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f" dependencies: hosted-git-info "^2.1.4" is-builtin-module "^1.0.0" @@ -1283,7 +1285,7 @@ ora@^0.2.3: os-tmpdir@~1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + resolved "http://registry.npm.taobao.org/os-tmpdir/download/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" p-finally@^1.0.0: version "1.0.0" @@ -1483,7 +1485,7 @@ restore-cursor@^2.0.0: rimraf@^2.2.8: version "2.6.2" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" + resolved "http://registry.npm.taobao.org/rimraf/download/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" dependencies: glob "^7.0.5" @@ -1671,7 +1673,7 @@ text-table@~0.2.0: through@^2.3.6: version "2.3.8" - resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + resolved "http://registry.npm.taobao.org/through/download/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" tmp@^0.0.33: version "0.0.33" From 57c825eebb3a364a6b47415ad2148f26d2142ab3 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Tue, 21 Aug 2018 15:18:02 -0500 Subject: [PATCH 440/569] Bump some devDeps --- eslint/babel-eslint-parser/package.json | 6 +- eslint/babel-eslint-parser/yarn.lock | 1010 ++++++++++++++++++----- 2 files changed, 821 insertions(+), 195 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 22a113de1677..0599e941be18 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -37,7 +37,7 @@ }, "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { - "babel-eslint": "^8.0.0", + "babel-eslint": "^8.2.6", "dedent": "^0.7.0", "eslint": "npm:eslint@4.19.1", "eslint-config-babel": "^7.0.1", @@ -46,8 +46,8 @@ "eslint-plugin-import": "^2.8.0", "eslint-plugin-prettier": "^2.1.2", "espree": "^3.5.2", - "husky": "^0.14.0", - "lint-staged": "^6.1.1", + "husky": "^1.0.0-rc.13", + "lint-staged": "^7.2.2", "mocha": "^5.0.1", "prettier": "^1.4.4" }, diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index 00e6f39f3622..a3d39e95dc37 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -2,13 +2,11 @@ # yarn lockfile v1 -"@babel/code-frame@7.0.0-beta.36": - version "7.0.0-beta.36" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.36.tgz#2349d7ec04b3a06945ae173280ef8579b63728e4" +"@babel/code-frame@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.44.tgz#2a02643368de80916162be70865c97774f3adbd9" dependencies: - chalk "^2.0.0" - esutils "^2.0.2" - js-tokens "^3.0.0" + "@babel/highlight" "7.0.0-beta.44" "@babel/code-frame@7.0.0-rc.2": version "7.0.0-rc.2" @@ -16,6 +14,16 @@ dependencies: "@babel/highlight" "7.0.0-rc.2" +"@babel/generator@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0-beta.44.tgz#c7e67b9b5284afcf69b309b50d7d37f3e5033d42" + dependencies: + "@babel/types" "7.0.0-beta.44" + jsesc "^2.5.1" + lodash "^4.2.0" + source-map "^0.5.0" + trim-right "^1.0.1" + "@babel/generator@7.0.0-rc.2": version "7.0.0-rc.2" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0-rc.2.tgz#7aed8fb4ef1bdcc168225096b5b431744ba76bf8" @@ -26,13 +34,13 @@ source-map "^0.5.0" trim-right "^1.0.1" -"@babel/helper-function-name@7.0.0-beta.36": - version "7.0.0-beta.36" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.36.tgz#366e3bc35147721b69009f803907c4d53212e88d" +"@babel/helper-function-name@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.44.tgz#e18552aaae2231100a6e485e03854bc3532d44dd" dependencies: - "@babel/helper-get-function-arity" "7.0.0-beta.36" - "@babel/template" "7.0.0-beta.36" - "@babel/types" "7.0.0-beta.36" + "@babel/helper-get-function-arity" "7.0.0-beta.44" + "@babel/template" "7.0.0-beta.44" + "@babel/types" "7.0.0-beta.44" "@babel/helper-function-name@7.0.0-rc.2": version "7.0.0-rc.2" @@ -42,11 +50,11 @@ "@babel/template" "7.0.0-rc.2" "@babel/types" "7.0.0-rc.2" -"@babel/helper-get-function-arity@7.0.0-beta.36": - version "7.0.0-beta.36" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.36.tgz#f5383bac9a96b274828b10d98900e84ee43e32b8" +"@babel/helper-get-function-arity@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.44.tgz#d03ca6dd2b9f7b0b1e6b32c56c72836140db3a15" dependencies: - "@babel/types" "7.0.0-beta.36" + "@babel/types" "7.0.0-beta.44" "@babel/helper-get-function-arity@7.0.0-rc.2": version "7.0.0-rc.2" @@ -54,12 +62,26 @@ dependencies: "@babel/types" "7.0.0-rc.2" +"@babel/helper-split-export-declaration@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.44.tgz#c0b351735e0fbcb3822c8ad8db4e583b05ebd9dc" + dependencies: + "@babel/types" "7.0.0-beta.44" + "@babel/helper-split-export-declaration@7.0.0-rc.2": version "7.0.0-rc.2" resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-rc.2.tgz#726b2dec4e46baeab32db67caa6e88b6521464f8" dependencies: "@babel/types" "7.0.0-rc.2" +"@babel/highlight@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-beta.44.tgz#18c94ce543916a80553edcdcf681890b200747d5" + dependencies: + chalk "^2.0.0" + esutils "^2.0.2" + js-tokens "^3.0.0" + "@babel/highlight@7.0.0-rc.2": version "7.0.0-rc.2" resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-rc.2.tgz#0af688a69e3709d9cf392e1837cda18c08d34d4f" @@ -72,13 +94,13 @@ version "7.0.0-rc.2" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.0.0-rc.2.tgz#a98c01af5834e71d48a5108e3aeeee333cdf26c4" -"@babel/template@7.0.0-beta.36": - version "7.0.0-beta.36" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.36.tgz#02e903de5d68bd7899bce3c5b5447e59529abb00" +"@babel/template@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.44.tgz#f8832f4fdcee5d59bf515e595fc5106c529b394f" dependencies: - "@babel/code-frame" "7.0.0-beta.36" - "@babel/types" "7.0.0-beta.36" - babylon "7.0.0-beta.36" + "@babel/code-frame" "7.0.0-beta.44" + "@babel/types" "7.0.0-beta.44" + babylon "7.0.0-beta.44" lodash "^4.2.0" "@babel/template@7.0.0-rc.2": @@ -89,15 +111,17 @@ "@babel/parser" "7.0.0-rc.2" "@babel/types" "7.0.0-rc.2" -"@babel/traverse@7.0.0-beta.36": - version "7.0.0-beta.36" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.36.tgz#1dc6f8750e89b6b979de5fe44aa993b1a2192261" +"@babel/traverse@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.44.tgz#a970a2c45477ad18017e2e465a0606feee0d2966" dependencies: - "@babel/code-frame" "7.0.0-beta.36" - "@babel/helper-function-name" "7.0.0-beta.36" - "@babel/types" "7.0.0-beta.36" - babylon "7.0.0-beta.36" - debug "^3.0.1" + "@babel/code-frame" "7.0.0-beta.44" + "@babel/generator" "7.0.0-beta.44" + "@babel/helper-function-name" "7.0.0-beta.44" + "@babel/helper-split-export-declaration" "7.0.0-beta.44" + "@babel/types" "7.0.0-beta.44" + babylon "7.0.0-beta.44" + debug "^3.1.0" globals "^11.1.0" invariant "^2.2.0" lodash "^4.2.0" @@ -116,9 +140,9 @@ globals "^11.1.0" lodash "^4.17.10" -"@babel/types@7.0.0-beta.36": - version "7.0.0-beta.36" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.36.tgz#64f2004353de42adb72f9ebb4665fc35b5499d23" +"@babel/types@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.44.tgz#6b1b164591f77dec0a0342aca995f2d046b3a757" dependencies: esutils "^2.0.2" lodash "^4.2.0" @@ -132,6 +156,12 @@ lodash "^4.17.10" to-fast-properties "^2.0.0" +"@samverschueren/stream-to-observable@^0.3.0": + version "0.3.0" + resolved "https://registry.yarnpkg.com/@samverschueren/stream-to-observable/-/stream-to-observable-0.3.0.tgz#ecdf48d532c58ea477acfcab80348424f8d0662f" + dependencies: + any-observable "^0.3.0" + acorn-jsx@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" @@ -183,19 +213,15 @@ ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" -ansi-styles@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88" +ansi-styles@^3.2.0, ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" dependencies: color-convert "^1.9.0" -any-observable@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/any-observable/-/any-observable-0.2.0.tgz#c67870058003579009083f54ac0abafb5c33d242" - -app-root-path@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/app-root-path/-/app-root-path-2.0.1.tgz#cd62dcf8e4fd5a417efc664d2e5b10653c651b46" +any-observable@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/any-observable/-/any-observable-0.3.0.tgz#af933475e5806a67d0d7df090dd5e8bef65d119b" argparse@^1.0.7: version "1.0.10" @@ -203,6 +229,18 @@ argparse@^1.0.7: dependencies: sprintf-js "~1.0.2" +arr-diff@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" + +arr-flatten@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" + +arr-union@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" + array-union@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" @@ -213,10 +251,22 @@ array-uniq@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" +array-unique@^0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" + arrify@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" +assign-symbols@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" + +atob@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" + babel-code-frame@^6.22.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" @@ -225,25 +275,37 @@ babel-code-frame@^6.22.0: esutils "^2.0.2" js-tokens "^3.0.2" -babel-eslint@^8.0.0: - version "8.2.1" - resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-8.2.1.tgz#136888f3c109edc65376c23ebf494f36a3e03951" +babel-eslint@^8.2.6: + version "8.2.6" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-8.2.6.tgz#6270d0c73205628067c0f7ae1693a9e797acefd9" dependencies: - "@babel/code-frame" "7.0.0-beta.36" - "@babel/traverse" "7.0.0-beta.36" - "@babel/types" "7.0.0-beta.36" - babylon "7.0.0-beta.36" - eslint-scope "~3.7.1" + "@babel/code-frame" "7.0.0-beta.44" + "@babel/traverse" "7.0.0-beta.44" + "@babel/types" "7.0.0-beta.44" + babylon "7.0.0-beta.44" + eslint-scope "3.7.1" eslint-visitor-keys "^1.0.0" -babylon@7.0.0-beta.36: - version "7.0.0-beta.36" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.36.tgz#3a3683ba6a9a1e02b0aa507c8e63435e39305b9e" +babylon@7.0.0-beta.44: + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.44.tgz#89159e15e6e30c5096e22d738d8c0af8a0e8ca1d" balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" +base@^0.11.1: + version "0.11.2" + resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" + dependencies: + cache-base "^1.0.1" + class-utils "^0.3.5" + component-emitter "^1.2.1" + define-property "^1.0.0" + isobject "^3.0.1" + mixin-deep "^1.2.0" + pascalcase "^0.1.1" + brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -251,6 +313,21 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" +braces@^2.3.1: + version "2.3.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" + dependencies: + arr-flatten "^1.1.0" + array-unique "^0.3.2" + extend-shallow "^2.0.1" + fill-range "^4.0.0" + isobject "^3.0.1" + repeat-element "^1.1.2" + snapdragon "^0.8.1" + snapdragon-node "^2.0.1" + split-string "^3.0.2" + to-regex "^3.0.1" + browser-stdout@1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" @@ -259,6 +336,20 @@ builtin-modules@^1.0.0, builtin-modules@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" +cache-base@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" + dependencies: + collection-visit "^1.0.0" + component-emitter "^1.2.1" + get-value "^2.0.6" + has-value "^1.0.0" + isobject "^3.0.1" + set-value "^2.0.0" + to-object-path "^0.3.0" + union-value "^1.0.0" + unset-value "^1.0.0" + caller-path@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" @@ -279,26 +370,35 @@ chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" -chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0: - version "2.3.1" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.1.tgz#523fe2678aec7b04e8041909292fe8b17059b796" +chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e" dependencies: - ansi-styles "^3.2.0" + ansi-styles "^3.2.1" escape-string-regexp "^1.0.5" - supports-color "^5.2.0" + supports-color "^5.3.0" chardet@^0.4.0: version "0.4.2" resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2" -ci-info@^1.0.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.1.2.tgz#03561259db48d0474c8bdc90f5b47b068b6bbfb4" +ci-info@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.4.0.tgz#4841d53cad49f11b827b648ebde27a6e189b412f" circular-json@^0.3.1: version "0.3.3" resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" +class-utils@^0.3.5: + version "0.3.6" + resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" + dependencies: + arr-union "^3.1.0" + define-property "^0.2.5" + isobject "^3.0.0" + static-extend "^0.1.1" + cli-cursor@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-1.0.2.tgz#64da3f7d56a54412e59794bd62dc35295e8f2987" @@ -334,23 +434,34 @@ code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" +collection-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" + dependencies: + map-visit "^1.0.0" + object-visit "^1.0.0" + color-convert@^1.9.0: - version "1.9.1" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.1.tgz#c1261107aeb2f294ebffec9ed9ecad529a6097ed" + version "1.9.2" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.2.tgz#49881b8fba67df12a96bdf3f56c0aab9e7913147" dependencies: - color-name "^1.1.1" + color-name "1.1.1" -color-name@^1.1.1: - version "1.1.3" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" +color-name@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.1.tgz#4b1415304cf50028ea81643643bd82ea05803689" commander@2.11.0: version "2.11.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" -commander@^2.11.0, commander@^2.9.0: - version "2.14.1" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.14.1.tgz#2235123e37af8ca3c65df45b026dbd357b01b9aa" +commander@^2.14.1, commander@^2.9.0: + version "2.17.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" + +component-emitter@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.2.1.tgz#137918d6d78283f7df7a6b7c5a63e140e69425e6" concat-map@0.0.1: version "0.0.1" @@ -368,18 +479,21 @@ contains-path@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" +copy-descriptor@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" + core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" -cosmiconfig@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-4.0.0.tgz#760391549580bbd2df1e562bc177b13c290972dc" +cosmiconfig@^5.0.2: + version "5.0.6" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.0.6.tgz#dca6cf680a0bd03589aff684700858c81abeeb39" dependencies: is-directory "^0.3.1" js-yaml "^3.9.0" parse-json "^4.0.0" - require-from-string "^2.0.1" cross-spawn@^5.0.1, cross-spawn@^5.1.0: version "5.1.0" @@ -399,12 +513,16 @@ debug@3.1.0, debug@^3.0.1, debug@^3.1.0: dependencies: ms "2.0.0" -debug@^2.6.8, debug@^2.6.9: +debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" dependencies: ms "2.0.0" +decode-uri-component@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" + dedent@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" @@ -413,6 +531,25 @@ deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" +define-property@^0.2.5: + version "0.2.5" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" + dependencies: + is-descriptor "^0.1.0" + +define-property@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" + dependencies: + is-descriptor "^1.0.0" + +define-property@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" + dependencies: + is-descriptor "^1.0.2" + isobject "^3.0.1" + del@^2.0.2: version "2.2.2" resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8" @@ -446,12 +583,18 @@ elegant-spinner@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/elegant-spinner/-/elegant-spinner-1.0.1.tgz#db043521c95d7e303fd8f345bedc3349cfb0729e" -error-ex@^1.2.0, error-ex@^1.3.1: +error-ex@^1.2.0: version "1.3.1" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.1.tgz#f855a86ce61adc4e8621c3cda21e7a7612c3a8dc" dependencies: is-arrayish "^0.2.1" +error-ex@^1.3.1: + version "1.3.2" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" + dependencies: + is-arrayish "^0.2.1" + escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -544,7 +687,7 @@ eslint-plugin-prettier@^2.1.2: fast-diff "^1.1.1" jest-docblock "^21.0.0" -eslint-scope@3.7.1, eslint-scope@^3.7.1, eslint-scope@~3.7.1: +eslint-scope@3.7.1, eslint-scope@^3.7.1: version "3.7.1" resolved "http://registry.npm.taobao.org/eslint-scope/download/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" dependencies: @@ -613,8 +756,8 @@ espree@^3.5.4: acorn-jsx "^3.0.0" esprima@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" esquery@^1.0.0: version "1.0.0" @@ -623,11 +766,10 @@ esquery@^1.0.0: estraverse "^4.0.0" esrecurse@^4.1.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.0.tgz#fa9568d98d3823f9a41d91e902dcab9ea6e5b163" + version "4.2.1" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" dependencies: estraverse "^4.1.0" - object-assign "^4.0.1" estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: version "4.2.0" @@ -637,9 +779,9 @@ esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" -execa@^0.8.0: - version "0.8.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-0.8.0.tgz#d8d76bbc1b55217ed190fd6dd49d3c774ecfc8da" +execa@^0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.9.0.tgz#adb7ce62cf985071f60580deb4a88b9e34712d01" dependencies: cross-spawn "^5.0.1" get-stream "^3.0.0" @@ -653,6 +795,31 @@ exit-hook@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8" +expand-brackets@^2.1.4: + version "2.1.4" + resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" + dependencies: + debug "^2.3.3" + define-property "^0.2.5" + extend-shallow "^2.0.1" + posix-character-classes "^0.1.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +extend-shallow@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" + dependencies: + is-extendable "^0.1.0" + +extend-shallow@^3.0.0, extend-shallow@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" + dependencies: + assign-symbols "^1.0.0" + is-extendable "^1.0.1" + external-editor@^2.0.4: version "2.1.0" resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.1.0.tgz#3d026a21b7f95b5726387d4200ac160d372c3b48" @@ -661,6 +828,19 @@ external-editor@^2.0.4: iconv-lite "^0.4.17" tmp "^0.0.33" +extglob@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" + dependencies: + array-unique "^0.3.2" + define-property "^1.0.0" + expand-brackets "^2.1.4" + extend-shallow "^2.0.1" + fragment-cache "^0.2.1" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + fast-deep-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz#96256a3bc975595eb36d82e9929d060d893439ff" @@ -697,6 +877,15 @@ file-entry-cache@^2.0.0: flat-cache "^1.2.1" object-assign "^4.0.1" +fill-range@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" + dependencies: + extend-shallow "^2.0.1" + is-number "^3.0.0" + repeat-string "^1.6.1" + to-regex-range "^2.1.0" + find-parent-dir@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/find-parent-dir/-/find-parent-dir-0.3.0.tgz#33c44b429ab2b2f0646299c5f9f718f376ff8d54" @@ -714,6 +903,12 @@ find-up@^2.0.0: dependencies: locate-path "^2.0.0" +find-up@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" + dependencies: + locate-path "^3.0.0" + flat-cache@^1.2.1: version "1.3.0" resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.0.tgz#d3030b32b38154f4e3b7e9c709f490f7ef97c481" @@ -723,6 +918,16 @@ flat-cache@^1.2.1: graceful-fs "^4.1.2" write "^0.2.1" +for-in@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" + +fragment-cache@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" + dependencies: + map-cache "^0.2.2" + fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" @@ -739,10 +944,18 @@ get-own-enumerable-property-symbols@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-2.0.1.tgz#5c4ad87f2834c4b9b4e84549dc1e0650fb38c24b" +get-stdin@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b" + get-stream@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" +get-value@^2.0.3, get-value@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" + glob@7.1.2, glob@^7.0.3, glob@^7.0.5, glob@^7.1.2: version "7.1.2" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" @@ -754,10 +967,14 @@ glob@7.1.2, glob@^7.0.3, glob@^7.0.5, glob@^7.1.2: once "^1.3.0" path-is-absolute "^1.0.0" -globals@^11.0.1, globals@^11.1.0: +globals@^11.0.1: version "11.3.0" resolved "https://registry.yarnpkg.com/globals/-/globals-11.3.0.tgz#e04fdb7b9796d8adac9c8f64c14837b2313378b0" +globals@^11.1.0: + version "11.7.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.7.0.tgz#a583faa43055b1aca771914bf68258e2fc125673" + globby@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d" @@ -791,6 +1008,33 @@ has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" +has-value@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" + dependencies: + get-value "^2.0.3" + has-values "^0.1.4" + isobject "^2.0.0" + +has-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" + dependencies: + get-value "^2.0.6" + has-values "^1.0.0" + isobject "^3.0.0" + +has-values@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" + +has-values@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" + dependencies: + is-number "^3.0.0" + kind-of "^4.0.0" + has@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28" @@ -805,13 +1049,20 @@ hosted-git-info@^2.1.4: version "2.5.0" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.5.0.tgz#6d60e34b3abbc8313062c3b798ef8d901a07af3c" -husky@^0.14.0: - version "0.14.3" - resolved "https://registry.yarnpkg.com/husky/-/husky-0.14.3.tgz#c69ed74e2d2779769a17ba8399b54ce0b63c12c3" - dependencies: - is-ci "^1.0.10" - normalize-path "^1.0.0" - strip-indent "^2.0.0" +husky@^1.0.0-rc.13: + version "1.0.0-rc.13" + resolved "https://registry.yarnpkg.com/husky/-/husky-1.0.0-rc.13.tgz#49c3cc210bfeac24d4ad272f770b7505c9091828" + dependencies: + cosmiconfig "^5.0.2" + execa "^0.9.0" + find-up "^3.0.0" + get-stdin "^6.0.0" + is-ci "^1.1.0" + pkg-dir "^3.0.0" + please-upgrade-node "^3.1.1" + read-pkg "^4.0.1" + run-node "^1.0.0" + slash "^2.0.0" iconv-lite@^0.4.17: version "0.4.19" @@ -866,31 +1117,85 @@ inquirer@^3.0.6: through "^2.3.6" invariant@^2.2.0: - version "2.2.3" - resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.3.tgz#1a827dfde7dcbd7c323f0ca826be8fa7c5e9d688" + version "2.2.4" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" dependencies: loose-envify "^1.0.0" +is-accessor-descriptor@^0.1.6: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" + dependencies: + kind-of "^3.0.2" + +is-accessor-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" + dependencies: + kind-of "^6.0.0" + is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" +is-buffer@^1.1.5: + version "1.1.6" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" + is-builtin-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe" dependencies: builtin-modules "^1.0.0" -is-ci@^1.0.10: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.1.0.tgz#247e4162e7860cebbdaf30b774d6b0ac7dcfe7a5" +is-ci@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.2.0.tgz#3f4a08d6303a09882cef3f0fb97439c5f5ce2d53" + dependencies: + ci-info "^1.3.0" + +is-data-descriptor@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" + dependencies: + kind-of "^3.0.2" + +is-data-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" dependencies: - ci-info "^1.0.0" + kind-of "^6.0.0" + +is-descriptor@^0.1.0: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" + dependencies: + is-accessor-descriptor "^0.1.6" + is-data-descriptor "^0.1.4" + kind-of "^5.0.0" + +is-descriptor@^1.0.0, is-descriptor@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" + dependencies: + is-accessor-descriptor "^1.0.0" + is-data-descriptor "^1.0.0" + kind-of "^6.0.2" is-directory@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/is-directory/-/is-directory-0.3.1.tgz#61339b6f2475fc772fd9c9d83f5c8575dc154ae1" +is-extendable@^0.1.0, is-extendable@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + +is-extendable@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" + dependencies: + is-plain-object "^2.0.4" + is-extglob@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" @@ -917,15 +1222,21 @@ is-glob@^4.0.0: dependencies: is-extglob "^2.1.1" +is-number@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" + dependencies: + kind-of "^3.0.2" + is-obj@^1.0.1: version "1.0.1" - resolved "http://registry.npm.taobao.org/is-obj/download/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" + resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" -is-observable@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/is-observable/-/is-observable-0.2.0.tgz#b361311d83c6e5d726cabf5e250b0237106f5ae2" +is-observable@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-observable/-/is-observable-1.1.0.tgz#b3e986c8f44de950867cab5403f5a3465005975e" dependencies: - symbol-observable "^0.2.2" + symbol-observable "^1.1.0" is-path-cwd@^1.0.0: version "1.0.0" @@ -943,6 +1254,12 @@ is-path-inside@^1.0.0: dependencies: path-is-inside "^1.0.1" +is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + dependencies: + isobject "^3.0.1" + is-promise@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" @@ -959,7 +1276,11 @@ is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" -isarray@^1.0.0, isarray@~1.0.0: +is-windows@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" + +isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" @@ -967,32 +1288,49 @@ isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" +isobject@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" + dependencies: + isarray "1.0.0" + +isobject@^3.0.0, isobject@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + jest-docblock@^21.0.0: version "21.2.0" resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-21.2.0.tgz#51529c3b30d5fd159da60c27ceedc195faf8d414" -jest-get-type@^21.2.0: - version "21.2.0" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-21.2.0.tgz#f6376ab9db4b60d81e39f30749c6c466f40d4a23" +jest-get-type@^22.1.0: + version "22.4.3" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-22.4.3.tgz#e3a8504d8479342dd4420236b322869f18900ce4" -jest-validate@^21.1.0: - version "21.2.1" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-21.2.1.tgz#cc0cbca653cd54937ba4f2a111796774530dd3c7" +jest-validate@^23.5.0: + version "23.5.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-23.5.0.tgz#f5df8f761cf43155e1b2e21d6e9de8a2852d0231" dependencies: chalk "^2.0.1" - jest-get-type "^21.2.0" + jest-get-type "^22.1.0" leven "^2.1.0" - pretty-format "^21.2.1" + pretty-format "^23.5.0" js-tokens@^3.0.0, js-tokens@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" -js-tokens@^4.0.0: +"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" -js-yaml@^3.9.0, js-yaml@^3.9.1: +js-yaml@^3.9.0: + version "3.12.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1" + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + +js-yaml@^3.9.1: version "3.10.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc" dependencies: @@ -1004,8 +1342,8 @@ jsesc@^2.5.1: resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.1.tgz#e421a2a8e20d6b0819df28908f782526b96dd1fe" json-parse-better-errors@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.1.tgz#50183cd1b2d25275de069e9e71b467ac9eab973a" + version "1.0.2" + resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" json-schema-traverse@^0.3.0: version "0.3.1" @@ -1015,6 +1353,26 @@ json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" +kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: + version "3.2.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + dependencies: + is-buffer "^1.1.5" + +kind-of@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" + dependencies: + is-buffer "^1.1.5" + +kind-of@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" + +kind-of@^6.0.0, kind-of@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" + leven@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" @@ -1026,30 +1384,32 @@ levn@^0.3.0, levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" -lint-staged@^6.1.1: - version "6.1.1" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-6.1.1.tgz#cd08c4d9b8ccc2d37198d1c47ce77d22be6cf324" +lint-staged@^7.2.2: + version "7.2.2" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-7.2.2.tgz#0983d55d497f19f36d11ff2c8242b2f56cc2dd05" dependencies: - app-root-path "^2.0.0" - chalk "^2.1.0" - commander "^2.11.0" - cosmiconfig "^4.0.0" + chalk "^2.3.1" + commander "^2.14.1" + cosmiconfig "^5.0.2" debug "^3.1.0" dedent "^0.7.0" - execa "^0.8.0" + execa "^0.9.0" find-parent-dir "^0.3.0" is-glob "^4.0.0" - jest-validate "^21.1.0" - listr "^0.13.0" - lodash "^4.17.4" - log-symbols "^2.0.0" - minimatch "^3.0.0" + is-windows "^1.0.2" + jest-validate "^23.5.0" + listr "^0.14.1" + lodash "^4.17.5" + log-symbols "^2.2.0" + micromatch "^3.1.8" npm-which "^3.0.1" p-map "^1.1.1" path-is-inside "^1.0.2" pify "^3.0.0" - staged-git-files "1.0.0" - stringify-object "^3.2.0" + please-upgrade-node "^3.0.2" + staged-git-files "1.1.1" + string-argv "^0.0.2" + stringify-object "^3.2.2" listr-silent-renderer@^1.1.1: version "1.1.1" @@ -1077,15 +1437,15 @@ listr-verbose-renderer@^0.4.0: date-fns "^1.27.2" figures "^1.7.0" -listr@^0.13.0: - version "0.13.0" - resolved "https://registry.yarnpkg.com/listr/-/listr-0.13.0.tgz#20bb0ba30bae660ee84cc0503df4be3d5623887d" +listr@^0.14.1: + version "0.14.1" + resolved "https://registry.yarnpkg.com/listr/-/listr-0.14.1.tgz#8a7afa4a7135cee4c921d128e0b7dfc6e522d43d" dependencies: - chalk "^1.1.3" + "@samverschueren/stream-to-observable" "^0.3.0" cli-truncate "^0.2.1" figures "^1.7.0" indent-string "^2.1.0" - is-observable "^0.2.0" + is-observable "^1.1.0" is-promise "^2.1.0" is-stream "^1.1.0" listr-silent-renderer "^1.1.1" @@ -1095,8 +1455,7 @@ listr@^0.13.0: log-update "^1.0.2" ora "^0.2.3" p-map "^1.1.1" - rxjs "^5.4.2" - stream-to-observable "^0.2.0" + rxjs "^6.1.0" strip-ansi "^3.0.1" load-json-file@^2.0.0: @@ -1115,15 +1474,22 @@ locate-path@^2.0.0: p-locate "^2.0.0" path-exists "^3.0.0" +locate-path@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" + dependencies: + p-locate "^3.0.0" + path-exists "^3.0.0" + lodash.cond@^4.3.0: version "4.5.2" resolved "https://registry.yarnpkg.com/lodash.cond/-/lodash.cond-4.5.2.tgz#f471a1da486be60f6ab955d17115523dd1d255d5" -lodash@^4.15.0, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0: +lodash@^4.15.0, lodash@^4.3.0: version "4.17.5" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" -lodash@^4.17.10: +lodash@^4.17.10, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.0: version "4.17.10" resolved "http://registry.npm.taobao.org/lodash/download/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7" @@ -1133,7 +1499,7 @@ log-symbols@^1.0.2: dependencies: chalk "^1.0.0" -log-symbols@^2.0.0: +log-symbols@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a" dependencies: @@ -1147,23 +1513,51 @@ log-update@^1.0.2: cli-cursor "^1.0.2" loose-envify@^1.0.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" + version "1.4.0" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" dependencies: - js-tokens "^3.0.0" + js-tokens "^3.0.0 || ^4.0.0" lru-cache@^4.0.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.1.tgz#622e32e82488b49279114a4f9ecf45e7cd6bba55" + version "4.1.3" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.3.tgz#a1175cf3496dfc8436c156c334b4955992bce69c" dependencies: pseudomap "^1.0.2" yallist "^2.1.2" +map-cache@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" + +map-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" + dependencies: + object-visit "^1.0.0" + +micromatch@^3.1.8: + version "3.1.10" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + braces "^2.3.1" + define-property "^2.0.2" + extend-shallow "^3.0.2" + extglob "^2.0.4" + fragment-cache "^0.2.1" + kind-of "^6.0.2" + nanomatch "^1.2.9" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.2" + mimic-fn@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" -minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: +minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" dependencies: @@ -1173,6 +1567,13 @@ minimist@0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" +mixin-deep@^1.2.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.1.tgz#a49e7268dce1a0d9698e45326c5626df3543d0fe" + dependencies: + for-in "^1.0.2" + is-extendable "^1.0.1" + mkdirp@0.5.1, mkdirp@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" @@ -1202,6 +1603,22 @@ mute-stream@0.0.7: version "0.0.7" resolved "http://registry.npm.taobao.org/mute-stream/download/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" +nanomatch@^1.2.9: + version "1.2.13" + resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + define-property "^2.0.2" + extend-shallow "^3.0.2" + fragment-cache "^0.2.1" + is-windows "^1.0.2" + kind-of "^6.0.2" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" @@ -1215,10 +1632,6 @@ normalize-package-data@^2.3.2: semver "2 || 3 || 4 || 5" validate-npm-package-license "^3.0.1" -normalize-path@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-1.0.0.tgz#32d0e472f91ff345701c15a8311018d3b0a90379" - npm-path@^2.0.2: version "2.0.4" resolved "https://registry.yarnpkg.com/npm-path/-/npm-path-2.0.4.tgz#c641347a5ff9d6a09e4d9bce5580c4f505278e64" @@ -1247,6 +1660,26 @@ object-assign@^4.0.1, object-assign@^4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" +object-copy@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" + dependencies: + copy-descriptor "^0.1.0" + define-property "^0.2.5" + kind-of "^3.0.3" + +object-visit@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" + dependencies: + isobject "^3.0.0" + +object.pick@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" + dependencies: + isobject "^3.0.1" + once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" @@ -1255,7 +1688,7 @@ once@^1.3.0: onetime@^1.0.0: version "1.1.0" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789" + resolved "http://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789" onetime@^2.0.0: version "2.0.1" @@ -1297,12 +1730,24 @@ p-limit@^1.1.0: dependencies: p-try "^1.0.0" +p-limit@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.0.0.tgz#e624ed54ee8c460a778b3c9f3670496ff8a57aec" + dependencies: + p-try "^2.0.0" + p-locate@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" dependencies: p-limit "^1.1.0" +p-locate@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" + dependencies: + p-limit "^2.0.0" + p-map@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/p-map/-/p-map-1.2.0.tgz#e4e94f311eabbc8633a1e79908165fca26241b6b" @@ -1311,6 +1756,10 @@ p-try@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" +p-try@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.0.0.tgz#85080bb87c64688fa47996fe8f7dfbe8211760b1" + parse-json@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" @@ -1324,6 +1773,10 @@ parse-json@^4.0.0: error-ex "^1.3.1" json-parse-better-errors "^1.0.1" +pascalcase@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" + path-exists@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" @@ -1380,21 +1833,37 @@ pkg-dir@^1.0.0: dependencies: find-up "^1.0.0" +pkg-dir@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-3.0.0.tgz#2749020f239ed990881b1f71210d51eb6523bea3" + dependencies: + find-up "^3.0.0" + +please-upgrade-node@^3.0.2, please-upgrade-node@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/please-upgrade-node/-/please-upgrade-node-3.1.1.tgz#ed320051dfcc5024fae696712c8288993595e8ac" + dependencies: + semver-compare "^1.0.0" + pluralize@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" +posix-character-classes@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" + prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" prettier@^1.4.4: - version "1.10.2" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.10.2.tgz#1af8356d1842276a99a5b5529c82dd9e9ad3cc93" + version "1.14.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.2.tgz#0ac1c6e1a90baa22a62925f41963c841983282f9" -pretty-format@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-21.2.1.tgz#ae5407f3cf21066cd011aa1ba5fce7b6a2eddb36" +pretty-format@^23.5.0: + version "23.5.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-23.5.0.tgz#0f9601ad9da70fe690a269cd3efca732c210687c" dependencies: ansi-regex "^3.0.0" ansi-styles "^3.2.0" @@ -1426,6 +1895,14 @@ read-pkg@^2.0.0: normalize-package-data "^2.3.2" path-type "^2.0.0" +read-pkg@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-4.0.1.tgz#963625378f3e1c4d48c85872b5a6ec7d5d093237" + dependencies: + normalize-package-data "^2.3.2" + parse-json "^4.0.0" + pify "^3.0.0" + readable-stream@^2.2.2: version "2.3.4" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.4.tgz#c946c3f47fa7d8eabc0b6150f4a12f69a4574071" @@ -1438,20 +1915,31 @@ readable-stream@^2.2.2: string_decoder "~1.0.3" util-deprecate "~1.0.1" +regex-not@^1.0.0, regex-not@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" + dependencies: + extend-shallow "^3.0.2" + safe-regex "^1.1.0" + regexpp@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-1.1.0.tgz#0e3516dd0b7904f413d2d4193dce4618c3a689ab" +repeat-element@^1.1.2: + version "1.1.3" + resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" + +repeat-string@^1.6.1: + version "1.6.1" + resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + repeating@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" dependencies: is-finite "^1.0.0" -require-from-string@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.1.tgz#c545233e9d7da6616e9d59adfb39fc9f588676ff" - require-uncached@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" @@ -1463,6 +1951,10 @@ resolve-from@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" +resolve-url@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" + resolve@^1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36" @@ -1483,6 +1975,10 @@ restore-cursor@^2.0.0: onetime "^2.0.0" signal-exit "^3.0.2" +ret@~0.1.10: + version "0.1.15" + resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" + rimraf@^2.2.8: version "2.6.2" resolved "http://registry.npm.taobao.org/rimraf/download/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" @@ -1495,6 +1991,10 @@ run-async@^2.2.0: dependencies: is-promise "^2.1.0" +run-node@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/run-node/-/run-node-1.0.0.tgz#46b50b946a2aa2d4947ae1d886e9856fd9cabe5e" + rx-lite-aggregates@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz#753b87a89a11c95467c4ac1626c4efc4e05c67be" @@ -1505,20 +2005,48 @@ rx-lite@*, rx-lite@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444" -rxjs@^5.4.2: - version "5.5.6" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.5.6.tgz#e31fb96d6fd2ff1fd84bcea8ae9c02d007179c02" +rxjs@^6.1.0: + version "6.2.2" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.2.2.tgz#eb75fa3c186ff5289907d06483a77884586e1cf9" dependencies: - symbol-observable "1.0.1" + tslib "^1.9.0" safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" +safe-regex@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" + dependencies: + ret "~0.1.10" + +semver-compare@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc" + "semver@2 || 3 || 4 || 5", semver@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" +set-value@^0.4.3: + version "0.4.3" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-0.4.3.tgz#7db08f9d3d22dc7f78e53af3c3bf4666ecdfccf1" + dependencies: + extend-shallow "^2.0.1" + is-extendable "^0.1.1" + is-plain-object "^2.0.1" + to-object-path "^0.3.0" + +set-value@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.0.tgz#71ae4a88f0feefbbf52d1ea604f3fb315ebb6274" + dependencies: + extend-shallow "^2.0.1" + is-extendable "^0.1.1" + is-plain-object "^2.0.3" + split-string "^3.0.1" + shebang-command@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" @@ -1533,6 +2061,10 @@ signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" +slash@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" + slice-ansi@0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" @@ -1543,7 +2075,48 @@ slice-ansi@1.0.0: dependencies: is-fullwidth-code-point "^2.0.0" -source-map@^0.5.0: +snapdragon-node@^2.0.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" + dependencies: + define-property "^1.0.0" + isobject "^3.0.0" + snapdragon-util "^3.0.1" + +snapdragon-util@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/snapdragon-util/-/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" + dependencies: + kind-of "^3.2.0" + +snapdragon@^0.8.1: + version "0.8.2" + resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" + dependencies: + base "^0.11.1" + debug "^2.2.0" + define-property "^0.2.5" + extend-shallow "^2.0.1" + map-cache "^0.2.2" + source-map "^0.5.6" + source-map-resolve "^0.5.0" + use "^3.1.0" + +source-map-resolve@^0.5.0: + version "0.5.2" + resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259" + dependencies: + atob "^2.1.1" + decode-uri-component "^0.2.0" + resolve-url "^0.2.1" + source-map-url "^0.4.0" + urix "^0.1.0" + +source-map-url@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" + +source-map@^0.5.0, source-map@^0.5.6: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" @@ -1561,19 +2134,30 @@ spdx-license-ids@^1.0.2: version "1.2.2" resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz#c9df7a3424594ade6bd11900d596696dc06bac57" +split-string@^3.0.1, split-string@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" + dependencies: + extend-shallow "^3.0.0" + sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" -staged-git-files@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/staged-git-files/-/staged-git-files-1.0.0.tgz#cdb847837c1fcc52c08a872d4883cc0877668a80" +staged-git-files@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/staged-git-files/-/staged-git-files-1.1.1.tgz#37c2218ef0d6d26178b1310719309a16a59f8f7b" -stream-to-observable@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/stream-to-observable/-/stream-to-observable-0.2.0.tgz#59d6ea393d87c2c0ddac10aa0d561bc6ba6f0e10" +static-extend@^0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" dependencies: - any-observable "^0.2.0" + define-property "^0.2.5" + object-copy "^0.1.0" + +string-argv@^0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.0.2.tgz#dac30408690c21f3c3630a3ff3a05877bdcbd736" string-width@^1.0.1: version "1.0.2" @@ -1596,7 +2180,7 @@ string_decoder@~1.0.3: dependencies: safe-buffer "~5.1.0" -stringify-object@^3.2.0: +stringify-object@^3.2.2: version "3.2.2" resolved "https://registry.yarnpkg.com/stringify-object/-/stringify-object-3.2.2.tgz#9853052e5a88fb605a44cd27445aa257ad7ffbcd" dependencies: @@ -1624,10 +2208,6 @@ strip-eof@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" -strip-indent@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-2.0.0.tgz#5ef8db295d01e6ed6cbf7aab96998d7822527b68" - strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" @@ -1642,19 +2222,15 @@ supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" -supports-color@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.2.0.tgz#b0d5333b1184dd3666cbe5aa0b45c5ac7ac17a4a" +supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" dependencies: has-flag "^3.0.0" -symbol-observable@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.1.tgz#8340fc4702c3122df5d22288f88283f513d3fdd4" - -symbol-observable@^0.2.2: - version "0.2.4" - resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-0.2.4.tgz#95a83db26186d6af7e7a18dbd9760a2f86d08f40" +symbol-observable@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" table@4.0.2, table@^4.0.1: version "4.0.2" @@ -1685,10 +2261,36 @@ to-fast-properties@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" +to-object-path@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" + dependencies: + kind-of "^3.0.2" + +to-regex-range@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" + dependencies: + is-number "^3.0.0" + repeat-string "^1.6.1" + +to-regex@^3.0.1, to-regex@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" + dependencies: + define-property "^2.0.2" + extend-shallow "^3.0.2" + regex-not "^1.0.2" + safe-regex "^1.1.0" + trim-right@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" +tslib@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" + type-check@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" @@ -1699,6 +2301,30 @@ typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" +union-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.0.tgz#5c71c34cb5bad5dcebe3ea0cd08207ba5aa1aea4" + dependencies: + arr-union "^3.1.0" + get-value "^2.0.6" + is-extendable "^0.1.1" + set-value "^0.4.3" + +unset-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" + dependencies: + has-value "^0.3.1" + isobject "^3.0.0" + +urix@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" + +use@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" + util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" @@ -1711,8 +2337,8 @@ validate-npm-package-license@^3.0.1: spdx-expression-parse "~1.0.0" which@^1.2.10, which@^1.2.9: - version "1.3.0" - resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a" + version "1.3.1" + resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" dependencies: isexe "^2.0.0" From 2a1c76e070ca9366ae75dc88b46af409927ee88b Mon Sep 17 00:00:00 2001 From: Alexandre Borela Date: Thu, 23 Aug 2018 02:21:45 -0300 Subject: [PATCH 441/569] Add logical assignment plugin (babel/babel-eslint#674) Fix babel/babel-eslint#672 --- eslint/babel-eslint-parser/lib/parse.js | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint/babel-eslint-parser/lib/parse.js b/eslint/babel-eslint-parser/lib/parse.js index b416c490e7e0..b23b9dc9fc75 100644 --- a/eslint/babel-eslint-parser/lib/parse.js +++ b/eslint/babel-eslint-parser/lib/parse.js @@ -47,6 +47,7 @@ module.exports = function(code, options) { "throwExpressions", ["pipelineOperator", { proposal: "minimal" }], "nullishCoalescingOperator", + "logicalAssignment", ], }; From c456fdddd71198827c4a78ae389e8472db59b5d6 Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Thu, 23 Aug 2018 06:23:06 +0100 Subject: [PATCH 442/569] Docs: Make the default parserOptions more explicit (babel/babel-eslint#673) In particular, previously the `.eslintrc` example implied that the default value for `codeFrame` was `false`, when in fact it is `true`: https://github.com/babel/babel-eslint/blob/v9.0.0-beta.3/lib/parse.js#L14 --- eslint/babel-eslint-parser/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index 4dbfc84f072b..6a4f9085e3ac 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -79,9 +79,9 @@ Check out the [ESLint docs](http://eslint.org/docs/rules/) for all possible rule ### Configuration -`sourceType` can be set to `'module'`(default) or `'script'` if your code isn't using ECMAScript modules. -`allowImportExportEverywhere` can be set to true to allow import and export declarations to appear anywhere a statement is allowed if your build environment supports that. By default, import and export declarations can only appear at a program's top level. -`codeFrame` can be set to false to disable the code frame in the reporter. This is useful since some eslint formatters don't play well with it. +- `sourceType` can be set to `'module'`(default) or `'script'` if your code isn't using ECMAScript modules. +- `allowImportExportEverywhere` (default `false`) can be set to `true` to allow import and export declarations to appear anywhere a statement is allowed if your build environment supports that. Otherwise import and export declarations can only appear at a program's top level. +- `codeFrame` (default `true`) can be set to `false` to disable the code frame in the reporter. This is useful since some eslint formatters don't play well with it. **.eslintrc** @@ -91,7 +91,7 @@ Check out the [ESLint docs](http://eslint.org/docs/rules/) for all possible rule "parserOptions": { "sourceType": "module", "allowImportExportEverywhere": false, - "codeFrame": false + "codeFrame": true } } ``` From b6a7601e4a5bb2c4047cc4deec7a16eec0d8edeb Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Mon, 27 Aug 2018 17:04:26 -0500 Subject: [PATCH 443/569] =?UTF-8?q?Bump=20to=20babel@7.0.0=20=F0=9F=8E=89?= =?UTF-8?q?=20(babel/babel-eslint#676)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- eslint/babel-eslint-parser/package.json | 8 +-- eslint/babel-eslint-parser/yarn.lock | 94 ++++++++++++------------- 2 files changed, 51 insertions(+), 51 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 0599e941be18..f4ca955af68b 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -11,10 +11,10 @@ "url": "https://github.com/babel/babel-eslint.git" }, "dependencies": { - "@babel/code-frame": "7.0.0-rc.2", - "@babel/parser": "7.0.0-rc.2", - "@babel/traverse": "7.0.0-rc.2", - "@babel/types": "7.0.0-rc.2", + "@babel/code-frame": "^7.0.0", + "@babel/parser": "^7.0.0", + "@babel/traverse": "^7.0.0", + "@babel/types": "^7.0.0", "eslint-scope": "3.7.1", "eslint-visitor-keys": "^1.0.0" }, diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index a3d39e95dc37..d6f8fae16604 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -8,11 +8,11 @@ dependencies: "@babel/highlight" "7.0.0-beta.44" -"@babel/code-frame@7.0.0-rc.2": - version "7.0.0-rc.2" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-rc.2.tgz#12b6daeb408238360744649d16c0e9fa7ab3859e" +"@babel/code-frame@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0.tgz#06e2ab19bdb535385559aabb5ba59729482800f8" dependencies: - "@babel/highlight" "7.0.0-rc.2" + "@babel/highlight" "^7.0.0" "@babel/generator@7.0.0-beta.44": version "7.0.0-beta.44" @@ -24,11 +24,11 @@ source-map "^0.5.0" trim-right "^1.0.1" -"@babel/generator@7.0.0-rc.2": - version "7.0.0-rc.2" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0-rc.2.tgz#7aed8fb4ef1bdcc168225096b5b431744ba76bf8" +"@babel/generator@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0.tgz#1efd58bffa951dc846449e58ce3a1d7f02d393aa" dependencies: - "@babel/types" "7.0.0-rc.2" + "@babel/types" "^7.0.0" jsesc "^2.5.1" lodash "^4.17.10" source-map "^0.5.0" @@ -42,13 +42,13 @@ "@babel/template" "7.0.0-beta.44" "@babel/types" "7.0.0-beta.44" -"@babel/helper-function-name@7.0.0-rc.2": - version "7.0.0-rc.2" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-rc.2.tgz#ad7bb9df383c5f53e4bf38c0fe0c7f93e6a27729" +"@babel/helper-function-name@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0.tgz#a68cc8d04420ccc663dd258f9cc41b8261efa2d4" dependencies: - "@babel/helper-get-function-arity" "7.0.0-rc.2" - "@babel/template" "7.0.0-rc.2" - "@babel/types" "7.0.0-rc.2" + "@babel/helper-get-function-arity" "^7.0.0" + "@babel/template" "^7.0.0" + "@babel/types" "^7.0.0" "@babel/helper-get-function-arity@7.0.0-beta.44": version "7.0.0-beta.44" @@ -56,11 +56,11 @@ dependencies: "@babel/types" "7.0.0-beta.44" -"@babel/helper-get-function-arity@7.0.0-rc.2": - version "7.0.0-rc.2" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-rc.2.tgz#323cb82e2d805b40c0c36be1dfcb8ffcbd0434f3" +"@babel/helper-get-function-arity@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz#83572d4320e2a4657263734113c42868b64e49c3" dependencies: - "@babel/types" "7.0.0-rc.2" + "@babel/types" "^7.0.0" "@babel/helper-split-export-declaration@7.0.0-beta.44": version "7.0.0-beta.44" @@ -68,11 +68,11 @@ dependencies: "@babel/types" "7.0.0-beta.44" -"@babel/helper-split-export-declaration@7.0.0-rc.2": - version "7.0.0-rc.2" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-rc.2.tgz#726b2dec4e46baeab32db67caa6e88b6521464f8" +"@babel/helper-split-export-declaration@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0.tgz#3aae285c0311c2ab095d997b8c9a94cad547d813" dependencies: - "@babel/types" "7.0.0-rc.2" + "@babel/types" "^7.0.0" "@babel/highlight@7.0.0-beta.44": version "7.0.0-beta.44" @@ -82,17 +82,17 @@ esutils "^2.0.2" js-tokens "^3.0.0" -"@babel/highlight@7.0.0-rc.2": - version "7.0.0-rc.2" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-rc.2.tgz#0af688a69e3709d9cf392e1837cda18c08d34d4f" +"@babel/highlight@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0.tgz#f710c38c8d458e6dd9a201afb637fcb781ce99e4" dependencies: chalk "^2.0.0" esutils "^2.0.2" js-tokens "^4.0.0" -"@babel/parser@7.0.0-rc.2": - version "7.0.0-rc.2" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.0.0-rc.2.tgz#a98c01af5834e71d48a5108e3aeeee333cdf26c4" +"@babel/parser@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.0.0.tgz#697655183394facffb063437ddf52c0277698775" "@babel/template@7.0.0-beta.44": version "7.0.0-beta.44" @@ -103,13 +103,13 @@ babylon "7.0.0-beta.44" lodash "^4.2.0" -"@babel/template@7.0.0-rc.2": - version "7.0.0-rc.2" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-rc.2.tgz#53f6be6c1336ddc7744625c9bdca9d10be5d5d72" +"@babel/template@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0.tgz#c2bc9870405959c89a9c814376a2ecb247838c80" dependencies: - "@babel/code-frame" "7.0.0-rc.2" - "@babel/parser" "7.0.0-rc.2" - "@babel/types" "7.0.0-rc.2" + "@babel/code-frame" "^7.0.0" + "@babel/parser" "^7.0.0" + "@babel/types" "^7.0.0" "@babel/traverse@7.0.0-beta.44": version "7.0.0-beta.44" @@ -126,16 +126,16 @@ invariant "^2.2.0" lodash "^4.2.0" -"@babel/traverse@7.0.0-rc.2": - version "7.0.0-rc.2" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-rc.2.tgz#6e54ebe82aa1b3b3cf5ec05594bc14d7c59c9766" - dependencies: - "@babel/code-frame" "7.0.0-rc.2" - "@babel/generator" "7.0.0-rc.2" - "@babel/helper-function-name" "7.0.0-rc.2" - "@babel/helper-split-export-declaration" "7.0.0-rc.2" - "@babel/parser" "7.0.0-rc.2" - "@babel/types" "7.0.0-rc.2" +"@babel/traverse@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0.tgz#b1fe9b6567fdf3ab542cfad6f3b31f854d799a61" + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/generator" "^7.0.0" + "@babel/helper-function-name" "^7.0.0" + "@babel/helper-split-export-declaration" "^7.0.0" + "@babel/parser" "^7.0.0" + "@babel/types" "^7.0.0" debug "^3.1.0" globals "^11.1.0" lodash "^4.17.10" @@ -148,9 +148,9 @@ lodash "^4.2.0" to-fast-properties "^2.0.0" -"@babel/types@7.0.0-rc.2": - version "7.0.0-rc.2" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-rc.2.tgz#8e025b78764cee8751823e308558a3ca144ebd9d" +"@babel/types@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0.tgz#6e191793d3c854d19c6749989e3bc55f0e962118" dependencies: esutils "^2.0.2" lodash "^4.17.10" From dae75e18532972abf6bd45ad4fb43101aca1b275 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 27 Aug 2018 18:09:21 -0400 Subject: [PATCH 444/569] 9.0.0 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index f4ca955af68b..2e5fbc206c92 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "9.0.0-beta.3", + "version": "9.0.0", "description": "Custom parser for ESLint", "main": "lib/index.js", "files": [ From 990ea0f1ae78ed61c77f3db4b0a57b22e0a36f72 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Tue, 25 Sep 2018 13:07:46 -0500 Subject: [PATCH 445/569] Drop old monkeypatching behavior (babel/babel-eslint#689) An alternative to adding a direct dep on estraverse (https://github.com/babel/babel-eslint/pull/685), let's just drop the old monkeypatching behavior. Closes babel/babel-eslint#685, Closes babel/babel-eslint#680 --- eslint/babel-eslint-parser/lib/index.js | 5 +- .../lib/parse-with-patch.js | 9 - .../lib/patch-eslint-scope.js | 374 ------------------ eslint/babel-eslint-parser/package.json | 3 +- .../test/fixtures/use-eslint-old.js | 12 - .../babel-eslint-parser/test/integration.js | 1 + eslint/babel-eslint-parser/yarn.lock | 50 +-- 7 files changed, 7 insertions(+), 447 deletions(-) delete mode 100644 eslint/babel-eslint-parser/lib/parse-with-patch.js delete mode 100644 eslint/babel-eslint-parser/lib/patch-eslint-scope.js delete mode 100644 eslint/babel-eslint-parser/test/fixtures/use-eslint-old.js diff --git a/eslint/babel-eslint-parser/lib/index.js b/eslint/babel-eslint-parser/lib/index.js index c4655280afad..9e527d26d7f8 100644 --- a/eslint/babel-eslint-parser/lib/index.js +++ b/eslint/babel-eslint-parser/lib/index.js @@ -11,10 +11,7 @@ exports.parseForESLint = function(code, options) { options.allowImportExportEverywhere = options.allowImportExportEverywhere || false; - if (options.eslintVisitorKeys && options.eslintScopeManager) { - return require("./parse-with-scope")(code, options); - } - return { ast: require("./parse-with-patch")(code, options) }; + return require("./parse-with-scope")(code, options); }; exports.parseNoPatch = function(code, options) { diff --git a/eslint/babel-eslint-parser/lib/parse-with-patch.js b/eslint/babel-eslint-parser/lib/parse-with-patch.js deleted file mode 100644 index ba1b95b5b107..000000000000 --- a/eslint/babel-eslint-parser/lib/parse-with-patch.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -var parse = require("./parse"); -var patchEscope = require("./patch-eslint-scope"); - -module.exports = function(code, options) { - patchEscope(options); - return parse(code, options); -}; diff --git a/eslint/babel-eslint-parser/lib/patch-eslint-scope.js b/eslint/babel-eslint-parser/lib/patch-eslint-scope.js deleted file mode 100644 index 2bf2b350ff03..000000000000 --- a/eslint/babel-eslint-parser/lib/patch-eslint-scope.js +++ /dev/null @@ -1,374 +0,0 @@ -"use strict"; - -var Module = require("module"); -var path = require("path"); -var t = require("@babel/types"); - -function getModules() { - try { - // avoid importing a local copy of eslint, try to find a peer dependency - var eslintLoc = Module._resolveFilename("eslint", module.parent); - } catch (err) { - try { - // avoids breaking in jest where module.parent is undefined - eslintLoc = require.resolve("eslint"); - } catch (err) { - throw new ReferenceError("couldn't resolve eslint"); - } - } - - // get modules relative to what eslint will load - var eslintMod = new Module(eslintLoc); - eslintMod.filename = eslintLoc; - eslintMod.paths = Module._nodeModulePaths(path.dirname(eslintLoc)); - - try { - var escope = eslintMod.require("eslint-scope"); - var Definition = eslintMod.require("eslint-scope/lib/definition") - .Definition; - var referencer = eslintMod.require("eslint-scope/lib/referencer"); - } catch (err) { - escope = eslintMod.require("escope"); - Definition = eslintMod.require("escope/lib/definition").Definition; - referencer = eslintMod.require("escope/lib/referencer"); - } - - var estraverse = eslintMod.require("estraverse"); - - if (referencer.__esModule) referencer = referencer.default; - - return { - Definition, - escope, - estraverse, - referencer, - }; -} - -function monkeypatch(modules) { - var Definition = modules.Definition; - var escope = modules.escope; - var estraverse = modules.estraverse; - var referencer = modules.referencer; - - Object.assign(estraverse.VisitorKeys, t.VISITOR_KEYS); - estraverse.VisitorKeys.MethodDefinition.push("decorators"); - estraverse.VisitorKeys.Property.push("decorators"); - - // if there are decorators, then visit each - function visitDecorators(node) { - if (!node.decorators) { - return; - } - for (var i = 0; i < node.decorators.length; i++) { - if (node.decorators[i].expression) { - this.visit(node.decorators[i]); - } - } - } - - // iterate through part of t.VISITOR_KEYS - var flowFlippedAliasKeys = t.FLIPPED_ALIAS_KEYS.Flow.concat([ - "ArrayPattern", - "ClassDeclaration", - "ClassExpression", - "FunctionDeclaration", - "FunctionExpression", - "Identifier", - "ObjectPattern", - "RestElement", - ]); - var visitorKeysMap = Object.keys(t.VISITOR_KEYS).reduce(function(acc, key) { - var value = t.VISITOR_KEYS[key]; - if (flowFlippedAliasKeys.indexOf(value) === -1) { - acc[key] = value; - } - return acc; - }, {}); - - var propertyTypes = { - // loops - callProperties: { type: "loop", values: ["value"] }, - indexers: { type: "loop", values: ["key", "value"] }, - properties: { type: "loop", values: ["argument", "value"] }, - types: { type: "loop" }, - params: { type: "loop" }, - // single property - argument: { type: "single" }, - elementType: { type: "single" }, - qualification: { type: "single" }, - rest: { type: "single" }, - returnType: { type: "single" }, - // others - typeAnnotation: { type: "typeAnnotation" }, - typeParameters: { type: "typeParameters" }, - id: { type: "id" }, - }; - - function visitTypeAnnotation(node) { - // get property to check (params, id, etc...) - var visitorValues = visitorKeysMap[node.type]; - if (!visitorValues) { - return; - } - - // can have multiple properties - for (var i = 0; i < visitorValues.length; i++) { - var visitorValue = visitorValues[i]; - var propertyType = propertyTypes[visitorValue]; - var nodeProperty = node[visitorValue]; - // check if property or type is defined - if (propertyType == null || nodeProperty == null) { - continue; - } - if (propertyType.type === "loop") { - for (var j = 0; j < nodeProperty.length; j++) { - if (Array.isArray(propertyType.values)) { - for (var k = 0; k < propertyType.values.length; k++) { - var loopPropertyNode = nodeProperty[j][propertyType.values[k]]; - if (loopPropertyNode) { - checkIdentifierOrVisit.call(this, loopPropertyNode); - } - } - } else { - checkIdentifierOrVisit.call(this, nodeProperty[j]); - } - } - } else if (propertyType.type === "single") { - checkIdentifierOrVisit.call(this, nodeProperty); - } else if (propertyType.type === "typeAnnotation") { - visitTypeAnnotation.call(this, node.typeAnnotation); - } else if (propertyType.type === "typeParameters") { - for (var l = 0; l < node.typeParameters.params.length; l++) { - checkIdentifierOrVisit.call(this, node.typeParameters.params[l]); - } - } else if (propertyType.type === "id") { - if (node.id.type === "Identifier") { - checkIdentifierOrVisit.call(this, node.id); - } else { - visitTypeAnnotation.call(this, node.id); - } - } - } - } - - function checkIdentifierOrVisit(node) { - if (node.typeAnnotation) { - visitTypeAnnotation.call(this, node.typeAnnotation); - } else if (node.type === "Identifier") { - this.visit(node); - } else { - visitTypeAnnotation.call(this, node); - } - } - - function nestTypeParamScope(manager, node) { - var parentScope = manager.__currentScope; - var scope = new escope.Scope( - manager, - "type-parameters", - parentScope, - node, - false - ); - manager.__nestScope(scope); - for (var j = 0; j < node.typeParameters.params.length; j++) { - var name = node.typeParameters.params[j]; - scope.__define(name, new Definition("TypeParameter", name, name)); - if (name.typeAnnotation) { - checkIdentifierOrVisit.call(this, name); - } - } - scope.__define = function() { - return parentScope.__define.apply(parentScope, arguments); - }; - return scope; - } - - // visit decorators that are in: ClassDeclaration / ClassExpression - var visitClass = referencer.prototype.visitClass; - referencer.prototype.visitClass = function(node) { - visitDecorators.call(this, node); - var typeParamScope; - if (node.typeParameters) { - typeParamScope = nestTypeParamScope.call(this, this.scopeManager, node); - } - // visit flow type: ClassImplements - if (node.implements) { - for (var i = 0; i < node.implements.length; i++) { - checkIdentifierOrVisit.call(this, node.implements[i]); - } - } - if (node.superTypeParameters) { - for (var k = 0; k < node.superTypeParameters.params.length; k++) { - checkIdentifierOrVisit.call(this, node.superTypeParameters.params[k]); - } - } - visitClass.call(this, node); - if (typeParamScope) { - this.close(node); - } - }; - - // visit decorators that are in: Property / MethodDefinition - var visitProperty = referencer.prototype.visitProperty; - referencer.prototype.visitProperty = function(node) { - if (node.value && node.value.type === "TypeCastExpression") { - visitTypeAnnotation.call(this, node.value); - } - visitDecorators.call(this, node); - visitProperty.call(this, node); - }; - - function visitClassProperty(node) { - if (node.typeAnnotation) { - visitTypeAnnotation.call(this, node.typeAnnotation); - } - this.visitProperty(node); - } - - // visit ClassProperty as a Property. - referencer.prototype.ClassProperty = visitClassProperty; - - // visit ClassPrivateProperty as a Property. - referencer.prototype.ClassPrivateProperty = visitClassProperty; - - // visit OptionalMemberExpression as a MemberExpression. - referencer.prototype.OptionalMemberExpression = - referencer.prototype.MemberExpression; - - // visit flow type in FunctionDeclaration, FunctionExpression, ArrowFunctionExpression - var visitFunction = referencer.prototype.visitFunction; - referencer.prototype.visitFunction = function(node) { - var typeParamScope; - if (node.typeParameters) { - typeParamScope = nestTypeParamScope.call(this, this.scopeManager, node); - } - if (node.returnType) { - checkIdentifierOrVisit.call(this, node.returnType); - } - // only visit if function parameters have types - if (node.params) { - for (var i = 0; i < node.params.length; i++) { - var param = node.params[i]; - if (param.typeAnnotation) { - checkIdentifierOrVisit.call(this, param); - } else if (t.isAssignmentPattern(param)) { - if (param.left.typeAnnotation) { - checkIdentifierOrVisit.call(this, param.left); - } - } - } - } - // set ArrayPattern/ObjectPattern visitor keys back to their original. otherwise - // escope will traverse into them and include the identifiers within as declarations - estraverse.VisitorKeys.ObjectPattern = ["properties"]; - estraverse.VisitorKeys.ArrayPattern = ["elements"]; - visitFunction.call(this, node); - // set them back to normal... - estraverse.VisitorKeys.ObjectPattern = t.VISITOR_KEYS.ObjectPattern; - estraverse.VisitorKeys.ArrayPattern = t.VISITOR_KEYS.ArrayPattern; - if (typeParamScope) { - this.close(node); - } - }; - - // visit flow type in VariableDeclaration - var variableDeclaration = referencer.prototype.VariableDeclaration; - referencer.prototype.VariableDeclaration = function(node) { - if (node.declarations) { - for (var i = 0; i < node.declarations.length; i++) { - var id = node.declarations[i].id; - var typeAnnotation = id.typeAnnotation; - if (typeAnnotation) { - checkIdentifierOrVisit.call(this, typeAnnotation); - } - } - } - variableDeclaration.call(this, node); - }; - - function createScopeVariable(node, name) { - this.currentScope().variableScope.__define( - name, - new Definition("Variable", name, node, null, null, null) - ); - } - - referencer.prototype.InterfaceDeclaration = function(node) { - createScopeVariable.call(this, node, node.id); - var typeParamScope; - if (node.typeParameters) { - typeParamScope = nestTypeParamScope.call(this, this.scopeManager, node); - } - // TODO: Handle mixins - for (var i = 0; i < node.extends.length; i++) { - visitTypeAnnotation.call(this, node.extends[i]); - } - visitTypeAnnotation.call(this, node.body); - if (typeParamScope) { - this.close(node); - } - }; - - referencer.prototype.TypeAlias = function(node) { - createScopeVariable.call(this, node, node.id); - var typeParamScope; - if (node.typeParameters) { - typeParamScope = nestTypeParamScope.call(this, this.scopeManager, node); - } - if (node.right) { - visitTypeAnnotation.call(this, node.right); - } - if (typeParamScope) { - this.close(node); - } - }; - - referencer.prototype.DeclareModule = referencer.prototype.DeclareFunction = referencer.prototype.DeclareVariable = referencer.prototype.DeclareClass = function( - node - ) { - if (node.id) { - createScopeVariable.call(this, node, node.id); - } - - var typeParamScope; - if (node.typeParameters) { - typeParamScope = nestTypeParamScope.call(this, this.scopeManager, node); - } - if (typeParamScope) { - this.close(node); - } - }; - - referencer._babelEslintPatched = true; -} - -// To patch for each call. -var escope = null; -var escopeAnalyze = null; - -module.exports = function(parserOptions) { - // Patch `Referencer.prototype` once. - if (!escope) { - const modules = getModules(); - monkeypatch(modules); - - // Store to patch for each call. - escope = modules.escope; - escopeAnalyze = modules.escope.analyze; - } - - // Patch `escope.analyze` based on the current parserOptions. - escope.analyze = function(ast, opts) { - opts = opts || {}; - opts.ecmaVersion = parserOptions.ecmaVersion; - opts.sourceType = parserOptions.sourceType; - opts.nodejsScope = - ast.sourceType === "script" && - (parserOptions.ecmaFeatures && - parserOptions.ecmaFeatures.globalReturn) === true; - - return escopeAnalyze.call(this, ast, opts); - }; -}; diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 2e5fbc206c92..f52170f5277e 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -20,7 +20,7 @@ }, "scripts": { "test": "npm run lint && npm run test-only", - "test-only": "mocha && mocha --require test/fixtures/preprocess-to-patch.js && mocha --require test/fixtures/use-eslint-old.js", + "test-only": "mocha && mocha --require test/fixtures/preprocess-to-patch.js", "lint": "eslint index.js babylon-to-espree test", "fix": "eslint index.js babylon-to-espree test --fix", "precommit": "lint-staged", @@ -41,7 +41,6 @@ "dedent": "^0.7.0", "eslint": "npm:eslint@4.19.1", "eslint-config-babel": "^7.0.1", - "eslint-old": "npm:eslint@4.13.1", "eslint-plugin-flowtype": "^2.30.3", "eslint-plugin-import": "^2.8.0", "eslint-plugin-prettier": "^2.1.2", diff --git a/eslint/babel-eslint-parser/test/fixtures/use-eslint-old.js b/eslint/babel-eslint-parser/test/fixtures/use-eslint-old.js deleted file mode 100644 index e26a39c89d06..000000000000 --- a/eslint/babel-eslint-parser/test/fixtures/use-eslint-old.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict" - -var Module = require('module'); -var originalRequire = Module.prototype.require; - -// Override to eslint-old -Module.prototype.require = function () { - if (arguments[0] === "eslint") { - arguments[0] = "eslint-old"; - } - return originalRequire.apply(this, arguments); -}; diff --git a/eslint/babel-eslint-parser/test/integration.js b/eslint/babel-eslint-parser/test/integration.js index 8e93631a5aae..09e4af9d6486 100644 --- a/eslint/babel-eslint-parser/test/integration.js +++ b/eslint/babel-eslint-parser/test/integration.js @@ -225,6 +225,7 @@ function strictSuite() { // Strip chalk colors, these are not relevant for the test const stripAnsi = str => str.replace( + // eslint-disable-next-line no-control-regex /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, "" ); diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index d6f8fae16604..af0f7387146f 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -507,7 +507,7 @@ date-fns@^1.27.2: version "1.29.0" resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.29.0.tgz#12e609cdcb935127311d04d33334e2960a2a54e6" -debug@3.1.0, debug@^3.0.1, debug@^3.1.0: +debug@3.1.0, debug@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" dependencies: @@ -573,7 +573,7 @@ doctrine@1.5.0: esutils "^2.0.2" isarray "^1.0.0" -doctrine@^2.0.2, doctrine@^2.1.0: +doctrine@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" dependencies: @@ -617,48 +617,6 @@ eslint-module-utils@^2.1.1: debug "^2.6.8" pkg-dir "^1.0.0" -"eslint-old@npm:eslint@4.13.1": - version "4.13.1" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.13.1.tgz#0055e0014464c7eb7878caf549ef2941992b444f" - dependencies: - ajv "^5.3.0" - babel-code-frame "^6.22.0" - chalk "^2.1.0" - concat-stream "^1.6.0" - cross-spawn "^5.1.0" - debug "^3.0.1" - doctrine "^2.0.2" - eslint-scope "^3.7.1" - espree "^3.5.2" - esquery "^1.0.0" - estraverse "^4.2.0" - esutils "^2.0.2" - file-entry-cache "^2.0.0" - functional-red-black-tree "^1.0.1" - glob "^7.1.2" - globals "^11.0.1" - ignore "^3.3.3" - imurmurhash "^0.1.4" - inquirer "^3.0.6" - is-resolvable "^1.0.0" - js-yaml "^3.9.1" - json-stable-stringify-without-jsonify "^1.0.1" - levn "^0.3.0" - lodash "^4.17.4" - minimatch "^3.0.2" - mkdirp "^0.5.1" - natural-compare "^1.4.0" - optionator "^0.8.2" - path-is-inside "^1.0.2" - pluralize "^7.0.0" - progress "^2.0.0" - require-uncached "^1.0.3" - semver "^5.3.0" - strip-ansi "^4.0.0" - strip-json-comments "~2.0.1" - table "^4.0.1" - text-table "~0.2.0" - eslint-plugin-flowtype@^2.30.3: version "2.45.0" resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.45.0.tgz#20d8b15d1e1e71ea4e9498e8be3fc62c0752fcbf" @@ -771,7 +729,7 @@ esrecurse@^4.1.0: dependencies: estraverse "^4.1.0" -estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: +estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1: version "4.2.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" @@ -2232,7 +2190,7 @@ symbol-observable@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" -table@4.0.2, table@^4.0.1: +table@4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/table/-/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36" dependencies: From 78a2f603ce4bbfa5db3a57ce7ea097842a03eb71 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 25 Sep 2018 14:32:16 -0400 Subject: [PATCH 446/569] Test eslint5, update peerDep (babel/babel-eslint#690) * test against eslint 5 * set peerDep --- eslint/babel-eslint-parser/package.json | 11 +- eslint/babel-eslint-parser/yarn.lock | 343 +++++++++++------------- 2 files changed, 165 insertions(+), 189 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index f52170f5277e..ceb3a1d2733a 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -21,8 +21,8 @@ "scripts": { "test": "npm run lint && npm run test-only", "test-only": "mocha && mocha --require test/fixtures/preprocess-to-patch.js", - "lint": "eslint index.js babylon-to-espree test", - "fix": "eslint index.js babylon-to-espree test --fix", + "lint": "eslint lib test", + "fix": "eslint lib test --fix", "precommit": "lint-staged", "preversion": "npm test", "changelog": "git log `git describe --tags --abbrev=0`..HEAD --pretty=format:' * %s (%an)' | grep -v 'Merge pull request'" @@ -36,13 +36,16 @@ "url": "https://github.com/babel/babel-eslint/issues" }, "homepage": "https://github.com/babel/babel-eslint", + "peerDependencies": { + "eslint": ">= 4.12.1" + }, "devDependencies": { "babel-eslint": "^8.2.6", "dedent": "^0.7.0", - "eslint": "npm:eslint@4.19.1", + "eslint": "^5.6.0", "eslint-config-babel": "^7.0.1", "eslint-plugin-flowtype": "^2.30.3", - "eslint-plugin-import": "^2.8.0", + "eslint-plugin-import": "^2.14.0", "eslint-plugin-prettier": "^2.1.2", "espree": "^3.5.2", "husky": "^1.0.0-rc.13", diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index af0f7387146f..c3099c04cfff 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -168,30 +168,36 @@ acorn-jsx@^3.0.0: dependencies: acorn "^3.0.4" +acorn-jsx@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-4.1.1.tgz#e8e41e48ea2fe0c896740610ab6a4ffd8add225e" + dependencies: + acorn "^5.0.3" + acorn@^3.0.4: version "3.3.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" +acorn@^5.0.3, acorn@^5.6.0: + version "5.7.3" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" + acorn@^5.4.0: version "5.4.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.4.1.tgz#fdc58d9d17f4a4e98d102ded826a9b9759125102" -acorn@^5.5.0: - version "5.7.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.1.tgz#f095829297706a7c9776958c0afc8930a9b9d9d8" - -ajv-keywords@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.1.tgz#617997fc5f60576894c435f940d819e135b80762" +ajv-keywords@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.2.0.tgz#e86b819c602cf8821ad637413698f1dec021847a" -ajv@^5.2.3, ajv@^5.3.0: - version "5.5.2" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" +ajv@^6.0.1, ajv@^6.5.3: + version "6.5.4" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.5.4.tgz#247d5274110db653706b550fcc2b797ca28cfc59" dependencies: - co "^4.6.0" - fast-deep-equal "^1.0.0" + fast-deep-equal "^2.0.1" fast-json-stable-stringify "^2.0.0" - json-schema-traverse "^0.3.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" ansi-escapes@^1.0.0: version "1.4.0" @@ -267,14 +273,6 @@ atob@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" -babel-code-frame@^6.22.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" - dependencies: - chalk "^1.1.3" - esutils "^2.0.2" - js-tokens "^3.0.2" - babel-eslint@^8.2.6: version "8.2.6" resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-8.2.6.tgz#6270d0c73205628067c0f7ae1693a9e797acefd9" @@ -332,7 +330,7 @@ browser-stdout@1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" -builtin-modules@^1.0.0, builtin-modules@^1.1.1: +builtin-modules@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" @@ -378,9 +376,9 @@ chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.1: escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chardet@^0.4.0: - version "0.4.2" - resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2" +chardet@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" ci-info@^1.3.0: version "1.4.0" @@ -426,10 +424,6 @@ cli-width@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" -co@^4.6.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" - code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" @@ -467,14 +461,6 @@ concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" -concat-stream@^1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" - dependencies: - inherits "^2.0.3" - readable-stream "^2.2.2" - typedarray "^0.0.6" - contains-path@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" @@ -483,10 +469,6 @@ copy-descriptor@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" -core-util-is@~1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" - cosmiconfig@^5.0.2: version "5.0.6" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.0.6.tgz#dca6cf680a0bd03589aff684700858c81abeeb39" @@ -495,7 +477,7 @@ cosmiconfig@^5.0.2: js-yaml "^3.9.0" parse-json "^4.0.0" -cross-spawn@^5.0.1, cross-spawn@^5.1.0: +cross-spawn@^5.0.1: version "5.1.0" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" dependencies: @@ -503,6 +485,16 @@ cross-spawn@^5.0.1, cross-spawn@^5.1.0: shebang-command "^1.2.0" which "^1.2.9" +cross-spawn@^6.0.5: + version "6.0.5" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" + dependencies: + nice-try "^1.0.4" + path-key "^2.0.1" + semver "^5.5.0" + shebang-command "^1.2.0" + which "^1.2.9" + date-fns@^1.27.2: version "1.29.0" resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.29.0.tgz#12e609cdcb935127311d04d33334e2960a2a54e6" @@ -610,9 +602,9 @@ eslint-import-resolver-node@^0.3.1: debug "^2.6.9" resolve "^1.5.0" -eslint-module-utils@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.1.1.tgz#abaec824177613b8a95b299639e1b6facf473449" +eslint-module-utils@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.2.0.tgz#b270362cd88b1a48ad308976ce7fa54e98411746" dependencies: debug "^2.6.8" pkg-dir "^1.0.0" @@ -623,20 +615,20 @@ eslint-plugin-flowtype@^2.30.3: dependencies: lodash "^4.15.0" -eslint-plugin-import@^2.8.0: - version "2.8.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.8.0.tgz#fa1b6ef31fcb3c501c09859c1b86f1fc5b986894" +eslint-plugin-import@^2.14.0: + version "2.14.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.14.0.tgz#6b17626d2e3e6ad52cfce8807a845d15e22111a8" dependencies: - builtin-modules "^1.1.1" contains-path "^0.1.0" debug "^2.6.8" doctrine "1.5.0" eslint-import-resolver-node "^0.3.1" - eslint-module-utils "^2.1.1" + eslint-module-utils "^2.2.0" has "^1.0.1" - lodash.cond "^4.3.0" + lodash "^4.17.4" minimatch "^3.0.3" read-pkg-up "^2.0.0" + resolve "^1.6.0" eslint-plugin-prettier@^2.1.2: version "2.6.0" @@ -645,59 +637,70 @@ eslint-plugin-prettier@^2.1.2: fast-diff "^1.1.1" jest-docblock "^21.0.0" -eslint-scope@3.7.1, eslint-scope@^3.7.1: +eslint-scope@3.7.1: version "3.7.1" resolved "http://registry.npm.taobao.org/eslint-scope/download/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" dependencies: esrecurse "^4.1.0" estraverse "^4.1.1" +eslint-scope@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.0.tgz#50bf3071e9338bcdc43331794a0cb533f0136172" + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint-utils@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.3.1.tgz#9a851ba89ee7c460346f97cf8939c7298827e512" + eslint-visitor-keys@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" -"eslint@npm:eslint@4.19.1": - version "4.19.1" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.19.1.tgz#32d1d653e1d90408854bfb296f076ec7e186a300" +eslint@^5.6.0: + version "5.6.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.6.0.tgz#b6f7806041af01f71b3f1895cbb20971ea4b6223" dependencies: - ajv "^5.3.0" - babel-code-frame "^6.22.0" + "@babel/code-frame" "^7.0.0" + ajv "^6.5.3" chalk "^2.1.0" - concat-stream "^1.6.0" - cross-spawn "^5.1.0" + cross-spawn "^6.0.5" debug "^3.1.0" doctrine "^2.1.0" - eslint-scope "^3.7.1" + eslint-scope "^4.0.0" + eslint-utils "^1.3.1" eslint-visitor-keys "^1.0.0" - espree "^3.5.4" - esquery "^1.0.0" + espree "^4.0.0" + esquery "^1.0.1" esutils "^2.0.2" file-entry-cache "^2.0.0" functional-red-black-tree "^1.0.1" glob "^7.1.2" - globals "^11.0.1" - ignore "^3.3.3" + globals "^11.7.0" + ignore "^4.0.6" imurmurhash "^0.1.4" - inquirer "^3.0.6" - is-resolvable "^1.0.0" - js-yaml "^3.9.1" + inquirer "^6.1.0" + is-resolvable "^1.1.0" + js-yaml "^3.12.0" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.3.0" - lodash "^4.17.4" - minimatch "^3.0.2" + lodash "^4.17.5" + minimatch "^3.0.4" mkdirp "^0.5.1" natural-compare "^1.4.0" optionator "^0.8.2" path-is-inside "^1.0.2" pluralize "^7.0.0" progress "^2.0.0" - regexpp "^1.0.1" + regexpp "^2.0.0" require-uncached "^1.0.3" - semver "^5.3.0" + semver "^5.5.1" strip-ansi "^4.0.0" - strip-json-comments "~2.0.1" - table "4.0.2" - text-table "~0.2.0" + strip-json-comments "^2.0.1" + table "^4.0.3" + text-table "^0.2.0" espree@^3.5.2: version "3.5.3" @@ -706,20 +709,20 @@ espree@^3.5.2: acorn "^5.4.0" acorn-jsx "^3.0.0" -espree@^3.5.4: - version "3.5.4" - resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.4.tgz#b0f447187c8a8bed944b815a660bddf5deb5d1a7" +espree@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-4.0.0.tgz#253998f20a0f82db5d866385799d912a83a36634" dependencies: - acorn "^5.5.0" - acorn-jsx "^3.0.0" + acorn "^5.6.0" + acorn-jsx "^4.1.1" esprima@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" -esquery@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.0.tgz#cfba8b57d7fba93f17298a8a006a04cda13d80fa" +esquery@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708" dependencies: estraverse "^4.0.0" @@ -778,12 +781,12 @@ extend-shallow@^3.0.0, extend-shallow@^3.0.2: assign-symbols "^1.0.0" is-extendable "^1.0.1" -external-editor@^2.0.4: - version "2.1.0" - resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.1.0.tgz#3d026a21b7f95b5726387d4200ac160d372c3b48" +external-editor@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.0.3.tgz#5866db29a97826dbe4bf3afd24070ead9ea43a27" dependencies: - chardet "^0.4.0" - iconv-lite "^0.4.17" + chardet "^0.7.0" + iconv-lite "^0.4.24" tmp "^0.0.33" extglob@^2.0.4: @@ -799,9 +802,9 @@ extglob@^2.0.4: snapdragon "^0.8.1" to-regex "^3.0.1" -fast-deep-equal@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz#96256a3bc975595eb36d82e9929d060d893439ff" +fast-deep-equal@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" fast-diff@^1.1.1: version "1.1.2" @@ -925,11 +928,7 @@ glob@7.1.2, glob@^7.0.3, glob@^7.0.5, glob@^7.1.2: once "^1.3.0" path-is-absolute "^1.0.0" -globals@^11.0.1: - version "11.3.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.3.0.tgz#e04fdb7b9796d8adac9c8f64c14837b2313378b0" - -globals@^11.1.0: +globals@^11.1.0, globals@^11.7.0: version "11.7.0" resolved "https://registry.yarnpkg.com/globals/-/globals-11.7.0.tgz#a583faa43055b1aca771914bf68258e2fc125673" @@ -1022,13 +1021,15 @@ husky@^1.0.0-rc.13: run-node "^1.0.0" slash "^2.0.0" -iconv-lite@^0.4.17: - version "0.4.19" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" +iconv-lite@^0.4.24: + version "0.4.24" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" + dependencies: + safer-buffer ">= 2.1.2 < 3" -ignore@^3.3.3: - version "3.3.7" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.7.tgz#612289bfb3c220e186a58118618d5be8c1bab021" +ignore@^4.0.6: + version "4.0.6" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" imurmurhash@^0.1.4: version "0.1.4" @@ -1051,25 +1052,24 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@^2.0.3, inherits@~2.0.3: +inherits@2: version "2.0.3" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" -inquirer@^3.0.6: - version "3.3.0" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.3.0.tgz#9dd2f2ad765dcab1ff0443b491442a20ba227dc9" +inquirer@^6.1.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.2.0.tgz#51adcd776f661369dc1e894859c2560a224abdd8" dependencies: ansi-escapes "^3.0.0" chalk "^2.0.0" cli-cursor "^2.1.0" cli-width "^2.0.0" - external-editor "^2.0.4" + external-editor "^3.0.0" figures "^2.0.0" - lodash "^4.3.0" + lodash "^4.17.10" mute-stream "0.0.7" run-async "^2.2.0" - rx-lite "^4.0.8" - rx-lite-aggregates "^4.0.8" + rxjs "^6.1.0" string-width "^2.1.0" strip-ansi "^4.0.0" through "^2.3.6" @@ -1226,7 +1226,7 @@ is-regexp@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-regexp/-/is-regexp-1.0.0.tgz#fd2d883545c46bac5a633e7b9a09e87fa2cb5069" -is-resolvable@^1.0.0: +is-resolvable@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88" @@ -1238,7 +1238,7 @@ is-windows@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" -isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: +isarray@1.0.0, isarray@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" @@ -1273,7 +1273,7 @@ jest-validate@^23.5.0: leven "^2.1.0" pretty-format "^23.5.0" -js-tokens@^3.0.0, js-tokens@^3.0.2: +js-tokens@^3.0.0: version "3.0.2" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" @@ -1281,20 +1281,13 @@ js-tokens@^3.0.0, js-tokens@^3.0.2: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" -js-yaml@^3.9.0: +js-yaml@^3.12.0, js-yaml@^3.9.0: version "3.12.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1" dependencies: argparse "^1.0.7" esprima "^4.0.0" -js-yaml@^3.9.1: - version "3.10.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc" - dependencies: - argparse "^1.0.7" - esprima "^4.0.0" - jsesc@^2.5.1: version "2.5.1" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.1.tgz#e421a2a8e20d6b0819df28908f782526b96dd1fe" @@ -1303,9 +1296,9 @@ json-parse-better-errors@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" -json-schema-traverse@^0.3.0: - version "0.3.1" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" @@ -1439,11 +1432,7 @@ locate-path@^3.0.0: p-locate "^3.0.0" path-exists "^3.0.0" -lodash.cond@^4.3.0: - version "4.5.2" - resolved "https://registry.yarnpkg.com/lodash.cond/-/lodash.cond-4.5.2.tgz#f471a1da486be60f6ab955d17115523dd1d255d5" - -lodash@^4.15.0, lodash@^4.3.0: +lodash@^4.15.0: version "4.17.5" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" @@ -1515,7 +1504,7 @@ mimic-fn@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" -minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: +minimatch@^3.0.3, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" dependencies: @@ -1581,6 +1570,10 @@ natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" +nice-try@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" + normalize-package-data@^2.3.2: version "2.4.0" resolved "http://registry.npm.taobao.org/normalize-package-data/download/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f" @@ -1753,7 +1746,7 @@ path-is-inside@^1.0.1, path-is-inside@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" -path-key@^2.0.0: +path-key@^2.0.0, path-key@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" @@ -1826,10 +1819,6 @@ pretty-format@^23.5.0: ansi-regex "^3.0.0" ansi-styles "^3.2.0" -process-nextick-args@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" - progress@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f" @@ -1838,6 +1827,10 @@ pseudomap@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" +punycode@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + read-pkg-up@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" @@ -1861,18 +1854,6 @@ read-pkg@^4.0.1: parse-json "^4.0.0" pify "^3.0.0" -readable-stream@^2.2.2: - version "2.3.4" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.4.tgz#c946c3f47fa7d8eabc0b6150f4a12f69a4574071" - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.3" - isarray "~1.0.0" - process-nextick-args "~2.0.0" - safe-buffer "~5.1.1" - string_decoder "~1.0.3" - util-deprecate "~1.0.1" - regex-not@^1.0.0, regex-not@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" @@ -1880,9 +1861,9 @@ regex-not@^1.0.0, regex-not@^1.0.2: extend-shallow "^3.0.2" safe-regex "^1.1.0" -regexpp@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-1.1.0.tgz#0e3516dd0b7904f413d2d4193dce4618c3a689ab" +regexpp@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.0.tgz#b2a7534a85ca1b033bcf5ce9ff8e56d4e0755365" repeat-element@^1.1.2: version "1.1.3" @@ -1919,6 +1900,12 @@ resolve@^1.5.0: dependencies: path-parse "^1.0.5" +resolve@^1.6.0: + version "1.8.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.8.1.tgz#82f1ec19a423ac1fbd080b0bab06ba36e84a7a26" + dependencies: + path-parse "^1.0.5" + restore-cursor@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541" @@ -1953,40 +1940,34 @@ run-node@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/run-node/-/run-node-1.0.0.tgz#46b50b946a2aa2d4947ae1d886e9856fd9cabe5e" -rx-lite-aggregates@^4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz#753b87a89a11c95467c4ac1626c4efc4e05c67be" - dependencies: - rx-lite "*" - -rx-lite@*, rx-lite@^4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444" - rxjs@^6.1.0: version "6.2.2" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.2.2.tgz#eb75fa3c186ff5289907d06483a77884586e1cf9" dependencies: tslib "^1.9.0" -safe-buffer@~5.1.0, safe-buffer@~5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" - safe-regex@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" dependencies: ret "~0.1.10" +"safer-buffer@>= 2.1.2 < 3": + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + semver-compare@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc" -"semver@2 || 3 || 4 || 5", semver@^5.3.0: +"semver@2 || 3 || 4 || 5": version "5.5.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" +semver@^5.5.0, semver@^5.5.1: + version "5.5.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.1.tgz#7dfdd8814bdb7cabc7be0fb1d734cfb66c940477" + set-value@^0.4.3: version "0.4.3" resolved "https://registry.yarnpkg.com/set-value/-/set-value-0.4.3.tgz#7db08f9d3d22dc7f78e53af3c3bf4666ecdfccf1" @@ -2132,12 +2113,6 @@ string-width@^2.1.0, string-width@^2.1.1: is-fullwidth-code-point "^2.0.0" strip-ansi "^4.0.0" -string_decoder@~1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.3.tgz#0fc67d7c141825de94282dd536bec6b9bce860ab" - dependencies: - safe-buffer "~5.1.0" - stringify-object@^3.2.2: version "3.2.2" resolved "https://registry.yarnpkg.com/stringify-object/-/stringify-object-3.2.2.tgz#9853052e5a88fb605a44cd27445aa257ad7ffbcd" @@ -2166,7 +2141,7 @@ strip-eof@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" -strip-json-comments@~2.0.1: +strip-json-comments@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" @@ -2190,18 +2165,18 @@ symbol-observable@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" -table@4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/table/-/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36" +table@^4.0.3: + version "4.0.3" + resolved "http://registry.npmjs.org/table/-/table-4.0.3.tgz#00b5e2b602f1794b9acaf9ca908a76386a7813bc" dependencies: - ajv "^5.2.3" - ajv-keywords "^2.1.0" + ajv "^6.0.1" + ajv-keywords "^3.0.0" chalk "^2.1.0" lodash "^4.17.4" slice-ansi "1.0.0" string-width "^2.1.1" -text-table@~0.2.0: +text-table@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" @@ -2255,10 +2230,6 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" -typedarray@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" - union-value@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.0.tgz#5c71c34cb5bad5dcebe3ea0cd08207ba5aa1aea4" @@ -2275,6 +2246,12 @@ unset-value@^1.0.0: has-value "^0.3.1" isobject "^3.0.0" +uri-js@^4.2.2: + version "4.2.2" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" + dependencies: + punycode "^2.1.0" + urix@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" @@ -2283,10 +2260,6 @@ use@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" -util-deprecate@~1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" - validate-npm-package-license@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz#2804babe712ad3379459acfbe24746ab2c303fbc" From 22fa8e6f20f401a46d426d3b6848b3be97997151 Mon Sep 17 00:00:00 2001 From: Joa Ebert Date: Tue, 25 Sep 2018 20:39:43 +0200 Subject: [PATCH 447/569] Treat type alias declarationlike function declaration (babel/babel-eslint#584) A type alias shouldn't trigger a no-use-before-define warning just like a function declaration. Cyclic type dependencies are common when using flow. For instance: type Node = { head: T; tail: Node } Fixes babel/babel-eslint#485 --- .../lib/babylon-to-espree/toAST.js | 9 +++++++++ eslint/babel-eslint-parser/test/non-regression.js | 12 ++++++++++++ 2 files changed, 21 insertions(+) diff --git a/eslint/babel-eslint-parser/lib/babylon-to-espree/toAST.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/toAST.js index b3da41f0cb06..88349d7cd09a 100644 --- a/eslint/babel-eslint-parser/lib/babylon-to-espree/toAST.js +++ b/eslint/babel-eslint-parser/lib/babylon-to-espree/toAST.js @@ -72,6 +72,15 @@ var astTransformVisitor = { delete node.bound; } + if (path.isTypeAlias()) { + node.type = "FunctionDeclaration"; + node.generator = false; + node.async = false; + node.expression = false; + node.params = []; + node.body = node.right; + } + // flow: prevent "no-undef" // for "Component" in: "let x: React.Component" if (path.isQualifiedTypeIdentifier()) { diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 4c43b29f3f71..15c0a2824035 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1091,6 +1091,18 @@ describe("verify", () => { { "no-unused-vars": 1, "no-undef": 1 } ); }); + + it("cyclic type dependencies #485", () => { + verifyAndAssertMessages( + unpad(` + type Node = { head: T, tail: Node }; + type A = B[]; + type B = number; + `), + { "no-use-before-define": 1 }, + [] + ); + }); }); it("class usage", () => { From 742aa412a7b7f10117d013a6cb0d97860587c591 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 25 Sep 2018 15:29:14 -0400 Subject: [PATCH 448/569] test value should be switched --- eslint/babel-eslint-parser/test/non-regression.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 15c0a2824035..1a24f9d7055b 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1092,14 +1092,14 @@ describe("verify", () => { ); }); - it("cyclic type dependencies #485", () => { + it("cyclic type dependencies should not error #485", () => { verifyAndAssertMessages( unpad(` type Node = { head: T, tail: Node }; type A = B[]; type B = number; `), - { "no-use-before-define": 1 }, + { "no-use-before-define": 0 }, [] ); }); From 9adb82e68a0001628a1256370695279eebbb3a96 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 25 Sep 2018 15:32:56 -0400 Subject: [PATCH 449/569] 10.0.0 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index ceb3a1d2733a..04f99dd820a2 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "9.0.0", + "version": "10.0.0", "description": "Custom parser for ESLint", "main": "lib/index.js", "files": [ From e56b342e593677b5c6a6c6f606d4299558539422 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 27 Sep 2018 10:29:29 -0400 Subject: [PATCH 450/569] Revert babel/babel-eslint#584 (babel/babel-eslint#697) * Revert "Treat type alias declarationlike function declaration (babel/babel-eslint#584)" This reverts commit 020d012c554913fea137f4129798ce31a4896dfe. --- .../lib/babylon-to-espree/toAST.js | 9 --------- eslint/babel-eslint-parser/test/non-regression.js | 12 ------------ 2 files changed, 21 deletions(-) diff --git a/eslint/babel-eslint-parser/lib/babylon-to-espree/toAST.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/toAST.js index 88349d7cd09a..b3da41f0cb06 100644 --- a/eslint/babel-eslint-parser/lib/babylon-to-espree/toAST.js +++ b/eslint/babel-eslint-parser/lib/babylon-to-espree/toAST.js @@ -72,15 +72,6 @@ var astTransformVisitor = { delete node.bound; } - if (path.isTypeAlias()) { - node.type = "FunctionDeclaration"; - node.generator = false; - node.async = false; - node.expression = false; - node.params = []; - node.body = node.right; - } - // flow: prevent "no-undef" // for "Component" in: "let x: React.Component" if (path.isQualifiedTypeIdentifier()) { diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 1a24f9d7055b..4c43b29f3f71 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1091,18 +1091,6 @@ describe("verify", () => { { "no-unused-vars": 1, "no-undef": 1 } ); }); - - it("cyclic type dependencies should not error #485", () => { - verifyAndAssertMessages( - unpad(` - type Node = { head: T, tail: Node }; - type A = B[]; - type B = number; - `), - { "no-use-before-define": 0 }, - [] - ); - }); }); it("class usage", () => { From 40d9bb3a773ed511a972bdbb256c43766b589e4e Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 27 Sep 2018 10:29:57 -0400 Subject: [PATCH 451/569] 10.0.1 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 04f99dd820a2..5d3486296fae 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "10.0.0", + "version": "10.0.1", "description": "Custom parser for ESLint", "main": "lib/index.js", "files": [ From 22a1681e11cde120ffc124a5c34b356afd8eddf1 Mon Sep 17 00:00:00 2001 From: Kai Cataldo Date: Tue, 30 Oct 2018 14:48:37 -0500 Subject: [PATCH 452/569] Merge pull request babel/babel-eslint#706 from kaicataldo/es6 Update ESLint config --- eslint/babel-eslint-parser/.eslintrc.js | 18 ++++++++--- eslint/babel-eslint-parser/.npmrc | 1 + .../lib/babylon-to-espree/attachComments.js | 16 +++++----- .../lib/babylon-to-espree/convertComments.js | 4 +-- .../lib/babylon-to-espree/index.js | 8 ++--- .../lib/babylon-to-espree/toAST.js | 16 +++++----- .../lib/babylon-to-espree/toToken.js | 4 +-- .../lib/babylon-to-espree/toTokens.js | 4 +-- eslint/babel-eslint-parser/lib/parse.js | 14 ++++----- .../babel-eslint-parser/test/babel-eslint.js | 30 ++++++++++--------- .../test/fixtures/assert-implements-ast.js | 14 +++++---- .../test/fixtures/preprocess-to-patch.js | 1 + .../babel-eslint-parser/test/integration.js | 26 ++++++++-------- .../test/non-regression.js | 14 ++++----- .../test/z_parser-for-eslint-after-patched.js | 2 +- 15 files changed, 95 insertions(+), 77 deletions(-) create mode 100644 eslint/babel-eslint-parser/.npmrc diff --git a/eslint/babel-eslint-parser/.eslintrc.js b/eslint/babel-eslint-parser/.eslintrc.js index 64dc12e693fe..169516cb3f84 100644 --- a/eslint/babel-eslint-parser/.eslintrc.js +++ b/eslint/babel-eslint-parser/.eslintrc.js @@ -5,12 +5,22 @@ module.exports = { "prettier" ], rules: { - "no-var": 0, - "max-len": 0, + "max-len": "off", + "strict": "error", "prettier/prettier": "error", }, env: { node: true, - mocha: true - } + }, + parserOptions: { + sourceType: "script", + }, + overrides: [ + { + files: ["test/**/*"], + env: { + mocha: true + } + } + ] }; diff --git a/eslint/babel-eslint-parser/.npmrc b/eslint/babel-eslint-parser/.npmrc new file mode 100644 index 000000000000..c1ca392feaa4 --- /dev/null +++ b/eslint/babel-eslint-parser/.npmrc @@ -0,0 +1 @@ +package-lock = false diff --git a/eslint/babel-eslint-parser/lib/babylon-to-espree/attachComments.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/attachComments.js index 8c608a45ad94..6e198753845f 100644 --- a/eslint/babel-eslint-parser/lib/babylon-to-espree/attachComments.js +++ b/eslint/babel-eslint-parser/lib/babylon-to-espree/attachComments.js @@ -3,8 +3,8 @@ // comment fixes module.exports = function(ast, comments, tokens) { if (comments.length) { - var firstComment = comments[0]; - var lastComment = comments[comments.length - 1]; + const firstComment = comments[0]; + const lastComment = comments[comments.length - 1]; // fixup program start if (!tokens.length) { // if no tokens, the program starts at the end of the last comment @@ -17,7 +17,7 @@ module.exports = function(ast, comments, tokens) { } } else if (firstComment.start < tokens[0].start) { // if there are comments before the first token, the program starts at the first token - var token = tokens[0]; + const token = tokens[0]; // ast.start = token.start; // ast.loc.start.line = token.loc.start.line; // ast.loc.start.column = token.loc.start.column; @@ -25,18 +25,18 @@ module.exports = function(ast, comments, tokens) { // estraverse do not put leading comments on first node when the comment // appear before the first token if (ast.body.length) { - var node = ast.body[0]; + const node = ast.body[0]; node.leadingComments = []; - var firstTokenStart = token.start; - var len = comments.length; - for (var i = 0; i < len && comments[i].start < firstTokenStart; i++) { + const firstTokenStart = token.start; + const len = comments.length; + for (let i = 0; i < len && comments[i].start < firstTokenStart; i++) { node.leadingComments.push(comments[i]); } } } // fixup program end if (tokens.length) { - var lastToken = tokens[tokens.length - 1]; + const lastToken = tokens[tokens.length - 1]; if (lastComment.end > lastToken.end) { // If there is a comment after the last token, the program ends at the // last token and not the comment diff --git a/eslint/babel-eslint-parser/lib/babylon-to-espree/convertComments.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/convertComments.js index 17d711737294..57b0e44d4d54 100644 --- a/eslint/babel-eslint-parser/lib/babylon-to-espree/convertComments.js +++ b/eslint/babel-eslint-parser/lib/babylon-to-espree/convertComments.js @@ -1,8 +1,8 @@ "use strict"; module.exports = function(comments) { - for (var i = 0; i < comments.length; i++) { - var comment = comments[i]; + for (let i = 0; i < comments.length; i++) { + const comment = comments[i]; if (comment.type === "CommentBlock") { comment.type = "Block"; } else if (comment.type === "CommentLine") { diff --git a/eslint/babel-eslint-parser/lib/babylon-to-espree/index.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/index.js index 6d6e12bfc086..c0fdf323a884 100644 --- a/eslint/babel-eslint-parser/lib/babylon-to-espree/index.js +++ b/eslint/babel-eslint-parser/lib/babylon-to-espree/index.js @@ -1,9 +1,9 @@ "use strict"; -var attachComments = require("./attachComments"); -var convertComments = require("./convertComments"); -var toTokens = require("./toTokens"); -var toAST = require("./toAST"); +const attachComments = require("./attachComments"); +const convertComments = require("./convertComments"); +const toTokens = require("./toTokens"); +const toAST = require("./toAST"); module.exports = function(ast, traverse, tt, code) { // convert tokens diff --git a/eslint/babel-eslint-parser/lib/babylon-to-espree/toAST.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/toAST.js index b3da41f0cb06..e375f69dd1bd 100644 --- a/eslint/babel-eslint-parser/lib/babylon-to-espree/toAST.js +++ b/eslint/babel-eslint-parser/lib/babylon-to-espree/toAST.js @@ -1,10 +1,10 @@ "use strict"; -var t = require("@babel/types"); -var convertComments = require("./convertComments"); +const t = require("@babel/types"); +const convertComments = require("./convertComments"); module.exports = function(ast, traverse, code) { - var state = { source: code }; + const state = { source: code }; // Monkey patch visitor keys in order to be able to traverse the estree nodes t.VISITOR_KEYS.Property = t.VISITOR_KEYS.ObjectProperty; @@ -22,10 +22,10 @@ module.exports = function(ast, traverse, code) { delete t.VISITOR_KEYS.MethodDefinition; }; -var astTransformVisitor = { +const astTransformVisitor = { noScope: true, enter(path) { - var node = path.node; + const node = path.node; // private var to track original node type node._babelType = node.type; @@ -44,7 +44,7 @@ var astTransformVisitor = { } }, exit(path) { - var node = path.node; + const node = path.node; if (path.isJSXText()) { node.type = "Literal"; @@ -98,8 +98,8 @@ var astTransformVisitor = { // template string range fixes if (path.isTemplateLiteral()) { - for (var j = 0; j < node.quasis.length; j++) { - var q = node.quasis[j]; + for (let j = 0; j < node.quasis.length; j++) { + const q = node.quasis[j]; q.range[0] -= 1; if (q.tail) { q.range[1] += 1; diff --git a/eslint/babel-eslint-parser/lib/babylon-to-espree/toToken.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/toToken.js index 44c73529a111..3e0ba453c9fb 100644 --- a/eslint/babel-eslint-parser/lib/babylon-to-espree/toToken.js +++ b/eslint/babel-eslint-parser/lib/babylon-to-espree/toToken.js @@ -1,7 +1,7 @@ "use strict"; module.exports = function(token, tt, source) { - var type = token.type; + const type = token.type; token.range = [token.start, token.end]; if (type === tt.name) { @@ -72,7 +72,7 @@ module.exports = function(token, tt, source) { token.value = source.slice(token.start, token.end); } else if (type === tt.regexp) { token.type = "RegularExpression"; - var value = token.value; + const value = token.value; token.regex = { pattern: value.pattern, flags: value.flags, diff --git a/eslint/babel-eslint-parser/lib/babylon-to-espree/toTokens.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/toTokens.js index bb30819bacf7..2927c4b01123 100644 --- a/eslint/babel-eslint-parser/lib/babylon-to-espree/toTokens.js +++ b/eslint/babel-eslint-parser/lib/babylon-to-espree/toTokens.js @@ -1,7 +1,7 @@ "use strict"; -var convertTemplateType = require("./convertTemplateType"); -var toToken = require("./toToken"); +const convertTemplateType = require("./convertTemplateType"); +const toToken = require("./toToken"); module.exports = function(tokens, tt, code) { return convertTemplateType(tokens, tt) diff --git a/eslint/babel-eslint-parser/lib/parse.js b/eslint/babel-eslint-parser/lib/parse.js index b23b9dc9fc75..0817df4b0783 100644 --- a/eslint/babel-eslint-parser/lib/parse.js +++ b/eslint/babel-eslint-parser/lib/parse.js @@ -1,16 +1,16 @@ "use strict"; -var babylonToEspree = require("./babylon-to-espree"); -var parse = require("@babel/parser").parse; -var tt = require("@babel/parser").tokTypes; -var traverse = require("@babel/traverse").default; -var codeFrameColumns = require("@babel/code-frame").codeFrameColumns; +const babylonToEspree = require("./babylon-to-espree"); +const parse = require("@babel/parser").parse; +const tt = require("@babel/parser").tokTypes; +const traverse = require("@babel/traverse").default; +const codeFrameColumns = require("@babel/code-frame").codeFrameColumns; module.exports = function(code, options) { const legacyDecorators = options.ecmaFeatures && options.ecmaFeatures.legacyDecorators; - var opts = { + const opts = { codeFrame: options.hasOwnProperty("codeFrame") ? options.codeFrame : true, sourceType: options.sourceType, allowImportExportEverywhere: options.allowImportExportEverywhere, // consistent with espree @@ -51,7 +51,7 @@ module.exports = function(code, options) { ], }; - var ast; + let ast; try { ast = parse(code, opts); } catch (err) { diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index 99b03f25c7ea..ce270f113b13 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -1,10 +1,12 @@ -var assert = require("assert"); -var babelEslint = require(".."); -var espree = require("espree"); -var escope = require("eslint-scope"); -var util = require("util"); -var unpad = require("dedent"); -var assertImplementsAST = require("./fixtures/assert-implements-ast"); +"use strict"; + +const assert = require("assert"); +const babelEslint = require(".."); +const espree = require("espree"); +const escope = require("eslint-scope"); +const util = require("util"); +const unpad = require("dedent"); +const assertImplementsAST = require("./fixtures/assert-implements-ast"); function lookup(obj, keypath, backwardsDepth) { if (!keypath) { @@ -21,7 +23,7 @@ function lookup(obj, keypath, backwardsDepth) { function parseAndAssertSame(code) { code = unpad(code); - var esAST = espree.parse(code, { + const esAST = espree.parse(code, { ecmaFeatures: { // enable JSX parsing jsx: true, @@ -40,14 +42,14 @@ function parseAndAssertSame(code) { ecmaVersion: 2018, sourceType: "module", }); - var babylonAST = babelEslint.parseForESLint(code, { + const babylonAST = babelEslint.parseForESLint(code, { eslintVisitorKeys: true, eslintScopeManager: true, }).ast; try { assertImplementsAST(esAST, babylonAST); } catch (err) { - var traversal = err.message.slice(3, err.message.indexOf(":")); + const traversal = err.message.slice(3, err.message.indexOf(":")); err.message += unpad(` espree: ${util.inspect(lookup(esAST, traversal, 2), { @@ -68,7 +70,7 @@ function parseAndAssertSame(code) { describe("babylon-to-espree", () => { describe("compatibility", () => { it("should allow ast.analyze to be called without options", function() { - var esAST = babelEslint.parseForESLint("`test`", { + const esAST = babelEslint.parseForESLint("`test`", { eslintScopeManager: true, eslintVisitorKeys: true, }).ast; @@ -271,7 +273,7 @@ describe("babylon-to-espree", () => { // Espree doesn't support the optional chaining operator yet it("optional chaining operator (token)", () => { const code = "foo?.bar"; - var babylonAST = babelEslint.parseForESLint(code, { + const babylonAST = babelEslint.parseForESLint(code, { eslintVisitorKeys: true, eslintScopeManager: true, }).ast; @@ -281,7 +283,7 @@ describe("babylon-to-espree", () => { // Espree doesn't support the nullish coalescing operator yet it("nullish coalescing operator (token)", () => { const code = "foo ?? bar"; - var babylonAST = babelEslint.parseForESLint(code, { + const babylonAST = babelEslint.parseForESLint(code, { eslintVisitorKeys: true, eslintScopeManager: true, }).ast; @@ -291,7 +293,7 @@ describe("babylon-to-espree", () => { // Espree doesn't support the pipeline operator yet it("pipeline operator (token)", () => { const code = "foo |> bar"; - var babylonAST = babelEslint.parseForESLint(code, { + const babylonAST = babelEslint.parseForESLint(code, { eslintVisitorKeys: true, eslintScopeManager: true, }).ast; diff --git a/eslint/babel-eslint-parser/test/fixtures/assert-implements-ast.js b/eslint/babel-eslint-parser/test/fixtures/assert-implements-ast.js index 61e77e21b06b..90dceb0dba26 100644 --- a/eslint/babel-eslint-parser/test/fixtures/assert-implements-ast.js +++ b/eslint/babel-eslint-parser/test/fixtures/assert-implements-ast.js @@ -1,3 +1,5 @@ +"use strict" + // Checks if the source ast implements the target ast. Ignores extra keys on source ast module.exports = function assertImplementsAST(target, source, path) { if (!path) { @@ -5,13 +7,13 @@ module.exports = function assertImplementsAST(target, source, path) { } function error(text) { - var err = new Error(`At ${path.join(".")}: ${text}:`); + const err = new Error(`At ${path.join(".")}: ${text}:`); err.depth = path.length + 1; throw err; } - var typeA = target === null ? "null" : typeof target; - var typeB = source === null ? "null" : typeof source; + const typeA = target === null ? "null" : typeof target; + const typeB = source === null ? "null" : typeof source; if (typeA !== typeB) { error( `have different types (${typeA} !== ${typeB}) (${target} !== ${source})` @@ -26,9 +28,9 @@ module.exports = function assertImplementsAST(target, source, path) { .name} !== ${source.constructor.name}` ); } else if (typeA === "object") { - var keysTarget = Object.keys(target); - for (var i in keysTarget) { - var key = keysTarget[i]; + const keysTarget = Object.keys(target); + for (const i in keysTarget) { + const key = keysTarget[i]; path.push(key); assertImplementsAST(target[key], source[key], path); path.pop(); diff --git a/eslint/babel-eslint-parser/test/fixtures/preprocess-to-patch.js b/eslint/babel-eslint-parser/test/fixtures/preprocess-to-patch.js index 1dbfc172a106..8cb4c54fb6de 100644 --- a/eslint/babel-eslint-parser/test/fixtures/preprocess-to-patch.js +++ b/eslint/babel-eslint-parser/test/fixtures/preprocess-to-patch.js @@ -1,4 +1,5 @@ "use strict" + const babelEslint = require("../..") // Apply monkeypatch to eslint-scope. diff --git a/eslint/babel-eslint-parser/test/integration.js b/eslint/babel-eslint-parser/test/integration.js index 09e4af9d6486..2462cd5d3882 100644 --- a/eslint/babel-eslint-parser/test/integration.js +++ b/eslint/babel-eslint-parser/test/integration.js @@ -1,16 +1,18 @@ -var assert = require("assert"); -var eslint = require("eslint"); -var fs = require("fs"); -var path = require("path"); +"use strict"; -var paths = { +const assert = require("assert"); +const eslint = require("eslint"); +const fs = require("fs"); +const path = require("path"); + +const paths = { fixtures: path.join(__dirname, "fixtures", "rules"), }; -var encoding = "utf8"; -var errorLevel = 2; +const encoding = "utf8"; +const errorLevel = 2; -var baseEslintOpts = { +const baseEslintOpts = { parser: require.resolve(".."), parserOptions: { sourceType: "script", @@ -48,10 +50,10 @@ describe("Rules:", () => { // describe function strictSuite() { - var ruleId = "strict"; + const ruleId = "strict"; describe("when set to 'never'", () => { - var eslintOpts = Object.assign({}, baseEslintOpts, { + const eslintOpts = Object.assign({}, baseEslintOpts, { rules: {}, }); eslintOpts.rules[ruleId] = [errorLevel, "never"]; @@ -76,7 +78,7 @@ function strictSuite() { // describe describe("when set to 'global'", () => { - var eslintOpts = Object.assign({}, baseEslintOpts, { + const eslintOpts = Object.assign({}, baseEslintOpts, { rules: {}, }); eslintOpts.rules[ruleId] = [errorLevel, "global"]; @@ -152,7 +154,7 @@ function strictSuite() { // describe describe("when set to 'function'", () => { - var eslintOpts = Object.assign({}, baseEslintOpts, { + const eslintOpts = Object.assign({}, baseEslintOpts, { rules: {}, }); eslintOpts.rules[ruleId] = [errorLevel, "function"]; diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index 4c43b29f3f71..fc1d3416be88 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1,7 +1,7 @@ -/*eslint-env mocha*/ "use strict"; -var eslint = require("eslint"); -var unpad = require("dedent"); + +const eslint = require("eslint"); +const unpad = require("dedent"); function verifyAndAssertMessagesWithSpecificESLint( code, @@ -11,7 +11,7 @@ function verifyAndAssertMessagesWithSpecificESLint( overrideConfig, linter ) { - var config = { + const config = { parser: require.resolve(".."), rules, env: { @@ -30,12 +30,12 @@ function verifyAndAssertMessagesWithSpecificESLint( }; if (overrideConfig) { - for (var key in overrideConfig) { + for (const key in overrideConfig) { config[key] = overrideConfig[key]; } } - var messages = linter.verify(code, config); + const messages = linter.verify(code, config); if (messages.length !== expectedMessages.length) { throw new Error( @@ -46,7 +46,7 @@ function verifyAndAssertMessagesWithSpecificESLint( } messages.forEach((message, i) => { - var formatedMessage = `${message.line}:${message.column} ${ + const formatedMessage = `${message.line}:${message.column} ${ message.message }${message.ruleId ? ` ${message.ruleId}` : ""}`; if (formatedMessage !== expectedMessages[i]) { diff --git a/eslint/babel-eslint-parser/test/z_parser-for-eslint-after-patched.js b/eslint/babel-eslint-parser/test/z_parser-for-eslint-after-patched.js index a7d6882d351e..265fb5f04009 100644 --- a/eslint/babel-eslint-parser/test/z_parser-for-eslint-after-patched.js +++ b/eslint/babel-eslint-parser/test/z_parser-for-eslint-after-patched.js @@ -4,7 +4,7 @@ const eslint = require("eslint"); const assert = require("assert"); const babelEslint = require(".."); const espree = require("espree"); -var assertImplementsAST = require("./fixtures/assert-implements-ast"); +const assertImplementsAST = require("./fixtures/assert-implements-ast"); describe("https://github.com/babel/babel-eslint/issues/558", () => { it("don't crash with eslint-plugin-import", () => { From de38cfc510b6ad8db480e10a369c618eb50d36e6 Mon Sep 17 00:00:00 2001 From: Emerson Laurentino Date: Wed, 7 Nov 2018 16:36:11 -0300 Subject: [PATCH 453/569] fix index path typo (babel/babel-eslint#709) --- eslint/babel-eslint-parser/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index 6a4f9085e3ac..26205f38a2ed 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -38,7 +38,7 @@ aren't supported by ESLint. When using this plugin, ESLint is monkeypatched and transformed into code that ESLint can understand. All location info such as line numbers, columns is also retained so you can track down errors with ease. -Basically `babel-eslint` exports an [`index.js`](/index.js) that a linter can use. +Basically `babel-eslint` exports an [`index.js`](/lib/index.js) that a linter can use. It just needs to export a `parse` method that takes in a string of code and outputs an AST. ## Usage From c209725ada5d8ac056c8f1b8ce166a6229b233b4 Mon Sep 17 00:00:00 2001 From: Kai Cataldo Date: Thu, 8 Nov 2018 10:43:04 -0500 Subject: [PATCH 454/569] Test Node v11 in CI (babel/babel-eslint#712) --- eslint/babel-eslint-parser/.travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint/babel-eslint-parser/.travis.yml b/eslint/babel-eslint-parser/.travis.yml index 218432b1103f..21826d3469db 100644 --- a/eslint/babel-eslint-parser/.travis.yml +++ b/eslint/babel-eslint-parser/.travis.yml @@ -1,6 +1,7 @@ sudo: false language: node_js node_js: + - "11" - "10" - "8" - "6" From bede064c0b58d96b452f437cf9965845b4b5ac41 Mon Sep 17 00:00:00 2001 From: Kai Cataldo Date: Mon, 7 Jan 2019 09:55:16 -0500 Subject: [PATCH 455/569] Major: remove parseNoPatch (babel/babel-eslint#733) --- eslint/babel-eslint-parser/lib/index.js | 4 ---- eslint/babel-eslint-parser/test/babel-eslint.js | 9 --------- 2 files changed, 13 deletions(-) diff --git a/eslint/babel-eslint-parser/lib/index.js b/eslint/babel-eslint-parser/lib/index.js index 9e527d26d7f8..c2611a9d442a 100644 --- a/eslint/babel-eslint-parser/lib/index.js +++ b/eslint/babel-eslint-parser/lib/index.js @@ -13,7 +13,3 @@ exports.parseForESLint = function(code, options) { return require("./parse-with-scope")(code, options); }; - -exports.parseNoPatch = function(code, options) { - return require("./parse")(code, options); -}; diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/babel-eslint.js index ce270f113b13..1dc611af2692 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/babel-eslint.js @@ -536,12 +536,3 @@ describe("babylon-to-espree", () => { }); }); }); - -describe("Public API", () => { - it("exports a parseNoPatch function", () => { - assertImplementsAST( - espree.parse("foo"), - babelEslint.parseNoPatch("foo", {}) - ); - }); -}); From 47de99e1b864554e0b3e809c8cd2e47bd941605b Mon Sep 17 00:00:00 2001 From: Kai Cataldo Date: Thu, 10 Jan 2019 15:25:00 -0500 Subject: [PATCH 456/569] Use @babel/core#parse (babel/babel-eslint#711) --- eslint/babel-eslint-parser/.eslintignore | 1 + eslint/babel-eslint-parser/.eslintrc.js | 16 +- eslint/babel-eslint-parser/README.md | 140 +-- .../babel-eslint-parser/lib/analyze-scope.js | 2 +- .../lib/babylon-to-espree/toAST.js | 2 +- eslint/babel-eslint-parser/lib/index.js | 21 + eslint/babel-eslint-parser/lib/parse.js | 96 +- .../babel-eslint-parser/lib/visitor-keys.js | 2 +- eslint/babel-eslint-parser/package.json | 52 +- .../babel-eslint-parser/test/babel.config.js | 21 + .../config/babel.config.decorators-legacy.js | 6 + .../assert-implements-ast.js | 7 +- .../test/{ => specs}/babel-eslint.js | 4 +- .../test/{ => specs}/integration.js | 64 +- .../test/{ => specs}/non-regression.js | 17 +- .../z_parser-for-eslint-after-patched.js | 10 +- eslint/babel-eslint-parser/yarn.lock | 962 +++++++++++++++++- 17 files changed, 1144 insertions(+), 279 deletions(-) create mode 100644 eslint/babel-eslint-parser/test/babel.config.js create mode 100644 eslint/babel-eslint-parser/test/fixtures/config/babel.config.decorators-legacy.js rename eslint/babel-eslint-parser/test/{fixtures => helpers}/assert-implements-ast.js (89%) rename eslint/babel-eslint-parser/test/{ => specs}/babel-eslint.js (99%) rename eslint/babel-eslint-parser/test/{ => specs}/integration.js (75%) rename eslint/babel-eslint-parser/test/{ => specs}/non-regression.js (99%) rename eslint/babel-eslint-parser/test/{ => specs}/z_parser-for-eslint-after-patched.js (84%) diff --git a/eslint/babel-eslint-parser/.eslintignore b/eslint/babel-eslint-parser/.eslintignore index a843dc44a197..b18b9022cf17 100644 --- a/eslint/babel-eslint-parser/.eslintignore +++ b/eslint/babel-eslint-parser/.eslintignore @@ -1 +1,2 @@ +!.*.js test/fixtures diff --git a/eslint/babel-eslint-parser/.eslintrc.js b/eslint/babel-eslint-parser/.eslintrc.js index 169516cb3f84..a8781be62911 100644 --- a/eslint/babel-eslint-parser/.eslintrc.js +++ b/eslint/babel-eslint-parser/.eslintrc.js @@ -1,12 +1,12 @@ +"use strict"; + module.exports = { root: true, extends: "babel", - "plugins": [ - "prettier" - ], + plugins: ["prettier"], rules: { "max-len": "off", - "strict": "error", + strict: "error", "prettier/prettier": "error", }, env: { @@ -19,8 +19,8 @@ module.exports = { { files: ["test/**/*"], env: { - mocha: true - } - } - ] + mocha: true, + }, + }, + ], }; diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index 26205f38a2ed..ad8fc01d0d0e 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -3,101 +3,107 @@ **babel-eslint** allows you to lint **ALL** valid Babel code with the fantastic [ESLint](https://github.com/eslint/eslint). -### Why Use babel-eslint +## Breaking change in v11.x.x -You only need to use babel-eslint if you are using types (Flow) or experimental features not supported in ESLint itself yet. Otherwise try the default parser (you don't have to use it just because you are using Babel). +As of the v11.x.x release, babel-eslint now requires Babel as a peer dependency and expects a valid [Babel configuration file](https://babeljs.io/docs/en/configuration) to exist. This ensures that the same Babel configuration is used during both linting and compilation. ---- +## When should I use babel-eslint? -> If there is an issue, first check if it can be reproduced with the regular parser or with the latest versions of `eslint` and `babel-eslint`! +ESLint's default parser and core rules [only suppport the latest final ECMAScript standard](https://github.com/eslint/eslint/blob/a675c89573836adaf108a932696b061946abf1e6/README.md#what-about-experimental-features) and do not support experimental (such as new features) and non-standard (such as Flow or TypeScript types) syntax provided by Babel. babel-eslint is a parser that allows ESLint to run on source code that is transformed by Babel. -For questions and support please visit the [`#discussion`](https://babeljs.slack.com/messages/discussion/) babel slack channel (sign up [here](https://github.com/babel/notes/issues/38)) or eslint [gitter](https://gitter.im/eslint/eslint)! - -> Note that the `ecmaFeatures` config property may still be required for ESLint to work properly with features not in ECMAScript 5 by default. Examples are `globalReturn` and `modules`). - -## Known Issues - -Flow: -> Check out [eslint-plugin-flowtype](https://github.com/gajus/eslint-plugin-flowtype): An `eslint` plugin that makes flow type annotations global variables and marks declarations as used. Solves the problem of false positives with `no-undef` and `no-unused-vars`. -- `no-undef` for global flow types: `ReactElement`, `ReactClass` [#130](https://github.com/babel/babel-eslint/issues/130#issuecomment-111215076) - - Workaround: define types as globals in `.eslintrc` or define types and import them `import type ReactElement from './types'` -- `no-unused-vars/no-undef` with Flow declarations (`declare module A {}`) [#132](https://github.com/babel/babel-eslint/issues/132#issuecomment-112815926) - -Modules/strict mode -- `no-unused-vars: [2, {vars: local}]` [#136](https://github.com/babel/babel-eslint/issues/136) - -Please check out [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) for React/JSX issues -- `no-unused-vars` with jsx - -Please check out [eslint-plugin-babel](https://github.com/babel/eslint-plugin-babel) for other issues +**Note:** You only need to use babel-eslint if you are using Babel to transform your code. If this is not the case, please use the relevant parser for your chosen flavor of ECMAScript (note that the default parser supports all non-experimental syntax as well as JSX). ## How does it work? -ESLint allows custom parsers. This is great but some of the syntax nodes that Babel supports -aren't supported by ESLint. When using this plugin, ESLint is monkeypatched and your code is -transformed into code that ESLint can understand. All location info such as line numbers, +ESLint allows for the use of [custom parsers](https://eslint.org/docs/developer-guide/working-with-custom-parsers). When using this plugin, your code is parsed by Babel's parser (using the configuration specified in your [Babel configuration file](https://babeljs.io/docs/en/configuration)) and the resulting AST is +transformed into an [ESTree](https://github.com/estree/estree)-compliant structure that ESLint can understand. All location info such as line numbers, columns is also retained so you can track down errors with ease. -Basically `babel-eslint` exports an [`index.js`](/lib/index.js) that a linter can use. -It just needs to export a `parse` method that takes in a string of code and outputs an AST. +**Note:** ESLint's core rules do not support experimental syntax and may therefore not work as expected when using babel-eslint. Please use the companion [`eslint-plugin-babel`](https://github.com/babel/eslint-plugin-babel) plugin for core rules that you have issues with. ## Usage -### Supported ESLint versions - -ESLint | babel-eslint ------------- | ------------- -4.x | >= 6.x -3.x | >= 6.x -2.x | >= 6.x -1.x | >= 5.x - -### Install - -Ensure that you have substituted the correct version lock for `eslint` and `babel-eslint` into this command: +### Installation ```sh -$ npm install eslint@4.x babel-eslint@8 --save-dev +$ npm install eslint babel-eslint --save-dev # or -$ yarn add eslint@4.x babel-eslint@8 -D +$ yarn add eslint babel-eslint -D ``` +**Note:** babel-eslint requires `babel/core@>=7.2.0` and a valid Babel configuration file to run. If you do not have this already set up, please see the [Babel Usage Guide](https://babeljs.io/docs/en/usage). + ### Setup -**.eslintrc** +To use babel-eslint, `"babel-eslint"` must be specified as the `parser` in your ESLint configuration file (see [here](https://eslint.org/docs/user-guide/configuring#specifying-parser) for more detailed information). + +**.eslintrc.js** -```json -{ - "parser": "babel-eslint", - "rules": { - "strict": 0 - } -} +```js +module.exports = { + parser: "babel-eslint", +}; ``` -Check out the [ESLint docs](http://eslint.org/docs/rules/) for all possible rules. +With the parser set, your configuration can be configured as described in the [Configuring ESLint](https://eslint.org/docs/user-guide/configuring) documentation. + +**Note:** The `parserOptions` described in the [official documentation](https://eslint.org/docs/user-guide/configuring#specifying-parser-options) are for the default parser and are not necessarily supported by babel-eslint. Please see the section directly below for supported `parserOptions`. + +### Additional parser configuration -### Configuration +Additional configuration options can be set in your ESLint configuration under the `parserOptions` key. Please note that the `ecmaFeatures` config property may still be required for ESLint to work properly with features not in ECMAScript 5 by default. -- `sourceType` can be set to `'module'`(default) or `'script'` if your code isn't using ECMAScript modules. +- `sourceType` can be set to `"module"`(default) or `"script"` if your code isn't using ECMAScript modules. - `allowImportExportEverywhere` (default `false`) can be set to `true` to allow import and export declarations to appear anywhere a statement is allowed if your build environment supports that. Otherwise import and export declarations can only appear at a program's top level. -- `codeFrame` (default `true`) can be set to `false` to disable the code frame in the reporter. This is useful since some eslint formatters don't play well with it. - -**.eslintrc** - -```json -{ - "parser": "babel-eslint", - "parserOptions": { - "sourceType": "module", - "allowImportExportEverywhere": false, - "codeFrame": true - } -} +- `ecmaFeatures.globalReturn` (default `false`) allow return statements in the global scope when used with `sourceType: "script"`. +- `babelOptions` passes through Babel's configuration [loading](https://babeljs.io/docs/en/options#config-loading-options) and [merging](https://babeljs.io/docs/en/options#config-merging-options) options (for instance, in case of a monorepo). When not defined, babel-eslint will use Babel's default configuration file resolution logic. + +**.eslintrc.js** + +```js +module.exports = { + parser: "babel-eslint", + parserOptions: { + sourceType: "module", + allowImportExportEverywhere: false, + ecmaFeatures: { + globalReturn: false, + }, + babelOptions: { + configFile: "path/to/config.js", + }, + }, +}; ``` ### Run ```sh -$ eslint your-files-here +$ ./node_modules/.bin/eslint yourfile.js ``` + +## Known issues + +Flow: + +> Check out [eslint-plugin-flowtype](https://github.com/gajus/eslint-plugin-flowtype): An `eslint` plugin that makes flow type annotations global variables and marks declarations as used. Solves the problem of false positives with `no-undef` and `no-unused-vars`. + +- `no-undef` for global flow types: `ReactElement`, `ReactClass` [#130](https://github.com/babel/babel-eslint/issues/130#issuecomment-111215076) + - Workaround: define types as globals in `.eslintrc` or define types and import them `import type ReactElement from './types'` +- `no-unused-vars/no-undef` with Flow declarations (`declare module A {}`) [#132](https://github.com/babel/babel-eslint/issues/132#issuecomment-112815926) + +Modules/strict mode + +- `no-unused-vars: ["error", { vars: local }]` [#136](https://github.com/babel/babel-eslint/issues/136) + +Please check out [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) for React/JSX issues. + +- `no-unused-vars` with jsx + +Please check out [eslint-plugin-babel](https://github.com/babel/eslint-plugin-babel) for other issues. + +## Questions and support + +If you have an issue, please first check if it can be reproduced with the default parser and with the latest versions of `eslint` and `babel-eslint`. If it is not reproducible with the default parser, it is most likely an issue with babel-eslint. + +For questions and support please visit the [`#discussion`](https://babeljs.slack.com/messages/discussion/) Babel Slack channel (sign up [here](https://github.com/babel/notes/issues/38)) or the ESLint [Gitter](https://gitter.im/eslint/eslint). diff --git a/eslint/babel-eslint-parser/lib/analyze-scope.js b/eslint/babel-eslint-parser/lib/analyze-scope.js index 9b2a40d6dbf4..aa3431a4cc51 100644 --- a/eslint/babel-eslint-parser/lib/analyze-scope.js +++ b/eslint/babel-eslint-parser/lib/analyze-scope.js @@ -1,6 +1,6 @@ "use strict"; -const t = require("@babel/types"); +const t = require("@babel/core").types; const escope = require("eslint-scope"); const Definition = require("eslint-scope/lib/definition").Definition; const OriginalPatternVisitor = require("eslint-scope/lib/pattern-visitor"); diff --git a/eslint/babel-eslint-parser/lib/babylon-to-espree/toAST.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/toAST.js index e375f69dd1bd..2ab165df69ec 100644 --- a/eslint/babel-eslint-parser/lib/babylon-to-espree/toAST.js +++ b/eslint/babel-eslint-parser/lib/babylon-to-espree/toAST.js @@ -1,6 +1,6 @@ "use strict"; -const t = require("@babel/types"); +const t = require("@babel/core").types; const convertComments = require("./convertComments"); module.exports = function(ast, traverse, code) { diff --git a/eslint/babel-eslint-parser/lib/index.js b/eslint/babel-eslint-parser/lib/index.js index c2611a9d442a..c9478419f18e 100644 --- a/eslint/babel-eslint-parser/lib/index.js +++ b/eslint/babel-eslint-parser/lib/index.js @@ -1,11 +1,32 @@ "use strict"; +const semver = require("semver"); +const babelCore = require("@babel/core"); +const packageJson = require("../package.json"); + +const CURRENT_BABEL_VERSION = babelCore.version; +const SUPPORTED_BABEL_VERSION_RANGE = + packageJson.peerDependencies["@babel/core"]; +const IS_RUNNING_SUPPORTED_VERSION = semver.satisfies( + CURRENT_BABEL_VERSION, + SUPPORTED_BABEL_VERSION_RANGE +); + exports.parse = function(code, options) { return exports.parseForESLint(code, options).ast; }; exports.parseForESLint = function(code, options) { + if (!IS_RUNNING_SUPPORTED_VERSION) { + throw new Error( + `babel-eslint@${ + packageJson.version + } does not support @babel/core@${CURRENT_BABEL_VERSION}. Please downgrade to babel-eslint@^10 or upgrade to @babel/core@${SUPPORTED_BABEL_VERSION_RANGE}` + ); + } + options = options || {}; + options.babelOptions = options.babelOptions || {}; options.ecmaVersion = options.ecmaVersion || 2018; options.sourceType = options.sourceType || "module"; options.allowImportExportEverywhere = diff --git a/eslint/babel-eslint-parser/lib/parse.js b/eslint/babel-eslint-parser/lib/parse.js index 0817df4b0783..f6b55a1486ba 100644 --- a/eslint/babel-eslint-parser/lib/parse.js +++ b/eslint/babel-eslint-parser/lib/parse.js @@ -1,54 +1,38 @@ "use strict"; const babylonToEspree = require("./babylon-to-espree"); -const parse = require("@babel/parser").parse; -const tt = require("@babel/parser").tokTypes; -const traverse = require("@babel/traverse").default; -const codeFrameColumns = require("@babel/code-frame").codeFrameColumns; +const { parseSync: parse, tokTypes: tt, traverse } = require("@babel/core"); module.exports = function(code, options) { - const legacyDecorators = - options.ecmaFeatures && options.ecmaFeatures.legacyDecorators; - const opts = { - codeFrame: options.hasOwnProperty("codeFrame") ? options.codeFrame : true, sourceType: options.sourceType, - allowImportExportEverywhere: options.allowImportExportEverywhere, // consistent with espree - allowReturnOutsideFunction: true, - allowSuperOutsideMethod: true, - ranges: true, - tokens: true, - plugins: [ - ["flow", { all: true }], - "jsx", - "estree", - "asyncFunctions", - "asyncGenerators", - "classConstructorCall", - "classProperties", - legacyDecorators - ? "decorators-legacy" - : ["decorators", { decoratorsBeforeExport: false }], - "doExpressions", - "exponentiationOperator", - "exportDefaultFrom", - "exportNamespaceFrom", - "functionBind", - "functionSent", - "objectRestSpread", - "trailingFunctionCommas", - "dynamicImport", - "numericSeparator", - "optionalChaining", - "importMeta", - "classPrivateProperties", - "bigInt", - "optionalCatchBinding", - "throwExpressions", - ["pipelineOperator", { proposal: "minimal" }], - "nullishCoalescingOperator", - "logicalAssignment", - ], + filename: options.filePath, + cwd: options.babelOptions.cwd, + root: options.babelOptions.root, + rootMode: options.babelOptions.rootMode, + envName: options.babelOptions.envName, + configFile: options.babelOptions.configFile, + babelrc: options.babelOptions.babelrc, + babelrcRoots: options.babelOptions.babelrcRoots, + extends: options.babelOptions.extends, + env: options.babelOptions.env, + overrides: options.babelOptions.overrides, + test: options.babelOptions.test, + include: options.babelOptions.include, + exclude: options.babelOptions.exclude, + ignore: options.babelOptions.ignore, + only: options.babelOptions.only, + parserOpts: { + allowImportExportEverywhere: options.allowImportExportEverywhere, // consistent with espree + allowReturnOutsideFunction: true, + allowSuperOutsideMethod: true, + ranges: true, + tokens: true, + plugins: ["estree"], + }, + caller: { + name: "babel-eslint", + }, }; let ast; @@ -58,30 +42,6 @@ module.exports = function(code, options) { if (err instanceof SyntaxError) { err.lineNumber = err.loc.line; err.column = err.loc.column; - - if (opts.codeFrame) { - err.lineNumber = err.loc.line; - err.column = err.loc.column + 1; - - // remove trailing "(LINE:COLUMN)" acorn message and add in esprima syntax error message start - err.message = - "Line " + - err.lineNumber + - ": " + - err.message.replace(/ \((\d+):(\d+)\)$/, "") + - // add codeframe - "\n\n" + - codeFrameColumns( - code, - { - start: { - line: err.lineNumber, - column: err.column, - }, - }, - { highlightCode: true } - ); - } } throw err; diff --git a/eslint/babel-eslint-parser/lib/visitor-keys.js b/eslint/babel-eslint-parser/lib/visitor-keys.js index 921a0bb01657..2ac01887f14c 100644 --- a/eslint/babel-eslint-parser/lib/visitor-keys.js +++ b/eslint/babel-eslint-parser/lib/visitor-keys.js @@ -1,6 +1,6 @@ "use strict"; -const BABEL_VISITOR_KEYS = require("@babel/types").VISITOR_KEYS; +const BABEL_VISITOR_KEYS = require("@babel/core").types.VISITOR_KEYS; const ESLINT_VISITOR_KEYS = require("eslint-visitor-keys").KEYS; module.exports = Object.assign( diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 5d3486296fae..e43b064a5ed5 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -2,44 +2,56 @@ "name": "babel-eslint", "version": "10.0.1", "description": "Custom parser for ESLint", - "main": "lib/index.js", - "files": [ - "lib" - ], + "author": "Sebastian McKenzie ", + "license": "MIT", "repository": { "type": "git", "url": "https://github.com/babel/babel-eslint.git" }, - "dependencies": { - "@babel/code-frame": "^7.0.0", - "@babel/parser": "^7.0.0", - "@babel/traverse": "^7.0.0", - "@babel/types": "^7.0.0", - "eslint-scope": "3.7.1", - "eslint-visitor-keys": "^1.0.0" + "bugs": { + "url": "https://github.com/babel/babel-eslint/issues" }, + "homepage": "https://github.com/babel/babel-eslint", "scripts": { "test": "npm run lint && npm run test-only", - "test-only": "mocha && mocha --require test/fixtures/preprocess-to-patch.js", - "lint": "eslint lib test", - "fix": "eslint lib test --fix", + "test-only": "cd test && mocha --require fixtures/preprocess-to-patch.js specs && cd -", + "lint": "eslint .", + "lint-fix": "npm run lint -- --fix", "precommit": "lint-staged", "preversion": "npm test", "changelog": "git log `git describe --tags --abbrev=0`..HEAD --pretty=format:' * %s (%an)' | grep -v 'Merge pull request'" }, - "author": "Sebastian McKenzie ", - "license": "MIT", "engines": { "node": ">=6" }, - "bugs": { - "url": "https://github.com/babel/babel-eslint/issues" - }, - "homepage": "https://github.com/babel/babel-eslint", + "main": "lib/index.js", + "files": [ + "lib" + ], "peerDependencies": { + "@babel/core": ">=7.2.0", "eslint": ">= 4.12.1" }, + "dependencies": { + "eslint-scope": "3.7.1", + "eslint-visitor-keys": "^1.0.0", + "semver": "^5.6.0" + }, "devDependencies": { + "@babel/core": "^7.2.0", + "@babel/plugin-proposal-class-properties": "^7.1.0", + "@babel/plugin-proposal-decorators": "^7.1.2", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0", + "@babel/plugin-proposal-optional-chaining": "^7.0.0", + "@babel/plugin-proposal-pipeline-operator": "^7.0.0", + "@babel/plugin-syntax-dynamic-import": "^7.0.0", + "@babel/plugin-syntax-export-default-from": "^7.0.0", + "@babel/plugin-syntax-export-namespace-from": "^7.0.0", + "@babel/plugin-syntax-import-meta": "^7.0.0", + "@babel/plugin-syntax-numeric-separator": "^7.0.0", + "@babel/preset-env": "^7.1.5", + "@babel/preset-flow": "^7.0.0", + "@babel/preset-react": "^7.0.0", "babel-eslint": "^8.2.6", "dedent": "^0.7.0", "eslint": "^5.6.0", diff --git a/eslint/babel-eslint-parser/test/babel.config.js b/eslint/babel-eslint-parser/test/babel.config.js new file mode 100644 index 000000000000..4d49158dba90 --- /dev/null +++ b/eslint/babel-eslint-parser/test/babel.config.js @@ -0,0 +1,21 @@ +"use strict"; + +module.exports = { + presets: [ + ["@babel/preset-env", { forceAllTransforms: true }], + ["@babel/preset-flow", { all: true }], + "@babel/preset-react", + ], + plugins: [ + "@babel/plugin-syntax-dynamic-import", + "@babel/plugin-syntax-import-meta", + "@babel/plugin-syntax-export-default-from", + "@babel/plugin-proposal-class-properties", + "@babel/plugin-proposal-nullish-coalescing-operator", + "@babel/plugin-proposal-optional-chaining", + "@babel/plugin-syntax-numeric-separator", + "@babel/plugin-syntax-export-namespace-from", + ["@babel/plugin-proposal-decorators", { decoratorsBeforeExport: false }], + ["@babel/plugin-proposal-pipeline-operator", { proposal: "minimal" }], + ], +}; diff --git a/eslint/babel-eslint-parser/test/fixtures/config/babel.config.decorators-legacy.js b/eslint/babel-eslint-parser/test/fixtures/config/babel.config.decorators-legacy.js new file mode 100644 index 000000000000..dbad846412e6 --- /dev/null +++ b/eslint/babel-eslint-parser/test/fixtures/config/babel.config.decorators-legacy.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = { + presets: [["@babel/preset-env", { forceAllTransforms: true }]], + plugins: [["@babel/plugin-proposal-decorators", { legacy: true }]], +}; diff --git a/eslint/babel-eslint-parser/test/fixtures/assert-implements-ast.js b/eslint/babel-eslint-parser/test/helpers/assert-implements-ast.js similarity index 89% rename from eslint/babel-eslint-parser/test/fixtures/assert-implements-ast.js rename to eslint/babel-eslint-parser/test/helpers/assert-implements-ast.js index 90dceb0dba26..892d200c612a 100644 --- a/eslint/babel-eslint-parser/test/fixtures/assert-implements-ast.js +++ b/eslint/babel-eslint-parser/test/helpers/assert-implements-ast.js @@ -1,4 +1,4 @@ -"use strict" +"use strict"; // Checks if the source ast implements the target ast. Ignores extra keys on source ast module.exports = function assertImplementsAST(target, source, path) { @@ -24,8 +24,9 @@ module.exports = function assertImplementsAST(target, source, path) { target.constructor.name !== source.constructor.name ) { error( - `object have different constructors (${target.constructor - .name} !== ${source.constructor.name}` + `object have different constructors (${target.constructor.name} !== ${ + source.constructor.name + }` ); } else if (typeA === "object") { const keysTarget = Object.keys(target); diff --git a/eslint/babel-eslint-parser/test/babel-eslint.js b/eslint/babel-eslint-parser/test/specs/babel-eslint.js similarity index 99% rename from eslint/babel-eslint-parser/test/babel-eslint.js rename to eslint/babel-eslint-parser/test/specs/babel-eslint.js index 1dc611af2692..becf4e31c590 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/specs/babel-eslint.js @@ -1,12 +1,12 @@ "use strict"; const assert = require("assert"); -const babelEslint = require(".."); +const babelEslint = require("../.."); const espree = require("espree"); const escope = require("eslint-scope"); const util = require("util"); const unpad = require("dedent"); -const assertImplementsAST = require("./fixtures/assert-implements-ast"); +const assertImplementsAST = require("../helpers/assert-implements-ast"); function lookup(obj, keypath, backwardsDepth) { if (!keypath) { diff --git a/eslint/babel-eslint-parser/test/integration.js b/eslint/babel-eslint-parser/test/specs/integration.js similarity index 75% rename from eslint/babel-eslint-parser/test/integration.js rename to eslint/babel-eslint-parser/test/specs/integration.js index 2462cd5d3882..4e0851d8a42d 100644 --- a/eslint/babel-eslint-parser/test/integration.js +++ b/eslint/babel-eslint-parser/test/specs/integration.js @@ -6,14 +6,14 @@ const fs = require("fs"); const path = require("path"); const paths = { - fixtures: path.join(__dirname, "fixtures", "rules"), + fixtures: path.join(__dirname, "..", "fixtures", "rules"), }; const encoding = "utf8"; const errorLevel = 2; const baseEslintOpts = { - parser: require.resolve(".."), + parser: require.resolve("../.."), parserOptions: { sourceType: "script", }, @@ -222,64 +222,4 @@ function strictSuite() { }); // it }); - // describe - describe('When "codeFrame"', () => { - // Strip chalk colors, these are not relevant for the test - const stripAnsi = str => - str.replace( - // eslint-disable-next-line no-control-regex - /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, - "" - ); - - it("should display codeFrame when option is absent", done => { - lint( - { - fixture: ["syntax-error"], - eslint: baseEslintOpts, - }, - (err, report) => { - if (err) return done(err); - assert(stripAnsi(report[0].message).indexOf("^\n 5 |") > -1); - done(); - } - ); - }); - - it("should display codeFrame when option is true", done => { - lint( - { - fixture: ["syntax-error"], - eslint: Object.assign({}, baseEslintOpts, { - parserOptions: { - codeFrame: true, - }, - }), - }, - (err, report) => { - if (err) return done(err); - assert(stripAnsi(report[0].message).indexOf("^\n 5 |") > -1); - done(); - } - ); - }); - - it("should not display codeFrame when option is false", done => { - lint( - { - fixture: ["syntax-error"], - eslint: Object.assign({}, baseEslintOpts, { - parserOptions: { - codeFrame: false, - }, - }), - }, - (err, report) => { - if (err) return done(err); - assert(stripAnsi(report[0].message).indexOf("^\n 5 |") === -1); - done(); - } - ); - }); - }); } diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/specs/non-regression.js similarity index 99% rename from eslint/babel-eslint-parser/test/non-regression.js rename to eslint/babel-eslint-parser/test/specs/non-regression.js index fc1d3416be88..79754dab5edf 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/specs/non-regression.js @@ -1,6 +1,7 @@ "use strict"; const eslint = require("eslint"); +const path = require("path"); const unpad = require("dedent"); function verifyAndAssertMessagesWithSpecificESLint( @@ -12,20 +13,17 @@ function verifyAndAssertMessagesWithSpecificESLint( linter ) { const config = { - parser: require.resolve(".."), + parser: require.resolve("../.."), rules, env: { node: true, es6: true, }, parserOptions: { - ecmaVersion: 2018, + sourceType, ecmaFeatures: { - jsx: true, - experimentalObjectRestSpread: true, globalReturn: true, }, - sourceType, }, }; @@ -1155,10 +1153,13 @@ describe("verify", () => { ) { const overrideConfig = { parserOptions: { - ecmaFeatures: { - legacyDecorators: true, - }, sourceType, + babelOptions: { + configFile: path.resolve( + __dirname, + "../fixtures/config/babel.config.decorators-legacy.js" + ), + }, }, }; return verifyAndAssertMessages( diff --git a/eslint/babel-eslint-parser/test/z_parser-for-eslint-after-patched.js b/eslint/babel-eslint-parser/test/specs/z_parser-for-eslint-after-patched.js similarity index 84% rename from eslint/babel-eslint-parser/test/z_parser-for-eslint-after-patched.js rename to eslint/babel-eslint-parser/test/specs/z_parser-for-eslint-after-patched.js index 265fb5f04009..bc787db34951 100644 --- a/eslint/babel-eslint-parser/test/z_parser-for-eslint-after-patched.js +++ b/eslint/babel-eslint-parser/test/specs/z_parser-for-eslint-after-patched.js @@ -2,17 +2,17 @@ const eslint = require("eslint"); const assert = require("assert"); -const babelEslint = require(".."); +const babelEslint = require("../.."); const espree = require("espree"); -const assertImplementsAST = require("./fixtures/assert-implements-ast"); +const assertImplementsAST = require("../helpers/assert-implements-ast"); describe("https://github.com/babel/babel-eslint/issues/558", () => { it("don't crash with eslint-plugin-import", () => { const engine = new eslint.CLIEngine({ ignore: false }); engine.executeOnFiles([ - "test/fixtures/eslint-plugin-import/a.js", - "test/fixtures/eslint-plugin-import/b.js", - "test/fixtures/eslint-plugin-import/c.js", + "../test/fixtures/eslint-plugin-import/a.js", + "../test/fixtures/eslint-plugin-import/b.js", + "../test/fixtures/eslint-plugin-import/c.js", ]); }); diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index c3099c04cfff..aec76fb40e5f 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -14,6 +14,26 @@ dependencies: "@babel/highlight" "^7.0.0" +"@babel/core@^7.2.0": + version "7.2.2" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.2.2.tgz#07adba6dde27bb5ad8d8672f15fde3e08184a687" + integrity sha512-59vB0RWt09cAct5EIe58+NzGP4TFSD3Bz//2/ELy3ZeTeKF6VTD1AXlH8BGGbCX0PuobZBsIzO7IAI9PH67eKw== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/generator" "^7.2.2" + "@babel/helpers" "^7.2.0" + "@babel/parser" "^7.2.2" + "@babel/template" "^7.2.2" + "@babel/traverse" "^7.2.2" + "@babel/types" "^7.2.2" + convert-source-map "^1.1.0" + debug "^4.1.0" + json5 "^2.1.0" + lodash "^4.17.10" + resolve "^1.3.2" + semver "^5.4.1" + source-map "^0.5.0" + "@babel/generator@7.0.0-beta.44": version "7.0.0-beta.44" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0-beta.44.tgz#c7e67b9b5284afcf69b309b50d7d37f3e5033d42" @@ -24,16 +44,77 @@ source-map "^0.5.0" trim-right "^1.0.1" -"@babel/generator@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0.tgz#1efd58bffa951dc846449e58ce3a1d7f02d393aa" +"@babel/generator@^7.1.5": + version "7.1.5" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.1.5.tgz#615f064d13d95f8f9157c7261f68eddf32ec15b3" + integrity sha512-IO31r62xfMI+wBJVmgx0JR9ZOHty8HkoYpQAjRWUGG9vykBTlGHdArZ8zoFtpUu2gs17K7qTl/TtPpiSi6t+MA== dependencies: - "@babel/types" "^7.0.0" + "@babel/types" "^7.1.5" jsesc "^2.5.1" lodash "^4.17.10" source-map "^0.5.0" trim-right "^1.0.1" +"@babel/generator@^7.2.2": + version "7.2.2" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.2.2.tgz#18c816c70962640eab42fe8cae5f3947a5c65ccc" + integrity sha512-I4o675J/iS8k+P38dvJ3IBGqObLXyQLTxtrR4u9cSUJOURvafeEWb/pFMOTwtNrmq73mJzyF6ueTbO1BtN0Zeg== + dependencies: + "@babel/types" "^7.2.2" + jsesc "^2.5.1" + lodash "^4.17.10" + source-map "^0.5.0" + trim-right "^1.0.1" + +"@babel/helper-annotate-as-pure@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.0.0.tgz#323d39dd0b50e10c7c06ca7d7638e6864d8c5c32" + integrity sha512-3UYcJUj9kvSLbLbUIfQTqzcy5VX7GRZ/CCDrnOaZorFFM01aXp1+GJwuFGV4NDDoAS+mOUyHcO6UD/RfqOks3Q== + dependencies: + "@babel/types" "^7.0.0" + +"@babel/helper-builder-binary-assignment-operator-visitor@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.1.0.tgz#6b69628dfe4087798e0c4ed98e3d4a6b2fbd2f5f" + integrity sha512-qNSR4jrmJ8M1VMM9tibvyRAHXQs2PmaksQF7c1CGJNipfe3D8p+wgNwgso/P2A2r2mdgBWAXljNWR0QRZAMW8w== + dependencies: + "@babel/helper-explode-assignable-expression" "^7.1.0" + "@babel/types" "^7.0.0" + +"@babel/helper-builder-react-jsx@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-builder-react-jsx/-/helper-builder-react-jsx-7.0.0.tgz#fa154cb53eb918cf2a9a7ce928e29eb649c5acdb" + integrity sha512-ebJ2JM6NAKW0fQEqN8hOLxK84RbRz9OkUhGS/Xd5u56ejMfVbayJ4+LykERZCOUM6faa6Fp3SZNX3fcT16MKHw== + dependencies: + "@babel/types" "^7.0.0" + esutils "^2.0.0" + +"@babel/helper-call-delegate@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/helper-call-delegate/-/helper-call-delegate-7.1.0.tgz#6a957f105f37755e8645343d3038a22e1449cc4a" + integrity sha512-YEtYZrw3GUK6emQHKthltKNZwszBcHK58Ygcis+gVUrF4/FmTVr5CCqQNSfmvg2y+YDEANyYoaLz/SHsnusCwQ== + dependencies: + "@babel/helper-hoist-variables" "^7.0.0" + "@babel/traverse" "^7.1.0" + "@babel/types" "^7.0.0" + +"@babel/helper-define-map@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.1.0.tgz#3b74caec329b3c80c116290887c0dd9ae468c20c" + integrity sha512-yPPcW8dc3gZLN+U1mhYV91QU3n5uTbx7DUdf8NnPbjS0RMwBuHi9Xt2MUgppmNz7CJxTBWsGczTiEp1CSOTPRg== + dependencies: + "@babel/helper-function-name" "^7.1.0" + "@babel/types" "^7.0.0" + lodash "^4.17.10" + +"@babel/helper-explode-assignable-expression@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.1.0.tgz#537fa13f6f1674df745b0c00ec8fe4e99681c8f6" + integrity sha512-NRQpfHrJ1msCHtKjbzs9YcMmJZOg6mQMmGRB+hbamEdG5PNpaSm95275VD92DvJKuyl0s2sFiDmMZ+EnnvufqA== + dependencies: + "@babel/traverse" "^7.1.0" + "@babel/types" "^7.0.0" + "@babel/helper-function-name@7.0.0-beta.44": version "7.0.0-beta.44" resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.44.tgz#e18552aaae2231100a6e485e03854bc3532d44dd" @@ -42,12 +123,13 @@ "@babel/template" "7.0.0-beta.44" "@babel/types" "7.0.0-beta.44" -"@babel/helper-function-name@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0.tgz#a68cc8d04420ccc663dd258f9cc41b8261efa2d4" +"@babel/helper-function-name@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.1.0.tgz#a0ceb01685f73355d4360c1247f582bfafc8ff53" + integrity sha512-A95XEoCpb3TO+KZzJ4S/5uW5fNe26DjBGqf1o9ucyLyCmi1dXq/B3c8iaWTfBk3VvetUxl16e8tIrd5teOCfGw== dependencies: "@babel/helper-get-function-arity" "^7.0.0" - "@babel/template" "^7.0.0" + "@babel/template" "^7.1.0" "@babel/types" "^7.0.0" "@babel/helper-get-function-arity@7.0.0-beta.44": @@ -59,9 +141,91 @@ "@babel/helper-get-function-arity@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz#83572d4320e2a4657263734113c42868b64e49c3" + integrity sha512-r2DbJeg4svYvt3HOS74U4eWKsUAMRH01Z1ds1zx8KNTPtpTL5JAsdFv8BNyOpVqdFhHkkRDIg5B4AsxmkjAlmQ== + dependencies: + "@babel/types" "^7.0.0" + +"@babel/helper-hoist-variables@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.0.0.tgz#46adc4c5e758645ae7a45deb92bab0918c23bb88" + integrity sha512-Ggv5sldXUeSKsuzLkddtyhyHe2YantsxWKNi7A+7LeD12ExRDWTRk29JCXpaHPAbMaIPZSil7n+lq78WY2VY7w== dependencies: "@babel/types" "^7.0.0" +"@babel/helper-member-expression-to-functions@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.0.0.tgz#8cd14b0a0df7ff00f009e7d7a436945f47c7a16f" + integrity sha512-avo+lm/QmZlv27Zsi0xEor2fKcqWG56D5ae9dzklpIaY7cQMK5N8VSpaNVPPagiqmy7LrEjK1IWdGMOqPu5csg== + dependencies: + "@babel/types" "^7.0.0" + +"@babel/helper-module-imports@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.0.0.tgz#96081b7111e486da4d2cd971ad1a4fe216cc2e3d" + integrity sha512-aP/hlLq01DWNEiDg4Jn23i+CXxW/owM4WpDLFUbpjxe4NS3BhLVZQ5i7E0ZrxuQ/vwekIeciyamgB1UIYxxM6A== + dependencies: + "@babel/types" "^7.0.0" + +"@babel/helper-module-transforms@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.1.0.tgz#470d4f9676d9fad50b324cdcce5fbabbc3da5787" + integrity sha512-0JZRd2yhawo79Rcm4w0LwSMILFmFXjugG3yqf+P/UsKsRS1mJCmMwwlHDlMg7Avr9LrvSpp4ZSULO9r8jpCzcw== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-simple-access" "^7.1.0" + "@babel/helper-split-export-declaration" "^7.0.0" + "@babel/template" "^7.1.0" + "@babel/types" "^7.0.0" + lodash "^4.17.10" + +"@babel/helper-optimise-call-expression@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.0.0.tgz#a2920c5702b073c15de51106200aa8cad20497d5" + integrity sha512-u8nd9NQePYNQV8iPWu/pLLYBqZBa4ZaY1YWRFMuxrid94wKI1QNt67NEZ7GAe5Kc/0LLScbim05xZFWkAdrj9g== + dependencies: + "@babel/types" "^7.0.0" + +"@babel/helper-plugin-utils@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz#bbb3fbee98661c569034237cc03967ba99b4f250" + integrity sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA== + +"@babel/helper-regex@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-regex/-/helper-regex-7.0.0.tgz#2c1718923b57f9bbe64705ffe5640ac64d9bdb27" + integrity sha512-TR0/N0NDCcUIUEbqV6dCO+LptmmSQFQ7q70lfcEB4URsjD0E1HzicrwUH+ap6BAQ2jhCX9Q4UqZy4wilujWlkg== + dependencies: + lodash "^4.17.10" + +"@babel/helper-remap-async-to-generator@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.1.0.tgz#361d80821b6f38da75bd3f0785ece20a88c5fe7f" + integrity sha512-3fOK0L+Fdlg8S5al8u/hWE6vhufGSn0bN09xm2LXMy//REAF8kDCrYoOBKYmA8m5Nom+sV9LyLCwrFynA8/slg== + dependencies: + "@babel/helper-annotate-as-pure" "^7.0.0" + "@babel/helper-wrap-function" "^7.1.0" + "@babel/template" "^7.1.0" + "@babel/traverse" "^7.1.0" + "@babel/types" "^7.0.0" + +"@babel/helper-replace-supers@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.1.0.tgz#5fc31de522ec0ef0899dc9b3e7cf6a5dd655f362" + integrity sha512-BvcDWYZRWVuDeXTYZWxekQNO5D4kO55aArwZOTFXw6rlLQA8ZaDicJR1sO47h+HrnCiDFiww0fSPV0d713KBGQ== + dependencies: + "@babel/helper-member-expression-to-functions" "^7.0.0" + "@babel/helper-optimise-call-expression" "^7.0.0" + "@babel/traverse" "^7.1.0" + "@babel/types" "^7.0.0" + +"@babel/helper-simple-access@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.1.0.tgz#65eeb954c8c245beaa4e859da6188f39d71e585c" + integrity sha512-Vk+78hNjRbsiu49zAPALxTb+JUQCz1aolpd8osOF16BGnLtseD21nbHgLPGUwrXEurZgiCOUmvs3ExTu4F5x6w== + dependencies: + "@babel/template" "^7.1.0" + "@babel/types" "^7.0.0" + "@babel/helper-split-export-declaration@7.0.0-beta.44": version "7.0.0-beta.44" resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.44.tgz#c0b351735e0fbcb3822c8ad8db4e583b05ebd9dc" @@ -71,9 +235,29 @@ "@babel/helper-split-export-declaration@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0.tgz#3aae285c0311c2ab095d997b8c9a94cad547d813" + integrity sha512-MXkOJqva62dfC0w85mEf/LucPPS/1+04nmmRMPEBUB++hiiThQ2zPtX/mEWQ3mtzCEjIJvPY8nuwxXtQeQwUag== + dependencies: + "@babel/types" "^7.0.0" + +"@babel/helper-wrap-function@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.1.0.tgz#8cf54e9190706067f016af8f75cb3df829cc8c66" + integrity sha512-R6HU3dete+rwsdAfrOzTlE9Mcpk4RjU3aX3gi9grtmugQY0u79X7eogUvfXA5sI81Mfq1cn6AgxihfN33STjJA== dependencies: + "@babel/helper-function-name" "^7.1.0" + "@babel/template" "^7.1.0" + "@babel/traverse" "^7.1.0" "@babel/types" "^7.0.0" +"@babel/helpers@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.2.0.tgz#8335f3140f3144270dc63c4732a4f8b0a50b7a21" + integrity sha512-Fr07N+ea0dMcMN8nFpuK6dUIT7/ivt9yKQdEEnjVS83tG2pHwPi03gYmk/tyuwONnZ+sY+GFFPlWGgCtW1hF9A== + dependencies: + "@babel/template" "^7.1.2" + "@babel/traverse" "^7.1.5" + "@babel/types" "^7.2.0" + "@babel/highlight@7.0.0-beta.44": version "7.0.0-beta.44" resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-beta.44.tgz#18c94ce543916a80553edcdcf681890b200747d5" @@ -90,9 +274,536 @@ esutils "^2.0.2" js-tokens "^4.0.0" -"@babel/parser@^7.0.0": +"@babel/parser@^7.1.2", "@babel/parser@^7.1.5": + version "7.1.5" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.1.5.tgz#20b7d5e7e1811ba996f8a868962ea7dd2bfcd2fc" + integrity sha512-WXKf5K5HT6X0kKiCOezJZFljsfxKV1FpU8Tf1A7ZpGvyd/Q4hlrJm2EwoH2onaUq3O4tLDp+4gk0hHPsMyxmOg== + +"@babel/parser@^7.2.2": + version "7.2.2" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.2.2.tgz#37ebdbc88a2e1ebc6c8dd3d35ea9436e3e39e477" + integrity sha512-UNTmQ5cSLDeBGBl+s7JeowkqIHgmFAGBnLDdIzFmUNSuS5JF0XBcN59jsh/vJO/YjfsBqMxhMjoFGmNExmf0FA== + +"@babel/plugin-proposal-async-generator-functions@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.1.0.tgz#41c1a702e10081456e23a7b74d891922dd1bb6ce" + integrity sha512-Fq803F3Jcxo20MXUSDdmZZXrPe6BWyGcWBPPNB/M7WaUYESKDeKMOGIxEzQOjGSmW/NWb6UaPZrtTB2ekhB/ew== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-remap-async-to-generator" "^7.1.0" + "@babel/plugin-syntax-async-generators" "^7.0.0" + +"@babel/plugin-proposal-class-properties@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.1.0.tgz#9af01856b1241db60ec8838d84691aa0bd1e8df4" + integrity sha512-/PCJWN+CKt5v1xcGn4vnuu13QDoV+P7NcICP44BoonAJoPSGwVkgrXihFIQGiEjjPlUDBIw1cM7wYFLARS2/hw== + dependencies: + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-member-expression-to-functions" "^7.0.0" + "@babel/helper-optimise-call-expression" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-replace-supers" "^7.1.0" + "@babel/plugin-syntax-class-properties" "^7.0.0" + +"@babel/plugin-proposal-decorators@^7.1.2": + version "7.1.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.1.2.tgz#79829bd75fced6581ec6c7ab1930e8d738e892e7" + integrity sha512-YooynBO6PmBgHvAd0fl5e5Tq/a0pEC6RqF62ouafme8FzdIVH41Mz/u1dn8fFVm4jzEJ+g/MsOxouwybJPuP8Q== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-replace-supers" "^7.1.0" + "@babel/helper-split-export-declaration" "^7.0.0" + "@babel/plugin-syntax-decorators" "^7.1.0" + +"@babel/plugin-proposal-json-strings@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.0.0.tgz#3b4d7b5cf51e1f2e70f52351d28d44fc2970d01e" + integrity sha512-kfVdUkIAGJIVmHmtS/40i/fg/AGnw/rsZBCaapY5yjeO5RA9m165Xbw9KMOu2nqXP5dTFjEjHdfNdoVcHv133Q== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-json-strings" "^7.0.0" + +"@babel/plugin-proposal-nullish-coalescing-operator@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.0.0.tgz#b72ec31adf612d062dc0348316246127a451e45f" + integrity sha512-QIN3UFo1ul4ruAsjIqK43PeXedo1qY74zeGrODJl1KfCGeMc6qJC4rb5Ylml/smzxibqsDeVZGH+TmWHCldRQQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-nullish-coalescing-operator" "^7.0.0" + +"@babel/plugin-proposal-object-rest-spread@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.0.0.tgz#9a17b547f64d0676b6c9cecd4edf74a82ab85e7e" + integrity sha512-14fhfoPcNu7itSen7Py1iGN0gEm87hX/B+8nZPqkdmANyyYWYMY2pjA3r8WXbWVKMzfnSNS0xY8GVS0IjXi/iw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-object-rest-spread" "^7.0.0" + +"@babel/plugin-proposal-optional-catch-binding@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.0.0.tgz#b610d928fe551ff7117d42c8bb410eec312a6425" + integrity sha512-JPqAvLG1s13B/AuoBjdBYvn38RqW6n1TzrQO839/sIpqLpbnXKacsAgpZHzLD83Sm8SDXMkkrAvEnJ25+0yIpw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-optional-catch-binding" "^7.0.0" + +"@babel/plugin-proposal-optional-chaining@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.0.0.tgz#3d344d4152253379b8758e7d041148e8787c4a9d" + integrity sha512-7x8HLa71OzNiofbQUVakS0Kmg++6a+cXNfS7QKHbbv03SuSaumJyaWsfNgw+T7aqrJlqurYpZqrkPgXu0iZK0w== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-optional-chaining" "^7.0.0" + +"@babel/plugin-proposal-pipeline-operator@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-pipeline-operator/-/plugin-proposal-pipeline-operator-7.0.0.tgz#ab60169a5c4a598292de59a14f9810d4e47b00b8" + integrity sha512-MN189PDyTMoor/YFh9dk6HpSZLMGHCXRdAhgmzshwcalbgYh5Mkn7Ib17lOo6fmLwHdyQ4GR4yagizfeR2LwQQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-pipeline-operator" "^7.0.0" + +"@babel/plugin-proposal-unicode-property-regex@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.0.0.tgz#498b39cd72536cd7c4b26177d030226eba08cd33" + integrity sha512-tM3icA6GhC3ch2SkmSxv7J/hCWKISzwycub6eGsDrFDgukD4dZ/I+x81XgW0YslS6mzNuQ1Cbzh5osjIMgepPQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-regex" "^7.0.0" + regexpu-core "^4.2.0" + +"@babel/plugin-syntax-async-generators@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.0.0.tgz#bf0891dcdbf59558359d0c626fdc9490e20bc13c" + integrity sha512-im7ged00ddGKAjcZgewXmp1vxSZQQywuQXe2B1A7kajjZmDeY/ekMPmWr9zJgveSaQH0k7BcGrojQhcK06l0zA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-class-properties@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.0.0.tgz#e051af5d300cbfbcec4a7476e37a803489881634" + integrity sha512-cR12g0Qzn4sgkjrbrzWy2GE7m9vMl/sFkqZ3gIpAQdrvPDnLM8180i+ANDFIXfjHo9aqp0ccJlQ0QNZcFUbf9w== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-decorators@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-decorators/-/plugin-syntax-decorators-7.1.0.tgz#2fa7c1a7905a299c9853ebcef340306675f9cbdc" + integrity sha512-uQvRSbgQ0nQg3jsmIixXXDCgSpkBolJ9X7NYThMKCcjvE8dN2uWJUzTUNNAeuKOjARTd+wUQV0ztXpgunZYKzQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-dynamic-import@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.0.0.tgz#6dfb7d8b6c3be14ce952962f658f3b7eb54c33ee" + integrity sha512-Gt9xNyRrCHCiyX/ZxDGOcBnlJl0I3IWicpZRC4CdC0P5a/I07Ya2OAMEBU+J7GmRFVmIetqEYRko6QYRuKOESw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-export-default-from@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-export-default-from/-/plugin-syntax-export-default-from-7.0.0.tgz#084b639bce3d42f3c5bf3f68ccb42220bb2d729d" + integrity sha512-HNnjg/fFFbnuLAqr/Ocp1Y3GB4AjmXcu1xxn3ql3bS2kGrB/qi+Povshb8i3hOkE5jNozzh8r/0/lq1w8oOWbQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-export-namespace-from@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.0.0.tgz#17a7389a1d2571ac4d9b77ea2defa74a930edf5d" + integrity sha512-l314XT1eMa0MWboSmG4BdKukHfSpSpQRenUoZmEpL6hqc5nc1/ddpLETjPB77gZE1dZ9qxy5D3U3UUjjcX2d4g== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-flow@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.0.0.tgz#70638aeaad9ee426bc532e51523cff8ff02f6f17" + integrity sha512-zGcuZWiWWDa5qTZ6iAnpG0fnX/GOu49pGR5PFvkQ9GmKNaSphXQnlNXh/LG20sqWtNrx/eB6krzfEzcwvUyeFA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-import-meta@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.0.0.tgz#ca946b73216c29c39a55ef2d739097fee8a85d69" + integrity sha512-FEoGvhXVAiWzpDjyZIlBGzKyNk/lnRPy7aPke3PjVkiAY0QFsvFfkjUg5diRwVfowBA8SJqvFt0ZoXNSjl70hQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-json-strings@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.0.0.tgz#0d259a68090e15b383ce3710e01d5b23f3770cbd" + integrity sha512-UlSfNydC+XLj4bw7ijpldc1uZ/HB84vw+U6BTuqMdIEmz/LDe63w/GHtpQMdXWdqQZFeAI9PjnHe/vDhwirhKA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-jsx@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.0.0.tgz#034d5e2b4e14ccaea2e4c137af7e4afb39375ffd" + integrity sha512-PdmL2AoPsCLWxhIr3kG2+F9v4WH06Q3z+NoGVpQgnUNGcagXHq5sB3OXxkSahKq9TLdNMN/AJzFYSOo8UKDMHg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-nullish-coalescing-operator@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.0.0.tgz#b60931d5a15da82625fff6657c39419969598743" + integrity sha512-oAJmMsAvTSIk9y0sZdU2S/nY44PEUuHN7EzNDMgbuR4e/OwyfR9lSmoBJBZ2lslFZIqhksrTt4i+av7uKfNYDw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-numeric-separator@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.0.0.tgz#9594c7ce6ce8089a14d732cb9f6b1eeb047413ba" + integrity sha512-t9RMUPWsFXVeUZxEOhIDkVqYLi1sWOTjxFBAp8wJtaARilvkGlEQvSObd2W5YKicDktINI9XmdV0sB2FZaLOpw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-object-rest-spread@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.0.0.tgz#37d8fbcaf216bd658ea1aebbeb8b75e88ebc549b" + integrity sha512-5A0n4p6bIiVe5OvQPxBnesezsgFJdHhSs3uFSvaPdMqtsovajLZ+G2vZyvNe10EzJBWWo3AcHGKhAFUxqwp2dw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-optional-catch-binding@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.0.0.tgz#886f72008b3a8b185977f7cb70713b45e51ee475" + integrity sha512-Wc+HVvwjcq5qBg1w5RG9o9RVzmCaAg/Vp0erHCKpAYV8La6I94o4GQAmFYNmkzoMO6gzoOSulpKeSSz6mPEoZw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-optional-chaining@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.0.0.tgz#1e6ecba124310b5d3a8fc1e00d50b1c4c2e05e68" + integrity sha512-QXedQsZf8yua1nNrXSePT0TsGSQH9A1iK08m9dhCMdZeJaaxYcQfXdgHWVV6Cp7WE/afPVvSKIsAHK5wP+yxDA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-pipeline-operator@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-pipeline-operator/-/plugin-syntax-pipeline-operator-7.0.0.tgz#29106ddb293898192780ff48159c77e6f20c1768" + integrity sha512-McK1JV4klGq2r0UZ1SLE2u+u37ElArBcPMGl6JizdgEXD3ttp0dpOB5ZpqpeRHkIgnl46th64UHrFDteQ4P5aw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-arrow-functions@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.0.0.tgz#a6c14875848c68a3b4b3163a486535ef25c7e749" + integrity sha512-2EZDBl1WIO/q4DIkIp4s86sdp4ZifL51MoIviLY/gG/mLSuOIEg7J8o6mhbxOTvUJkaN50n+8u41FVsr5KLy/w== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-async-to-generator@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.1.0.tgz#109e036496c51dd65857e16acab3bafdf3c57811" + integrity sha512-rNmcmoQ78IrvNCIt/R9U+cixUHeYAzgusTFgIAv+wQb9HJU4szhpDD6e5GCACmj/JP5KxuCwM96bX3L9v4ZN/g== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-remap-async-to-generator" "^7.1.0" + +"@babel/plugin-transform-block-scoped-functions@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.0.0.tgz#482b3f75103927e37288b3b67b65f848e2aa0d07" + integrity sha512-AOBiyUp7vYTqz2Jibe1UaAWL0Hl9JUXEgjFvvvcSc9MVDItv46ViXFw2F7SVt1B5k+KWjl44eeXOAk3UDEaJjQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-block-scoping@^7.1.5": + version "7.1.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.1.5.tgz#3e8e0bc9a5104519923302a24f748f72f2f61f37" + integrity sha512-jlYcDrz+5ayWC7mxgpn1Wj8zj0mmjCT2w0mPIMSwO926eXBRxpEgoN/uQVRBfjtr8ayjcmS+xk2G1jaP8JjMJQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + lodash "^4.17.10" + +"@babel/plugin-transform-classes@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.1.0.tgz#ab3f8a564361800cbc8ab1ca6f21108038432249" + integrity sha512-rNaqoD+4OCBZjM7VaskladgqnZ1LO6o2UxuWSDzljzW21pN1KXkB7BstAVweZdxQkHAujps5QMNOTWesBciKFg== + dependencies: + "@babel/helper-annotate-as-pure" "^7.0.0" + "@babel/helper-define-map" "^7.1.0" + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-optimise-call-expression" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-replace-supers" "^7.1.0" + "@babel/helper-split-export-declaration" "^7.0.0" + globals "^11.1.0" + +"@babel/plugin-transform-computed-properties@^7.0.0": version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.0.0.tgz#697655183394facffb063437ddf52c0277698775" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.0.0.tgz#2fbb8900cd3e8258f2a2ede909b90e7556185e31" + integrity sha512-ubouZdChNAv4AAWAgU7QKbB93NU5sHwInEWfp+/OzJKA02E6Woh9RVoX4sZrbRwtybky/d7baTUqwFx+HgbvMA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-destructuring@^7.0.0": + version "7.1.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.1.3.tgz#e69ff50ca01fac6cb72863c544e516c2b193012f" + integrity sha512-Mb9M4DGIOspH1ExHOUnn2UUXFOyVTiX84fXCd+6B5iWrQg/QMeeRmSwpZ9lnjYLSXtZwiw80ytVMr3zue0ucYw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-dotall-regex@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.0.0.tgz#73a24da69bc3c370251f43a3d048198546115e58" + integrity sha512-00THs8eJxOJUFVx1w8i1MBF4XH4PsAjKjQ1eqN/uCH3YKwP21GCKfrn6YZFZswbOk9+0cw1zGQPHVc1KBlSxig== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-regex" "^7.0.0" + regexpu-core "^4.1.3" + +"@babel/plugin-transform-duplicate-keys@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.0.0.tgz#a0601e580991e7cace080e4cf919cfd58da74e86" + integrity sha512-w2vfPkMqRkdxx+C71ATLJG30PpwtTpW7DDdLqYt2acXU7YjztzeWW2Jk1T6hKqCLYCcEA5UQM/+xTAm+QCSnuQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-exponentiation-operator@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.1.0.tgz#9c34c2ee7fd77e02779cfa37e403a2e1003ccc73" + integrity sha512-uZt9kD1Pp/JubkukOGQml9tqAeI8NkE98oZnHZ2qHRElmeKCodbTZgOEUtujSCSLhHSBWbzNiFSDIMC4/RBTLQ== + dependencies: + "@babel/helper-builder-binary-assignment-operator-visitor" "^7.1.0" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-flow-strip-types@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.0.0.tgz#c40ced34c2783985d90d9f9ac77a13e6fb396a01" + integrity sha512-WhXUNb4It5a19RsgKKbQPrjmy4yWOY1KynpEbNw7bnd1QTcrT/EIl3MJvnGgpgvrKyKbqX7nUNOJfkpLOnoDKA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-flow" "^7.0.0" + +"@babel/plugin-transform-for-of@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.0.0.tgz#f2ba4eadb83bd17dc3c7e9b30f4707365e1c3e39" + integrity sha512-TlxKecN20X2tt2UEr2LNE6aqA0oPeMT1Y3cgz8k4Dn1j5ObT8M3nl9aA37LLklx0PBZKETC9ZAf9n/6SujTuXA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-function-name@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.1.0.tgz#29c5550d5c46208e7f730516d41eeddd4affadbb" + integrity sha512-VxOa1TMlFMtqPW2IDYZQaHsFrq/dDoIjgN098NowhexhZcz3UGlvPgZXuE1jEvNygyWyxRacqDpCZt+par1FNg== + dependencies: + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-literals@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.0.0.tgz#2aec1d29cdd24c407359c930cdd89e914ee8ff86" + integrity sha512-1NTDBWkeNXgpUcyoVFxbr9hS57EpZYXpje92zv0SUzjdu3enaRwF/l3cmyRnXLtIdyJASyiS6PtybK+CgKf7jA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-modules-amd@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.1.0.tgz#f9e0a7072c12e296079b5a59f408ff5b97bf86a8" + integrity sha512-wt8P+xQ85rrnGNr2x1iV3DW32W8zrB6ctuBkYBbf5/ZzJY99Ob4MFgsZDFgczNU76iy9PWsy4EuxOliDjdKw6A== + dependencies: + "@babel/helper-module-transforms" "^7.1.0" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-modules-commonjs@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.1.0.tgz#0a9d86451cbbfb29bd15186306897c67f6f9a05c" + integrity sha512-wtNwtMjn1XGwM0AXPspQgvmE6msSJP15CX2RVfpTSTNPLhKhaOjaIfBaVfj4iUZ/VrFSodcFedwtPg/NxwQlPA== + dependencies: + "@babel/helper-module-transforms" "^7.1.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-simple-access" "^7.1.0" + +"@babel/plugin-transform-modules-systemjs@^7.0.0": + version "7.1.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.1.3.tgz#2119a3e3db612fd74a19d88652efbfe9613a5db0" + integrity sha512-PvTxgjxQAq4pvVUZF3mD5gEtVDuId8NtWkJsZLEJZMZAW3TvgQl1pmydLLN1bM8huHFVVU43lf0uvjQj9FRkKw== + dependencies: + "@babel/helper-hoist-variables" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-modules-umd@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.1.0.tgz#a29a7d85d6f28c3561c33964442257cc6a21f2a8" + integrity sha512-enrRtn5TfRhMmbRwm7F8qOj0qEYByqUvTttPEGimcBH4CJHphjyK1Vg7sdU7JjeEmgSpM890IT/efS2nMHwYig== + dependencies: + "@babel/helper-module-transforms" "^7.1.0" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-new-target@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.0.0.tgz#ae8fbd89517fa7892d20e6564e641e8770c3aa4a" + integrity sha512-yin069FYjah+LbqfGeTfzIBODex/e++Yfa0rH0fpfam9uTbuEeEOx5GLGr210ggOV77mVRNoeqSYqeuaqSzVSw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-object-super@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.1.0.tgz#b1ae194a054b826d8d4ba7ca91486d4ada0f91bb" + integrity sha512-/O02Je1CRTSk2SSJaq0xjwQ8hG4zhZGNjE8psTsSNPXyLRCODv7/PBozqT5AmQMzp7MI3ndvMhGdqp9c96tTEw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-replace-supers" "^7.1.0" + +"@babel/plugin-transform-parameters@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.1.0.tgz#44f492f9d618c9124026e62301c296bf606a7aed" + integrity sha512-vHV7oxkEJ8IHxTfRr3hNGzV446GAb+0hgbA7o/0Jd76s+YzccdWuTU296FOCOl/xweU4t/Ya4g41yWz80RFCRw== + dependencies: + "@babel/helper-call-delegate" "^7.1.0" + "@babel/helper-get-function-arity" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-react-display-name@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.0.0.tgz#93759e6c023782e52c2da3b75eca60d4f10533ee" + integrity sha512-BX8xKuQTO0HzINxT6j/GiCwoJB0AOMs0HmLbEnAvcte8U8rSkNa/eSCAY+l1OA4JnCVq2jw2p6U8QQryy2fTPg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-react-jsx-self@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.0.0.tgz#a84bb70fea302d915ea81d9809e628266bb0bc11" + integrity sha512-pymy+AK12WO4safW1HmBpwagUQRl9cevNX+82AIAtU1pIdugqcH+nuYP03Ja6B+N4gliAaKWAegIBL/ymALPHA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-jsx" "^7.0.0" + +"@babel/plugin-transform-react-jsx-source@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.0.0.tgz#28e00584f9598c0dd279f6280eee213fa0121c3c" + integrity sha512-OSeEpFJEH5dw/TtxTg4nijl4nHBbhqbKL94Xo/Y17WKIf2qJWeIk/QeXACF19lG1vMezkxqruwnTjVizaW7u7w== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-jsx" "^7.0.0" + +"@babel/plugin-transform-react-jsx@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.0.0.tgz#524379e4eca5363cd10c4446ba163f093da75f3e" + integrity sha512-0TMP21hXsSUjIQJmu/r7RiVxeFrXRcMUigbKu0BLegJK9PkYodHstaszcig7zxXfaBji2LYUdtqIkHs+hgYkJQ== + dependencies: + "@babel/helper-builder-react-jsx" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-jsx" "^7.0.0" + +"@babel/plugin-transform-regenerator@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.0.0.tgz#5b41686b4ed40bef874d7ed6a84bdd849c13e0c1" + integrity sha512-sj2qzsEx8KDVv1QuJc/dEfilkg3RRPvPYx/VnKLtItVQRWt1Wqf5eVCOLZm29CiGFfYYsA3VPjfizTCV0S0Dlw== + dependencies: + regenerator-transform "^0.13.3" + +"@babel/plugin-transform-shorthand-properties@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.0.0.tgz#85f8af592dcc07647541a0350e8c95c7bf419d15" + integrity sha512-g/99LI4vm5iOf5r1Gdxq5Xmu91zvjhEG5+yZDJW268AZELAu4J1EiFLnkSG3yuUsZyOipVOVUKoGPYwfsTymhw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-spread@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.0.0.tgz#93583ce48dd8c85e53f3a46056c856e4af30b49b" + integrity sha512-L702YFy2EvirrR4shTj0g2xQp7aNwZoWNCkNu2mcoU0uyzMl0XRwDSwzB/xp6DSUFiBmEXuyAyEN16LsgVqGGQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-sticky-regex@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.0.0.tgz#30a9d64ac2ab46eec087b8530535becd90e73366" + integrity sha512-LFUToxiyS/WD+XEWpkx/XJBrUXKewSZpzX68s+yEOtIbdnsRjpryDw9U06gYc6klYEij/+KQVRnD3nz3AoKmjw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-regex" "^7.0.0" + +"@babel/plugin-transform-template-literals@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.0.0.tgz#084f1952efe5b153ddae69eb8945f882c7a97c65" + integrity sha512-vA6rkTCabRZu7Nbl9DfLZE1imj4tzdWcg5vtdQGvj+OH9itNNB6hxuRMHuIY8SGnEt1T9g5foqs9LnrHzsqEFg== + dependencies: + "@babel/helper-annotate-as-pure" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-typeof-symbol@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.0.0.tgz#4dcf1e52e943e5267b7313bff347fdbe0f81cec9" + integrity sha512-1r1X5DO78WnaAIvs5uC48t41LLckxsYklJrZjNKcevyz83sF2l4RHbw29qrCPr/6ksFsdfRpT/ZgxNWHXRnffg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-unicode-regex@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.0.0.tgz#c6780e5b1863a76fe792d90eded9fcd5b51d68fc" + integrity sha512-uJBrJhBOEa3D033P95nPHu3nbFwFE9ZgXsfEitzoIXIwqAZWk7uXcg06yFKXz9FSxBH5ucgU/cYdX0IV8ldHKw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-regex" "^7.0.0" + regexpu-core "^4.1.3" + +"@babel/preset-env@^7.1.5": + version "7.1.5" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.1.5.tgz#a28b5482ca8bc2f2d0712234d6c690240b92495d" + integrity sha512-pQ+2o0YyCp98XG0ODOHJd9z4GsSoV5jicSedRwCrU8uiqcJahwQiOq0asSZEb/m/lwyu6X5INvH/DSiwnQKncw== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-proposal-async-generator-functions" "^7.1.0" + "@babel/plugin-proposal-json-strings" "^7.0.0" + "@babel/plugin-proposal-object-rest-spread" "^7.0.0" + "@babel/plugin-proposal-optional-catch-binding" "^7.0.0" + "@babel/plugin-proposal-unicode-property-regex" "^7.0.0" + "@babel/plugin-syntax-async-generators" "^7.0.0" + "@babel/plugin-syntax-object-rest-spread" "^7.0.0" + "@babel/plugin-syntax-optional-catch-binding" "^7.0.0" + "@babel/plugin-transform-arrow-functions" "^7.0.0" + "@babel/plugin-transform-async-to-generator" "^7.1.0" + "@babel/plugin-transform-block-scoped-functions" "^7.0.0" + "@babel/plugin-transform-block-scoping" "^7.1.5" + "@babel/plugin-transform-classes" "^7.1.0" + "@babel/plugin-transform-computed-properties" "^7.0.0" + "@babel/plugin-transform-destructuring" "^7.0.0" + "@babel/plugin-transform-dotall-regex" "^7.0.0" + "@babel/plugin-transform-duplicate-keys" "^7.0.0" + "@babel/plugin-transform-exponentiation-operator" "^7.1.0" + "@babel/plugin-transform-for-of" "^7.0.0" + "@babel/plugin-transform-function-name" "^7.1.0" + "@babel/plugin-transform-literals" "^7.0.0" + "@babel/plugin-transform-modules-amd" "^7.1.0" + "@babel/plugin-transform-modules-commonjs" "^7.1.0" + "@babel/plugin-transform-modules-systemjs" "^7.0.0" + "@babel/plugin-transform-modules-umd" "^7.1.0" + "@babel/plugin-transform-new-target" "^7.0.0" + "@babel/plugin-transform-object-super" "^7.1.0" + "@babel/plugin-transform-parameters" "^7.1.0" + "@babel/plugin-transform-regenerator" "^7.0.0" + "@babel/plugin-transform-shorthand-properties" "^7.0.0" + "@babel/plugin-transform-spread" "^7.0.0" + "@babel/plugin-transform-sticky-regex" "^7.0.0" + "@babel/plugin-transform-template-literals" "^7.0.0" + "@babel/plugin-transform-typeof-symbol" "^7.0.0" + "@babel/plugin-transform-unicode-regex" "^7.0.0" + browserslist "^4.1.0" + invariant "^2.2.2" + js-levenshtein "^1.1.3" + semver "^5.3.0" + +"@babel/preset-flow@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/preset-flow/-/preset-flow-7.0.0.tgz#afd764835d9535ec63d8c7d4caf1c06457263da2" + integrity sha512-bJOHrYOPqJZCkPVbG1Lot2r5OSsB+iUOaxiHdlOeB1yPWS6evswVHwvkDLZ54WTaTRIk89ds0iHmGZSnxlPejQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-flow-strip-types" "^7.0.0" + +"@babel/preset-react@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/preset-react/-/preset-react-7.0.0.tgz#e86b4b3d99433c7b3e9e91747e2653958bc6b3c0" + integrity sha512-oayxyPS4Zj+hF6Et11BwuBkmpgT/zMxyuZgFrMeZID6Hdh3dGlk4sHCAhdBCpuCKW2ppBfl2uCCetlrUIJRY3w== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-react-display-name" "^7.0.0" + "@babel/plugin-transform-react-jsx" "^7.0.0" + "@babel/plugin-transform-react-jsx-self" "^7.0.0" + "@babel/plugin-transform-react-jsx-source" "^7.0.0" "@babel/template@7.0.0-beta.44": version "7.0.0-beta.44" @@ -103,13 +814,23 @@ babylon "7.0.0-beta.44" lodash "^4.2.0" -"@babel/template@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0.tgz#c2bc9870405959c89a9c814376a2ecb247838c80" +"@babel/template@^7.1.0", "@babel/template@^7.1.2": + version "7.1.2" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.1.2.tgz#090484a574fef5a2d2d7726a674eceda5c5b5644" + integrity sha512-SY1MmplssORfFiLDcOETrW7fCLl+PavlwMh92rrGcikQaRq4iWPVH0MpwPpY3etVMx6RnDjXtr6VZYr/IbP/Ag== dependencies: "@babel/code-frame" "^7.0.0" - "@babel/parser" "^7.0.0" - "@babel/types" "^7.0.0" + "@babel/parser" "^7.1.2" + "@babel/types" "^7.1.2" + +"@babel/template@^7.2.2": + version "7.2.2" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.2.2.tgz#005b3fdf0ed96e88041330379e0da9a708eb2907" + integrity sha512-zRL0IMM02AUDwghf5LMSSDEz7sBCO2YnNmpg3uWTZj/v1rcG2BmQUvaGU8GhU8BvfMh1k2KIAYZ7Ji9KXPUg7g== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/parser" "^7.2.2" + "@babel/types" "^7.2.2" "@babel/traverse@7.0.0-beta.44": version "7.0.0-beta.44" @@ -126,20 +847,36 @@ invariant "^2.2.0" lodash "^4.2.0" -"@babel/traverse@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0.tgz#b1fe9b6567fdf3ab542cfad6f3b31f854d799a61" +"@babel/traverse@^7.1.0", "@babel/traverse@^7.1.5": + version "7.1.5" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.1.5.tgz#5aafca2039aa058c104cf2bfeb9fc4a857ccbca9" + integrity sha512-eU6XokWypl0MVJo+MTSPUtlfPePkrqsF26O+l1qFGlCKWwmiYAYy2Sy44Qw8m2u/LbPCsxYt90rghmqhYMGpPA== dependencies: "@babel/code-frame" "^7.0.0" - "@babel/generator" "^7.0.0" - "@babel/helper-function-name" "^7.0.0" + "@babel/generator" "^7.1.5" + "@babel/helper-function-name" "^7.1.0" "@babel/helper-split-export-declaration" "^7.0.0" - "@babel/parser" "^7.0.0" - "@babel/types" "^7.0.0" + "@babel/parser" "^7.1.5" + "@babel/types" "^7.1.5" debug "^3.1.0" globals "^11.1.0" lodash "^4.17.10" +"@babel/traverse@^7.2.2": + version "7.2.2" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.2.2.tgz#961039de1f9bcb946d807efe2dba9c92e859d188" + integrity sha512-E5Bn9FSwHpSkUhthw/XEuvFZxIgrqb9M8cX8j5EUQtrUG5DQUy6bFyl7G7iQ1D1Czudor+xkmp81JbLVVM0Sjg== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/generator" "^7.2.2" + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-split-export-declaration" "^7.0.0" + "@babel/parser" "^7.2.2" + "@babel/types" "^7.2.2" + debug "^4.1.0" + globals "^11.1.0" + lodash "^4.17.10" + "@babel/types@7.0.0-beta.44": version "7.0.0-beta.44" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.44.tgz#6b1b164591f77dec0a0342aca995f2d046b3a757" @@ -148,9 +885,19 @@ lodash "^4.2.0" to-fast-properties "^2.0.0" -"@babel/types@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0.tgz#6e191793d3c854d19c6749989e3bc55f0e962118" +"@babel/types@^7.0.0", "@babel/types@^7.1.2", "@babel/types@^7.1.5": + version "7.1.5" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.1.5.tgz#12fe64e91a431234b7017b4227a78cc0eec4e081" + integrity sha512-sJeqa/d9eM/bax8Ivg+fXF7FpN3E/ZmTrWbkk6r+g7biVYfALMnLin4dKijsaqEhpd2xvOGfQTkQkD31YCVV4A== + dependencies: + esutils "^2.0.2" + lodash "^4.17.10" + to-fast-properties "^2.0.0" + +"@babel/types@^7.2.0", "@babel/types@^7.2.2": + version "7.2.2" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.2.2.tgz#44e10fc24e33af524488b716cdaee5360ea8ed1e" + integrity sha512-fKCuD6UFUMkR541eDWL+2ih/xFZBXPOg/7EQFeTluMDebfqR4jrpaCjLhkWlQS4hT6nRa2PMEgXKbRB5/H2fpg== dependencies: esutils "^2.0.2" lodash "^4.17.10" @@ -330,6 +1077,15 @@ browser-stdout@1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" +browserslist@^4.1.0: + version "4.3.4" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.3.4.tgz#4477b737db6a1b07077275b24791e680d4300425" + integrity sha512-u5iz+ijIMUlmV8blX82VGFrB9ecnUg5qEt55CMZ/YJEhha+d8qpBfOFuutJ6F/VKRXjZoD33b6uvarpPxcl3RA== + dependencies: + caniuse-lite "^1.0.30000899" + electron-to-chromium "^1.3.82" + node-releases "^1.0.1" + builtin-modules@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" @@ -358,6 +1114,11 @@ callsites@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" +caniuse-lite@^1.0.30000899: + version "1.0.30000906" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000906.tgz#7c44e498a2504f7a5db3b4f91285bbc821157a77" + integrity sha512-ME7JFX6h0402om/nC/8Lw+q23QvPe2ust9U0ntLmkX9F2zaGwq47fZkjlyHKirFBuq1EM+T/LXBcDdW4bvkCTA== + chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" @@ -465,6 +1226,13 @@ contains-path@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" +convert-source-map@^1.1.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.6.0.tgz#51b537a8c43e0f04dec1993bffcdd504e758ac20" + integrity sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A== + dependencies: + safe-buffer "~5.1.1" + copy-descriptor@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" @@ -511,6 +1279,13 @@ debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9: dependencies: ms "2.0.0" +debug@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.0.tgz#373687bffa678b38b1cd91f861b63850035ddc87" + integrity sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg== + dependencies: + ms "^2.1.1" + decode-uri-component@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" @@ -571,6 +1346,11 @@ doctrine@^2.1.0: dependencies: esutils "^2.0.2" +electron-to-chromium@^1.3.82: + version "1.3.83" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.83.tgz#74584eb0972bb6777811c5d68d988c722f5e6666" + integrity sha512-DqJoDarxq50dcHsOOlMLNoy+qQitlMNbYb6wwbE0oUw2veHdRkpNrhmngiUYKMErdJ8SJ48rpJsZTQgy5SoEAA== + elegant-spinner@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/elegant-spinner/-/elegant-spinner-1.0.1.tgz#db043521c95d7e303fd8f345bedc3349cfb0729e" @@ -736,7 +1516,7 @@ estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1: version "4.2.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" -esutils@^2.0.2: +esutils@^2.0.0, esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" @@ -1074,7 +1854,7 @@ inquirer@^6.1.0: strip-ansi "^4.0.0" through "^2.3.6" -invariant@^2.2.0: +invariant@^2.2.0, invariant@^2.2.2: version "2.2.4" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" dependencies: @@ -1273,6 +2053,11 @@ jest-validate@^23.5.0: leven "^2.1.0" pretty-format "^23.5.0" +js-levenshtein@^1.1.3: + version "1.1.4" + resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.4.tgz#3a56e3cbf589ca0081eb22cd9ba0b1290a16d26e" + integrity sha512-PxfGzSs0ztShKrUYPIn5r0MtyAhYcCwmndozzpz8YObbPnD1jFxzlBGbRnX2mIu6Z13xN6+PTu05TQFnZFlzow== + js-tokens@^3.0.0: version "3.0.2" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" @@ -1292,6 +2077,11 @@ jsesc@^2.5.1: version "2.5.1" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.1.tgz#e421a2a8e20d6b0819df28908f782526b96dd1fe" +jsesc@~0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" + integrity sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0= + json-parse-better-errors@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" @@ -1304,6 +2094,13 @@ json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" +json5@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.0.tgz#e7a0c62c48285c628d20a10b85c89bb807c32850" + integrity sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ== + dependencies: + minimist "^1.2.0" + kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: version "3.2.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" @@ -1514,6 +2311,11 @@ minimist@0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" +minimist@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= + mixin-deep@^1.2.0: version "1.3.1" resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.1.tgz#a49e7268dce1a0d9698e45326c5626df3543d0fe" @@ -1546,6 +2348,11 @@ ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" +ms@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" + integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== + mute-stream@0.0.7: version "0.0.7" resolved "http://registry.npm.taobao.org/mute-stream/download/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" @@ -1574,6 +2381,13 @@ nice-try@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" +node-releases@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.0.3.tgz#3414ed84595096459c251699bfcb47d88324a9e4" + integrity sha512-ZaZWMsbuDcetpHmYeKWPO6e63pSXLb50M7lJgCbcM2nC/nQC3daNifmtp5a2kp7EWwYfhuvH6zLPWkrF8IiDdw== + dependencies: + semver "^5.3.0" + normalize-package-data@^2.3.2: version "2.4.0" resolved "http://registry.npm.taobao.org/normalize-package-data/download/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f" @@ -1819,6 +2633,11 @@ pretty-format@^23.5.0: ansi-regex "^3.0.0" ansi-styles "^3.2.0" +private@^0.1.6: + version "0.1.8" + resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" + integrity sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg== + progress@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f" @@ -1854,6 +2673,25 @@ read-pkg@^4.0.1: parse-json "^4.0.0" pify "^3.0.0" +regenerate-unicode-properties@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-7.0.0.tgz#107405afcc4a190ec5ed450ecaa00ed0cafa7a4c" + integrity sha512-s5NGghCE4itSlUS+0WUj88G6cfMVMmH8boTPNvABf8od+2dhT9WDlWu8n01raQAJZMOK8Ch6jSexaRO7swd6aw== + dependencies: + regenerate "^1.4.0" + +regenerate@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.0.tgz#4a856ec4b56e4077c557589cae85e7a4c8869a11" + integrity sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg== + +regenerator-transform@^0.13.3: + version "0.13.3" + resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.13.3.tgz#264bd9ff38a8ce24b06e0636496b2c856b57bcbb" + integrity sha512-5ipTrZFSq5vU2YoGoww4uaRVAK4wyYC4TSICibbfEPOruUu8FFP7ErV0BjmbIOEpn3O/k9na9UEdYR/3m7N6uA== + dependencies: + private "^0.1.6" + regex-not@^1.0.0, regex-not@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" @@ -1865,6 +2703,30 @@ regexpp@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.0.tgz#b2a7534a85ca1b033bcf5ce9ff8e56d4e0755365" +regexpu-core@^4.1.3, regexpu-core@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.2.0.tgz#a3744fa03806cffe146dea4421a3e73bdcc47b1d" + integrity sha512-Z835VSnJJ46CNBttalHD/dB+Sj2ezmY6Xp38npwU87peK6mqOzOpV8eYktdkLTEkzzD+JsTcxd84ozd8I14+rw== + dependencies: + regenerate "^1.4.0" + regenerate-unicode-properties "^7.0.0" + regjsgen "^0.4.0" + regjsparser "^0.3.0" + unicode-match-property-ecmascript "^1.0.4" + unicode-match-property-value-ecmascript "^1.0.2" + +regjsgen@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.4.0.tgz#c1eb4c89a209263f8717c782591523913ede2561" + integrity sha512-X51Lte1gCYUdlwhF28+2YMO0U6WeN0GLpgpA7LK7mbdDnkQYiwvEpmpe0F/cv5L14EbxgrdayAG3JETBv0dbXA== + +regjsparser@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.3.0.tgz#3c326da7fcfd69fa0d332575a41c8c0cdf588c96" + integrity sha512-zza72oZBBHzt64G7DxdqrOo/30bhHkwMUoT0WqfGu98XLd7N+1tsy5MJ96Bk4MD0y74n629RhmrGW6XlnLLwCA== + dependencies: + jsesc "~0.5.0" + repeat-element@^1.1.2: version "1.1.3" resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" @@ -1894,15 +2756,16 @@ resolve-url@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" -resolve@^1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36" +resolve@^1.3.2, resolve@^1.6.0: + version "1.8.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.8.1.tgz#82f1ec19a423ac1fbd080b0bab06ba36e84a7a26" + integrity sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA== dependencies: path-parse "^1.0.5" -resolve@^1.6.0: - version "1.8.1" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.8.1.tgz#82f1ec19a423ac1fbd080b0bab06ba36e84a7a26" +resolve@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36" dependencies: path-parse "^1.0.5" @@ -1946,6 +2809,11 @@ rxjs@^6.1.0: dependencies: tslib "^1.9.0" +safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + safe-regex@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" @@ -1964,6 +2832,11 @@ semver-compare@^1.0.0: version "5.5.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" +semver@^5.3.0, semver@^5.4.1, semver@^5.6.0: + version "5.6.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" + integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg== + semver@^5.5.0, semver@^5.5.1: version "5.5.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.1.tgz#7dfdd8814bdb7cabc7be0fb1d734cfb66c940477" @@ -2230,6 +3103,29 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" +unicode-canonical-property-names-ecmascript@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz#2619800c4c825800efdd8343af7dd9933cbe2818" + integrity sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ== + +unicode-match-property-ecmascript@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz#8ed2a32569961bce9227d09cd3ffbb8fed5f020c" + integrity sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg== + dependencies: + unicode-canonical-property-names-ecmascript "^1.0.4" + unicode-property-aliases-ecmascript "^1.0.4" + +unicode-match-property-value-ecmascript@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.0.2.tgz#9f1dc76926d6ccf452310564fd834ace059663d4" + integrity sha512-Rx7yODZC1L/T8XKo/2kNzVAQaRE88AaMvI1EF/Xnj3GW2wzN6fop9DDWuFAKUVFH7vozkz26DzP0qyWLKLIVPQ== + +unicode-property-aliases-ecmascript@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.0.4.tgz#5a533f31b4317ea76f17d807fa0d116546111dd0" + integrity sha512-2WSLa6OdYd2ng8oqiGIWnJqyFArvhn+5vgx5GTxMbUYjCYKUcuKS62YLFF0R/BDGlB1yzXjQOLtPAfHsgirEpg== + union-value@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.0.tgz#5c71c34cb5bad5dcebe3ea0cd08207ba5aa1aea4" From 2b9ee42ded0436254cf8c37d53bffe78b186131c Mon Sep 17 00:00:00 2001 From: Kai Cataldo Date: Thu, 10 Jan 2019 18:28:40 -0500 Subject: [PATCH 457/569] Remove monkeypatching dead code (babel/babel-eslint#737) --- .../babel-eslint-parser/lib/analyze-scope.js | 5 --- eslint/babel-eslint-parser/package.json | 2 +- .../test/fixtures/preprocess-to-patch.js | 6 --- .../test/specs/integration.js | 11 +++++ .../z_parser-for-eslint-after-patched.js | 45 ------------------- 5 files changed, 12 insertions(+), 57 deletions(-) delete mode 100644 eslint/babel-eslint-parser/test/fixtures/preprocess-to-patch.js delete mode 100644 eslint/babel-eslint-parser/test/specs/z_parser-for-eslint-after-patched.js diff --git a/eslint/babel-eslint-parser/lib/analyze-scope.js b/eslint/babel-eslint-parser/lib/analyze-scope.js index aa3431a4cc51..ed2dab65095d 100644 --- a/eslint/babel-eslint-parser/lib/analyze-scope.js +++ b/eslint/babel-eslint-parser/lib/analyze-scope.js @@ -327,11 +327,6 @@ module.exports = function(ast, parserOptions) { fallback, }; - if (OriginalReferencer._babelEslintPatched) { - require("./patch-eslint-scope")(parserOptions); - return escope.analyze(ast, options); - } - options.childVisitorKeys = childVisitorKeys; const scopeManager = new escope.ScopeManager(options); diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index e43b064a5ed5..31de034c4c5e 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -14,7 +14,7 @@ "homepage": "https://github.com/babel/babel-eslint", "scripts": { "test": "npm run lint && npm run test-only", - "test-only": "cd test && mocha --require fixtures/preprocess-to-patch.js specs && cd -", + "test-only": "cd test && mocha specs && cd -", "lint": "eslint .", "lint-fix": "npm run lint -- --fix", "precommit": "lint-staged", diff --git a/eslint/babel-eslint-parser/test/fixtures/preprocess-to-patch.js b/eslint/babel-eslint-parser/test/fixtures/preprocess-to-patch.js deleted file mode 100644 index 8cb4c54fb6de..000000000000 --- a/eslint/babel-eslint-parser/test/fixtures/preprocess-to-patch.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict" - -const babelEslint = require("../..") - -// Apply monkeypatch to eslint-scope. -babelEslint.parse("var x = 0;") diff --git a/eslint/babel-eslint-parser/test/specs/integration.js b/eslint/babel-eslint-parser/test/specs/integration.js index 4e0851d8a42d..27caec55cb6e 100644 --- a/eslint/babel-eslint-parser/test/specs/integration.js +++ b/eslint/babel-eslint-parser/test/specs/integration.js @@ -223,3 +223,14 @@ function strictSuite() { // it }); } + +describe("https://github.com/babel/babel-eslint/issues/558", () => { + it("doesn't crash with eslint-plugin-import", () => { + const engine = new eslint.CLIEngine({ ignore: false }); + engine.executeOnFiles([ + "fixtures/eslint-plugin-import/a.js", + "fixtures/eslint-plugin-import/b.js", + "fixtures/eslint-plugin-import/c.js", + ]); + }); +}); diff --git a/eslint/babel-eslint-parser/test/specs/z_parser-for-eslint-after-patched.js b/eslint/babel-eslint-parser/test/specs/z_parser-for-eslint-after-patched.js deleted file mode 100644 index bc787db34951..000000000000 --- a/eslint/babel-eslint-parser/test/specs/z_parser-for-eslint-after-patched.js +++ /dev/null @@ -1,45 +0,0 @@ -"use strict"; - -const eslint = require("eslint"); -const assert = require("assert"); -const babelEslint = require("../.."); -const espree = require("espree"); -const assertImplementsAST = require("../helpers/assert-implements-ast"); - -describe("https://github.com/babel/babel-eslint/issues/558", () => { - it("don't crash with eslint-plugin-import", () => { - const engine = new eslint.CLIEngine({ ignore: false }); - engine.executeOnFiles([ - "../test/fixtures/eslint-plugin-import/a.js", - "../test/fixtures/eslint-plugin-import/b.js", - "../test/fixtures/eslint-plugin-import/c.js", - ]); - }); - - /* - * This test ensures that the enhanced referencer does not get used if eslint-scope has already been - * monkeypatched, because this causes some correctness issues. For example, if the enhanced referencer - * is used after the original referencer is monkeypatched, type annotation references are counted twice. - */ - it("does not visit type annotations multiple times after monkeypatching and calling parseForESLint()", () => { - assertImplementsAST( - espree.parse("foo", { sourceType: "module" }), - babelEslint.parse("foo", {}) - ); - const parseResult = babelEslint.parseForESLint( - "type Foo = {}; function x(): Foo {}", - { - eslintVisitorKeys: true, - eslintScopeManager: true, - } - ); - assert(parseResult.visitorKeys); - assert(parseResult.scopeManager); - - const fooVariable = parseResult.scopeManager.getDeclaredVariables( - parseResult.ast.body[0] - )[0]; - - assert.strictEqual(fooVariable.references.length, 1); - }); -}); From bbce2b380734873aa3ba87d0342891bde82c1b88 Mon Sep 17 00:00:00 2001 From: Kai Cataldo Date: Fri, 11 Jan 2019 12:23:34 -0500 Subject: [PATCH 458/569] Remove comment attachment (babel/babel-eslint#736) * Remove comment attachment * Simplify error messaging in tests --- .../lib/babylon-to-espree/attachComments.js | 59 ------------------- .../{toAST.js => convertAST.js} | 9 +-- .../babylon-to-espree/convertProgramNode.js | 40 +++++++++++++ .../{toToken.js => convertToken.js} | 0 .../{toTokens.js => convertTokens.js} | 4 +- .../lib/babylon-to-espree/index.js | 27 ++------- .../test/specs/babel-eslint.js | 35 +---------- 7 files changed, 52 insertions(+), 122 deletions(-) delete mode 100644 eslint/babel-eslint-parser/lib/babylon-to-espree/attachComments.js rename eslint/babel-eslint-parser/lib/babylon-to-espree/{toAST.js => convertAST.js} (92%) create mode 100644 eslint/babel-eslint-parser/lib/babylon-to-espree/convertProgramNode.js rename eslint/babel-eslint-parser/lib/babylon-to-espree/{toToken.js => convertToken.js} (100%) rename eslint/babel-eslint-parser/lib/babylon-to-espree/{toTokens.js => convertTokens.js} (72%) diff --git a/eslint/babel-eslint-parser/lib/babylon-to-espree/attachComments.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/attachComments.js deleted file mode 100644 index 6e198753845f..000000000000 --- a/eslint/babel-eslint-parser/lib/babylon-to-espree/attachComments.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict"; - -// comment fixes -module.exports = function(ast, comments, tokens) { - if (comments.length) { - const firstComment = comments[0]; - const lastComment = comments[comments.length - 1]; - // fixup program start - if (!tokens.length) { - // if no tokens, the program starts at the end of the last comment - ast.start = lastComment.end; - ast.loc.start.line = lastComment.loc.end.line; - ast.loc.start.column = lastComment.loc.end.column; - - if (ast.leadingComments === null && ast.innerComments.length) { - ast.leadingComments = ast.innerComments; - } - } else if (firstComment.start < tokens[0].start) { - // if there are comments before the first token, the program starts at the first token - const token = tokens[0]; - // ast.start = token.start; - // ast.loc.start.line = token.loc.start.line; - // ast.loc.start.column = token.loc.start.column; - - // estraverse do not put leading comments on first node when the comment - // appear before the first token - if (ast.body.length) { - const node = ast.body[0]; - node.leadingComments = []; - const firstTokenStart = token.start; - const len = comments.length; - for (let i = 0; i < len && comments[i].start < firstTokenStart; i++) { - node.leadingComments.push(comments[i]); - } - } - } - // fixup program end - if (tokens.length) { - const lastToken = tokens[tokens.length - 1]; - if (lastComment.end > lastToken.end) { - // If there is a comment after the last token, the program ends at the - // last token and not the comment - // ast.end = lastToken.end; - ast.range[1] = lastToken.end; - ast.loc.end.line = lastToken.loc.end.line; - ast.loc.end.column = lastToken.loc.end.column; - } - } - } else { - if (!tokens.length) { - ast.loc.start.line = 1; - ast.loc.end.line = 1; - } - } - if (ast.body && ast.body.length > 0) { - ast.loc.start.line = ast.body[0].loc.start.line; - ast.range[0] = ast.body[0].start; - } -}; diff --git a/eslint/babel-eslint-parser/lib/babylon-to-espree/toAST.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/convertAST.js similarity index 92% rename from eslint/babel-eslint-parser/lib/babylon-to-espree/toAST.js rename to eslint/babel-eslint-parser/lib/babylon-to-espree/convertAST.js index 2ab165df69ec..0ef37750d7ab 100644 --- a/eslint/babel-eslint-parser/lib/babylon-to-espree/toAST.js +++ b/eslint/babel-eslint-parser/lib/babylon-to-espree/convertAST.js @@ -1,7 +1,7 @@ "use strict"; const t = require("@babel/core").types; -const convertComments = require("./convertComments"); +const convertProgramNode = require("./convertProgramNode"); module.exports = function(ast, traverse, code) { const state = { source: code }; @@ -20,6 +20,8 @@ module.exports = function(ast, traverse, code) { delete t.VISITOR_KEYS.Property; delete t.VISITOR_KEYS.MethodDefinition; + + convertProgramNode(ast); }; const astTransformVisitor = { @@ -31,16 +33,15 @@ const astTransformVisitor = { node._babelType = node.type; if (node.innerComments) { - node.trailingComments = node.innerComments; delete node.innerComments; } if (node.trailingComments) { - convertComments(node.trailingComments); + delete node.trailingComments; } if (node.leadingComments) { - convertComments(node.leadingComments); + delete node.leadingComments; } }, exit(path) { diff --git a/eslint/babel-eslint-parser/lib/babylon-to-espree/convertProgramNode.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/convertProgramNode.js new file mode 100644 index 000000000000..810b19888213 --- /dev/null +++ b/eslint/babel-eslint-parser/lib/babylon-to-espree/convertProgramNode.js @@ -0,0 +1,40 @@ +"use strict"; + +module.exports = function(ast) { + ast.type = "Program"; + ast.sourceType = ast.program.sourceType; + ast.directives = ast.program.directives; + ast.body = ast.program.body; + delete ast.program; + + if (ast.comments.length) { + const lastComment = ast.comments[ast.comments.length - 1]; + + if (!ast.tokens.length) { + // if no tokens, the program starts at the end of the last comment + ast.start = lastComment.end; + ast.loc.start.line = lastComment.loc.end.line; + ast.loc.start.column = lastComment.loc.end.column; + } else { + const lastToken = ast.tokens[ast.tokens.length - 1]; + + if (lastComment.end > lastToken.end) { + // If there is a comment after the last token, the program ends at the + // last token and not the comment + ast.range[1] = lastToken.end; + ast.loc.end.line = lastToken.loc.end.line; + ast.loc.end.column = lastToken.loc.end.column; + } + } + } else { + if (!ast.tokens.length) { + ast.loc.start.line = 1; + ast.loc.end.line = 1; + } + } + + if (ast.body && ast.body.length > 0) { + ast.loc.start.line = ast.body[0].loc.start.line; + ast.range[0] = ast.body[0].start; + } +}; diff --git a/eslint/babel-eslint-parser/lib/babylon-to-espree/toToken.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/convertToken.js similarity index 100% rename from eslint/babel-eslint-parser/lib/babylon-to-espree/toToken.js rename to eslint/babel-eslint-parser/lib/babylon-to-espree/convertToken.js diff --git a/eslint/babel-eslint-parser/lib/babylon-to-espree/toTokens.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/convertTokens.js similarity index 72% rename from eslint/babel-eslint-parser/lib/babylon-to-espree/toTokens.js rename to eslint/babel-eslint-parser/lib/babylon-to-espree/convertTokens.js index 2927c4b01123..0f49d9373089 100644 --- a/eslint/babel-eslint-parser/lib/babylon-to-espree/toTokens.js +++ b/eslint/babel-eslint-parser/lib/babylon-to-espree/convertTokens.js @@ -1,10 +1,10 @@ "use strict"; const convertTemplateType = require("./convertTemplateType"); -const toToken = require("./toToken"); +const convertToken = require("./convertToken"); module.exports = function(tokens, tt, code) { return convertTemplateType(tokens, tt) .filter(t => t.type !== "CommentLine" && t.type !== "CommentBlock") - .map(t => toToken(t, tt, code)); + .map(t => convertToken(t, tt, code)); }; diff --git a/eslint/babel-eslint-parser/lib/babylon-to-espree/index.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/index.js index c0fdf323a884..cc4dda974358 100644 --- a/eslint/babel-eslint-parser/lib/babylon-to-espree/index.js +++ b/eslint/babel-eslint-parser/lib/babylon-to-espree/index.js @@ -1,30 +1,11 @@ "use strict"; -const attachComments = require("./attachComments"); +const convertTokens = require("./convertTokens"); const convertComments = require("./convertComments"); -const toTokens = require("./toTokens"); -const toAST = require("./toAST"); +const convertAST = require("./convertAST"); module.exports = function(ast, traverse, tt, code) { - // convert tokens - ast.tokens = toTokens(ast.tokens, tt, code); - - // add comments + ast.tokens = convertTokens(ast.tokens, tt, code); convertComments(ast.comments); - - // transform esprima and acorn divergent nodes - toAST(ast, traverse, code); - - // ast.program.tokens = ast.tokens; - // ast.program.comments = ast.comments; - // ast = ast.program; - - // remove File - ast.type = "Program"; - ast.sourceType = ast.program.sourceType; - ast.directives = ast.program.directives; - ast.body = ast.program.body; - delete ast.program; - - attachComments(ast, ast.comments, ast.tokens); + convertAST(ast, traverse, code); }; diff --git a/eslint/babel-eslint-parser/test/specs/babel-eslint.js b/eslint/babel-eslint-parser/test/specs/babel-eslint.js index becf4e31c590..849e37ab97bc 100644 --- a/eslint/babel-eslint-parser/test/specs/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/specs/babel-eslint.js @@ -4,23 +4,9 @@ const assert = require("assert"); const babelEslint = require("../.."); const espree = require("espree"); const escope = require("eslint-scope"); -const util = require("util"); const unpad = require("dedent"); const assertImplementsAST = require("../helpers/assert-implements-ast"); -function lookup(obj, keypath, backwardsDepth) { - if (!keypath) { - return obj; - } - - return keypath - .split(".") - .slice(0, -1 * backwardsDepth) - .reduce((base, segment) => { - return base && base[segment], obj; - }); -} - function parseAndAssertSame(code) { code = unpad(code); const esAST = espree.parse(code, { @@ -38,7 +24,6 @@ function parseAndAssertSame(code) { loc: true, range: true, comment: true, - attachComment: true, ecmaVersion: 2018, sourceType: "module", }); @@ -46,25 +31,7 @@ function parseAndAssertSame(code) { eslintVisitorKeys: true, eslintScopeManager: true, }).ast; - try { - assertImplementsAST(esAST, babylonAST); - } catch (err) { - const traversal = err.message.slice(3, err.message.indexOf(":")); - err.message += unpad(` - espree: - ${util.inspect(lookup(esAST, traversal, 2), { - depth: err.depth, - colors: true, - })} - babel-eslint: - ${util.inspect(lookup(babylonAST, traversal, 2), { - depth: err.depth, - colors: true, - })} - `); - throw err; - } - //assert.equal(esAST, babylonAST); + assertImplementsAST(esAST, babylonAST); } describe("babylon-to-espree", () => { From 0581ce1559038a68f8edc73a9453d88553dec66f Mon Sep 17 00:00:00 2001 From: Kai Cataldo Date: Fri, 11 Jan 2019 15:27:36 -0500 Subject: [PATCH 459/569] Add code of conduct (same as Babel) (babel/babel-eslint#740) [skip ci] --- eslint/babel-eslint-parser/CODE_OF_CONDUCT.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 eslint/babel-eslint-parser/CODE_OF_CONDUCT.md diff --git a/eslint/babel-eslint-parser/CODE_OF_CONDUCT.md b/eslint/babel-eslint-parser/CODE_OF_CONDUCT.md new file mode 100644 index 000000000000..1219f9578c90 --- /dev/null +++ b/eslint/babel-eslint-parser/CODE_OF_CONDUCT.md @@ -0,0 +1,3 @@ +# Code of Conduct + +This project shares the same code of conduct as [Babel](https://github.com/babel/babel), which can be found [here](https://github.com/babel/babel/blob/master/CODE_OF_CONDUCT.md). From 37cf65c6f8d12cfcb6cf2fa5ffe5965ce1e13fc4 Mon Sep 17 00:00:00 2001 From: Kai Cataldo Date: Mon, 21 Jan 2019 11:06:29 -0500 Subject: [PATCH 460/569] Add requireConfigFile option (babel/babel-eslint#743) * Add requireConfigFile option * Update README.md --- eslint/babel-eslint-parser/README.md | 1 + .../babel-eslint-parser/lib/analyze-scope.js | 2 +- eslint/babel-eslint-parser/lib/index.js | 3 +-- eslint/babel-eslint-parser/lib/parse.js | 26 +++++++++++++++++-- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index ad8fc01d0d0e..25373821ddee 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -53,6 +53,7 @@ With the parser set, your configuration can be configured as described in the [C Additional configuration options can be set in your ESLint configuration under the `parserOptions` key. Please note that the `ecmaFeatures` config property may still be required for ESLint to work properly with features not in ECMAScript 5 by default. +- `requireConfigFile` (default `true`) can be set to `false` to allow babel-eslint to run on files that do not have a Babel configuration associated with them. This can be useful for linting files that are not transformed by Babel (such as tooling configuration files), though we recommend using the default parser via [glob-based configuration](https://eslint.org/docs/user-guide/configuring#configuration-based-on-glob-patterns). Note: babel-eslint will not parse any experimental syntax when no configuration file is found. - `sourceType` can be set to `"module"`(default) or `"script"` if your code isn't using ECMAScript modules. - `allowImportExportEverywhere` (default `false`) can be set to `true` to allow import and export declarations to appear anywhere a statement is allowed if your build environment supports that. Otherwise import and export declarations can only appear at a program's top level. - `ecmaFeatures.globalReturn` (default `false`) allow return statements in the global scope when used with `sourceType: "script"`. diff --git a/eslint/babel-eslint-parser/lib/analyze-scope.js b/eslint/babel-eslint-parser/lib/analyze-scope.js index ed2dab65095d..38561521d3f8 100644 --- a/eslint/babel-eslint-parser/lib/analyze-scope.js +++ b/eslint/babel-eslint-parser/lib/analyze-scope.js @@ -323,7 +323,7 @@ module.exports = function(ast, parserOptions) { parserOptions.ecmaFeatures.globalReturn) === true, impliedStrict: false, sourceType: ast.sourceType, - ecmaVersion: parserOptions.ecmaVersion || 2018, + ecmaVersion: parserOptions.ecmaVersion, fallback, }; diff --git a/eslint/babel-eslint-parser/lib/index.js b/eslint/babel-eslint-parser/lib/index.js index c9478419f18e..459444cf9c2c 100644 --- a/eslint/babel-eslint-parser/lib/index.js +++ b/eslint/babel-eslint-parser/lib/index.js @@ -16,7 +16,7 @@ exports.parse = function(code, options) { return exports.parseForESLint(code, options).ast; }; -exports.parseForESLint = function(code, options) { +exports.parseForESLint = function(code, options = {}) { if (!IS_RUNNING_SUPPORTED_VERSION) { throw new Error( `babel-eslint@${ @@ -25,7 +25,6 @@ exports.parseForESLint = function(code, options) { ); } - options = options || {}; options.babelOptions = options.babelOptions || {}; options.ecmaVersion = options.ecmaVersion || 2018; options.sourceType = options.sourceType || "module"; diff --git a/eslint/babel-eslint-parser/lib/parse.js b/eslint/babel-eslint-parser/lib/parse.js index f6b55a1486ba..c83fcb9c997b 100644 --- a/eslint/babel-eslint-parser/lib/parse.js +++ b/eslint/babel-eslint-parser/lib/parse.js @@ -1,10 +1,15 @@ "use strict"; const babylonToEspree = require("./babylon-to-espree"); -const { parseSync: parse, tokTypes: tt, traverse } = require("@babel/core"); +const { + parseSync: parse, + tokTypes: tt, + traverse, + loadPartialConfig, +} = require("@babel/core"); module.exports = function(code, options) { - const opts = { + let opts = { sourceType: options.sourceType, filename: options.filePath, cwd: options.babelOptions.cwd, @@ -35,7 +40,24 @@ module.exports = function(code, options) { }, }; + if (options.requireConfigFile !== false) { + const config = loadPartialConfig(opts); + + if (config !== null) { + if (!config.hasFilesystemConfig()) { + throw new Error( + `No Babel config file detected for ${ + config.options.filename + }. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files.` + ); + } + + opts = config.options; + } + } + let ast; + try { ast = parse(code, opts); } catch (err) { From 2d64900b46a36c46efbb6224f46c0d460a2ec322 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 21 Jan 2019 16:29:18 -0500 Subject: [PATCH 461/569] 11.0.0-beta.0 --- eslint/babel-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 31de034c4c5e..a3b1d171873c 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "babel-eslint", - "version": "10.0.1", + "version": "11.0.0-beta.0", "description": "Custom parser for ESLint", "author": "Sebastian McKenzie ", "license": "MIT", From 025fff787164f23471fc9afbbe1d409ee946779e Mon Sep 17 00:00:00 2001 From: Kai Cataldo Date: Tue, 29 Jan 2019 10:56:54 -0500 Subject: [PATCH 462/569] Docs: Add glob-based configuration example (babel/babel-eslint#748) * Docs: Add glob-based configuration example * Fix quotes style for consistency --- eslint/babel-eslint-parser/README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index 25373821ddee..ca0f16ea38e4 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -77,6 +77,24 @@ module.exports = { }; ``` +**.eslintrc.js using glob-based configuration** + +This configuration would use the default parser for all files except for those found by the `"files/transformed/by/babel/*.js"` glob. + +```js +module.exports = { + rules: { + indent: "error" + }, + overrides: [ + { + files: ["files/transformed/by/babel/*.js"], + parser: "babel-eslint", + } + ] +}; +``` + ### Run ```sh From 3fcfc90a123cf7fd8ab667a593ccc8ff4ab70094 Mon Sep 17 00:00:00 2001 From: Yosuke Ota Date: Fri, 15 Feb 2019 07:56:30 +0900 Subject: [PATCH 463/569] Fix to convert hash token. (babel/babel-eslint#753) --- .../lib/babylon-to-espree/convertToken.js | 1 + eslint/babel-eslint-parser/test/specs/babel-eslint.js | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/eslint/babel-eslint-parser/lib/babylon-to-espree/convertToken.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/convertToken.js index 3e0ba453c9fb..2d8e9b1aac34 100644 --- a/eslint/babel-eslint-parser/lib/babylon-to-espree/convertToken.js +++ b/eslint/babel-eslint-parser/lib/babylon-to-espree/convertToken.js @@ -44,6 +44,7 @@ module.exports = function(token, tt, source) { type === tt.bang || type === tt.tilde || type === tt.doubleColon || + type === tt.hash || type.isAssign ) { token.type = "Punctuator"; diff --git a/eslint/babel-eslint-parser/test/specs/babel-eslint.js b/eslint/babel-eslint-parser/test/specs/babel-eslint.js index 849e37ab97bc..02328e868e76 100644 --- a/eslint/babel-eslint-parser/test/specs/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/specs/babel-eslint.js @@ -267,6 +267,17 @@ describe("babylon-to-espree", () => { assert.strictEqual(babylonAST.tokens[1].type, "Punctuator"); }); + // Espree doesn't support the private fields yet + it("hash (token)", () => { + const code = "class A { #x }"; + const babylonAST = babelEslint.parseForESLint(code, { + eslintVisitorKeys: true, + eslintScopeManager: true, + }).ast; + assert.strictEqual(babylonAST.tokens[3].type, "Punctuator"); + assert.strictEqual(babylonAST.tokens[3].value, "#"); + }); + it.skip("empty program with line comment", () => { parseAndAssertSame("// single comment"); }); From f9836caee5e546a1bed6378667f75aa7b3769bd7 Mon Sep 17 00:00:00 2001 From: Param Aggarwal Date: Thu, 4 Apr 2019 19:51:25 +0530 Subject: [PATCH 464/569] fix typo in README.md (babel/babel-eslint#762) --- eslint/babel-eslint-parser/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-parser/README.md b/eslint/babel-eslint-parser/README.md index ca0f16ea38e4..cc7fd8f5141c 100644 --- a/eslint/babel-eslint-parser/README.md +++ b/eslint/babel-eslint-parser/README.md @@ -9,7 +9,7 @@ As of the v11.x.x release, babel-eslint now requires Babel as a peer dependency ## When should I use babel-eslint? -ESLint's default parser and core rules [only suppport the latest final ECMAScript standard](https://github.com/eslint/eslint/blob/a675c89573836adaf108a932696b061946abf1e6/README.md#what-about-experimental-features) and do not support experimental (such as new features) and non-standard (such as Flow or TypeScript types) syntax provided by Babel. babel-eslint is a parser that allows ESLint to run on source code that is transformed by Babel. +ESLint's default parser and core rules [only support the latest final ECMAScript standard](https://github.com/eslint/eslint/blob/a675c89573836adaf108a932696b061946abf1e6/README.md#what-about-experimental-features) and do not support experimental (such as new features) and non-standard (such as Flow or TypeScript types) syntax provided by Babel. babel-eslint is a parser that allows ESLint to run on source code that is transformed by Babel. **Note:** You only need to use babel-eslint if you are using Babel to transform your code. If this is not the case, please use the relevant parser for your chosen flavor of ECMAScript (note that the default parser supports all non-experimental syntax as well as JSX). From 6748797681a32888dc4aae9a508453da7973fbe8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Jul 2019 18:25:29 +0200 Subject: [PATCH 465/569] Bump lodash from 4.17.5 to 4.17.14 (babel/babel-eslint#779) Bumps [lodash](https://github.com/lodash/lodash) from 4.17.5 to 4.17.14. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.5...4.17.14) Signed-off-by: dependabot[bot] --- eslint/babel-eslint-parser/yarn.lock | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index aec76fb40e5f..67c15991c84e 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -2229,13 +2229,10 @@ locate-path@^3.0.0: p-locate "^3.0.0" path-exists "^3.0.0" -lodash@^4.15.0: - version "4.17.5" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" - -lodash@^4.17.10, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.0: - version "4.17.10" - resolved "http://registry.npm.taobao.org/lodash/download/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7" +lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.0: + version "4.17.14" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.14.tgz#9ce487ae66c96254fe20b599f21b6816028078ba" + integrity sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw== log-symbols@^1.0.2: version "1.0.2" @@ -2453,7 +2450,7 @@ once@^1.3.0: onetime@^1.0.0: version "1.1.0" - resolved "http://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789" + resolved "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789" onetime@^2.0.0: version "2.0.1" @@ -3040,7 +3037,7 @@ symbol-observable@^1.1.0: table@^4.0.3: version "4.0.3" - resolved "http://registry.npmjs.org/table/-/table-4.0.3.tgz#00b5e2b602f1794b9acaf9ca908a76386a7813bc" + resolved "https://registry.npmjs.org/table/-/table-4.0.3.tgz#00b5e2b602f1794b9acaf9ca908a76386a7813bc" dependencies: ajv "^6.0.1" ajv-keywords "^3.0.0" From 86350631183488c2509204e107b3787aa3b7aa48 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Jul 2019 18:27:39 +0200 Subject: [PATCH 466/569] Bump js-yaml from 3.12.0 to 3.13.1 (babel/babel-eslint#780) Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.12.0 to 3.13.1. - [Release notes](https://github.com/nodeca/js-yaml/releases) - [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md) - [Commits](https://github.com/nodeca/js-yaml/compare/3.12.0...3.13.1) Signed-off-by: dependabot[bot] --- eslint/babel-eslint-parser/yarn.lock | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index 67c15991c84e..e0973a435208 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -979,6 +979,7 @@ any-observable@^0.3.0: argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== dependencies: sprintf-js "~1.0.2" @@ -1499,6 +1500,7 @@ espree@^4.0.0: esprima@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== esquery@^1.0.1: version "1.0.1" @@ -2067,8 +2069,9 @@ js-tokens@^3.0.0: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" js-yaml@^3.12.0, js-yaml@^3.9.0: - version "3.12.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1" + version "3.13.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" + integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== dependencies: argparse "^1.0.7" esprima "^4.0.0" @@ -2952,6 +2955,7 @@ split-string@^3.0.1, split-string@^3.0.2: sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= staged-git-files@1.1.1: version "1.1.1" From 030fddb0b88b9288fb9f762126107ad3bd8e1b87 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Mon, 15 Jul 2019 18:49:52 +0200 Subject: [PATCH 467/569] chore: Update deps and fix tests for new mocha and eslint (babel/babel-eslint#781) --- eslint/babel-eslint-parser/.travis.yml | 3 +- eslint/babel-eslint-parser/lib/index.js | 4 +- eslint/babel-eslint-parser/lib/parse.js | 4 +- eslint/babel-eslint-parser/package.json | 12 +- .../test/helpers/assert-implements-ast.js | 4 +- .../test/specs/babel-eslint.js | 4 +- .../test/specs/integration.js | 6 +- .../test/specs/non-regression.js | 9 +- eslint/babel-eslint-parser/yarn.lock | 2802 ++++++++++------- 9 files changed, 1696 insertions(+), 1152 deletions(-) diff --git a/eslint/babel-eslint-parser/.travis.yml b/eslint/babel-eslint-parser/.travis.yml index 21826d3469db..8ece2fc21261 100644 --- a/eslint/babel-eslint-parser/.travis.yml +++ b/eslint/babel-eslint-parser/.travis.yml @@ -1,10 +1,9 @@ sudo: false language: node_js node_js: - - "11" + - "12" - "10" - "8" - - "6" matrix: fast_finish: true diff --git a/eslint/babel-eslint-parser/lib/index.js b/eslint/babel-eslint-parser/lib/index.js index 459444cf9c2c..2769d4a0c09a 100644 --- a/eslint/babel-eslint-parser/lib/index.js +++ b/eslint/babel-eslint-parser/lib/index.js @@ -19,9 +19,7 @@ exports.parse = function(code, options) { exports.parseForESLint = function(code, options = {}) { if (!IS_RUNNING_SUPPORTED_VERSION) { throw new Error( - `babel-eslint@${ - packageJson.version - } does not support @babel/core@${CURRENT_BABEL_VERSION}. Please downgrade to babel-eslint@^10 or upgrade to @babel/core@${SUPPORTED_BABEL_VERSION_RANGE}` + `babel-eslint@${packageJson.version} does not support @babel/core@${CURRENT_BABEL_VERSION}. Please downgrade to babel-eslint@^10 or upgrade to @babel/core@${SUPPORTED_BABEL_VERSION_RANGE}` ); } diff --git a/eslint/babel-eslint-parser/lib/parse.js b/eslint/babel-eslint-parser/lib/parse.js index c83fcb9c997b..3930bb04057d 100644 --- a/eslint/babel-eslint-parser/lib/parse.js +++ b/eslint/babel-eslint-parser/lib/parse.js @@ -46,9 +46,7 @@ module.exports = function(code, options) { if (config !== null) { if (!config.hasFilesystemConfig()) { throw new Error( - `No Babel config file detected for ${ - config.options.filename - }. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files.` + `No Babel config file detected for ${config.options.filename}. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files.` ); } diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index a3b1d171873c..7ba87298d99b 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -52,17 +52,17 @@ "@babel/preset-env": "^7.1.5", "@babel/preset-flow": "^7.0.0", "@babel/preset-react": "^7.0.0", - "babel-eslint": "^8.2.6", + "babel-eslint": "^10.0.2", "dedent": "^0.7.0", - "eslint": "^5.6.0", - "eslint-config-babel": "^7.0.1", - "eslint-plugin-flowtype": "^2.30.3", + "eslint": "^6.0.1", + "eslint-config-babel": "^9.0.0", + "eslint-plugin-flowtype": "^3.11.1", "eslint-plugin-import": "^2.14.0", - "eslint-plugin-prettier": "^2.1.2", + "eslint-plugin-prettier": "^3.1.0", "espree": "^3.5.2", "husky": "^1.0.0-rc.13", "lint-staged": "^7.2.2", - "mocha": "^5.0.1", + "mocha": "^6.1.4", "prettier": "^1.4.4" }, "lint-staged": { diff --git a/eslint/babel-eslint-parser/test/helpers/assert-implements-ast.js b/eslint/babel-eslint-parser/test/helpers/assert-implements-ast.js index 892d200c612a..84e370f48ed2 100644 --- a/eslint/babel-eslint-parser/test/helpers/assert-implements-ast.js +++ b/eslint/babel-eslint-parser/test/helpers/assert-implements-ast.js @@ -24,9 +24,7 @@ module.exports = function assertImplementsAST(target, source, path) { target.constructor.name !== source.constructor.name ) { error( - `object have different constructors (${target.constructor.name} !== ${ - source.constructor.name - }` + `object have different constructors (${target.constructor.name} !== ${source.constructor.name}` ); } else if (typeA === "object") { const keysTarget = Object.keys(target); diff --git a/eslint/babel-eslint-parser/test/specs/babel-eslint.js b/eslint/babel-eslint-parser/test/specs/babel-eslint.js index 02328e868e76..dd83cc7831a9 100644 --- a/eslint/babel-eslint-parser/test/specs/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/specs/babel-eslint.js @@ -230,11 +230,11 @@ describe("babylon-to-espree", () => { }); it("export named", () => { - parseAndAssertSame("export { foo };"); + parseAndAssertSame("var foo = 1;export { foo };"); }); it("export named alias", () => { - parseAndAssertSame("export { foo as bar };"); + parseAndAssertSame("var foo = 1;export { foo as bar };"); }); // Espree doesn't support the optional chaining operator yet diff --git a/eslint/babel-eslint-parser/test/specs/integration.js b/eslint/babel-eslint-parser/test/specs/integration.js index 27caec55cb6e..d13a5aa3ff97 100644 --- a/eslint/babel-eslint-parser/test/specs/integration.js +++ b/eslint/babel-eslint-parser/test/specs/integration.js @@ -5,6 +5,10 @@ const eslint = require("eslint"); const fs = require("fs"); const path = require("path"); +const parser = require("../.."); + +eslint.linter.defineParser("current-babel-eslint", parser); + const paths = { fixtures: path.join(__dirname, "..", "fixtures", "rules"), }; @@ -13,7 +17,7 @@ const encoding = "utf8"; const errorLevel = 2; const baseEslintOpts = { - parser: require.resolve("../.."), + parser: "current-babel-eslint", parserOptions: { sourceType: "script", }, diff --git a/eslint/babel-eslint-parser/test/specs/non-regression.js b/eslint/babel-eslint-parser/test/specs/non-regression.js index 79754dab5edf..58d7056c42c5 100644 --- a/eslint/babel-eslint-parser/test/specs/non-regression.js +++ b/eslint/babel-eslint-parser/test/specs/non-regression.js @@ -4,6 +4,8 @@ const eslint = require("eslint"); const path = require("path"); const unpad = require("dedent"); +const parser = require("../.."); + function verifyAndAssertMessagesWithSpecificESLint( code, rules, @@ -13,7 +15,7 @@ function verifyAndAssertMessagesWithSpecificESLint( linter ) { const config = { - parser: require.resolve("../.."), + parser: "current-babel-eslint", rules, env: { node: true, @@ -66,13 +68,16 @@ function verifyAndAssertMessages( sourceType, overrideConfig ) { + const linter = new eslint.Linter(); + linter.defineParser("current-babel-eslint", parser); + verifyAndAssertMessagesWithSpecificESLint( unpad(`${code}`), rules || {}, expectedMessages || [], sourceType, overrideConfig, - new eslint.Linter() + linter ); } diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index e0973a435208..73f0201860e2 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -2,67 +2,41 @@ # yarn lockfile v1 -"@babel/code-frame@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.44.tgz#2a02643368de80916162be70865c97774f3adbd9" - dependencies: - "@babel/highlight" "7.0.0-beta.44" - "@babel/code-frame@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0.tgz#06e2ab19bdb535385559aabb5ba59729482800f8" + integrity sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA== dependencies: "@babel/highlight" "^7.0.0" "@babel/core@^7.2.0": - version "7.2.2" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.2.2.tgz#07adba6dde27bb5ad8d8672f15fde3e08184a687" - integrity sha512-59vB0RWt09cAct5EIe58+NzGP4TFSD3Bz//2/ELy3ZeTeKF6VTD1AXlH8BGGbCX0PuobZBsIzO7IAI9PH67eKw== + version "7.5.4" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.5.4.tgz#4c32df7ad5a58e9ea27ad025c11276324e0b4ddd" + integrity sha512-+DaeBEpYq6b2+ZmHx3tHspC+ZRflrvLqwfv8E3hNr5LVQoyBnL8RPKSBCg+rK2W2My9PWlujBiqd0ZPsR9Q6zQ== dependencies: "@babel/code-frame" "^7.0.0" - "@babel/generator" "^7.2.2" - "@babel/helpers" "^7.2.0" - "@babel/parser" "^7.2.2" - "@babel/template" "^7.2.2" - "@babel/traverse" "^7.2.2" - "@babel/types" "^7.2.2" + "@babel/generator" "^7.5.0" + "@babel/helpers" "^7.5.4" + "@babel/parser" "^7.5.0" + "@babel/template" "^7.4.4" + "@babel/traverse" "^7.5.0" + "@babel/types" "^7.5.0" convert-source-map "^1.1.0" debug "^4.1.0" json5 "^2.1.0" - lodash "^4.17.10" + lodash "^4.17.11" resolve "^1.3.2" semver "^5.4.1" source-map "^0.5.0" -"@babel/generator@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0-beta.44.tgz#c7e67b9b5284afcf69b309b50d7d37f3e5033d42" - dependencies: - "@babel/types" "7.0.0-beta.44" - jsesc "^2.5.1" - lodash "^4.2.0" - source-map "^0.5.0" - trim-right "^1.0.1" - -"@babel/generator@^7.1.5": - version "7.1.5" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.1.5.tgz#615f064d13d95f8f9157c7261f68eddf32ec15b3" - integrity sha512-IO31r62xfMI+wBJVmgx0JR9ZOHty8HkoYpQAjRWUGG9vykBTlGHdArZ8zoFtpUu2gs17K7qTl/TtPpiSi6t+MA== +"@babel/generator@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.5.0.tgz#f20e4b7a91750ee8b63656073d843d2a736dca4a" + integrity sha512-1TTVrt7J9rcG5PMjvO7VEG3FrEoEJNHxumRq66GemPmzboLWtIjjcJgk8rokuAS7IiRSpgVSu5Vb9lc99iJkOA== dependencies: - "@babel/types" "^7.1.5" + "@babel/types" "^7.5.0" jsesc "^2.5.1" - lodash "^4.17.10" - source-map "^0.5.0" - trim-right "^1.0.1" - -"@babel/generator@^7.2.2": - version "7.2.2" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.2.2.tgz#18c816c70962640eab42fe8cae5f3947a5c65ccc" - integrity sha512-I4o675J/iS8k+P38dvJ3IBGqObLXyQLTxtrR4u9cSUJOURvafeEWb/pFMOTwtNrmq73mJzyF6ueTbO1BtN0Zeg== - dependencies: - "@babel/types" "^7.2.2" - jsesc "^2.5.1" - lodash "^4.17.10" + lodash "^4.17.11" source-map "^0.5.0" trim-right "^1.0.1" @@ -81,31 +55,43 @@ "@babel/helper-explode-assignable-expression" "^7.1.0" "@babel/types" "^7.0.0" -"@babel/helper-builder-react-jsx@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/helper-builder-react-jsx/-/helper-builder-react-jsx-7.0.0.tgz#fa154cb53eb918cf2a9a7ce928e29eb649c5acdb" - integrity sha512-ebJ2JM6NAKW0fQEqN8hOLxK84RbRz9OkUhGS/Xd5u56ejMfVbayJ4+LykERZCOUM6faa6Fp3SZNX3fcT16MKHw== +"@babel/helper-builder-react-jsx@^7.3.0": + version "7.3.0" + resolved "https://registry.yarnpkg.com/@babel/helper-builder-react-jsx/-/helper-builder-react-jsx-7.3.0.tgz#a1ac95a5d2b3e88ae5e54846bf462eeb81b318a4" + integrity sha512-MjA9KgwCuPEkQd9ncSXvSyJ5y+j2sICHyrI0M3L+6fnS4wMSNDc1ARXsbTfbb2cXHn17VisSnU/sHFTCxVxSMw== dependencies: - "@babel/types" "^7.0.0" + "@babel/types" "^7.3.0" esutils "^2.0.0" -"@babel/helper-call-delegate@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/helper-call-delegate/-/helper-call-delegate-7.1.0.tgz#6a957f105f37755e8645343d3038a22e1449cc4a" - integrity sha512-YEtYZrw3GUK6emQHKthltKNZwszBcHK58Ygcis+gVUrF4/FmTVr5CCqQNSfmvg2y+YDEANyYoaLz/SHsnusCwQ== +"@babel/helper-call-delegate@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/helper-call-delegate/-/helper-call-delegate-7.4.4.tgz#87c1f8ca19ad552a736a7a27b1c1fcf8b1ff1f43" + integrity sha512-l79boDFJ8S1c5hvQvG+rc+wHw6IuH7YldmRKsYtpbawsxURu/paVy57FZMomGK22/JckepaikOkY0MoAmdyOlQ== dependencies: - "@babel/helper-hoist-variables" "^7.0.0" - "@babel/traverse" "^7.1.0" - "@babel/types" "^7.0.0" + "@babel/helper-hoist-variables" "^7.4.4" + "@babel/traverse" "^7.4.4" + "@babel/types" "^7.4.4" -"@babel/helper-define-map@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.1.0.tgz#3b74caec329b3c80c116290887c0dd9ae468c20c" - integrity sha512-yPPcW8dc3gZLN+U1mhYV91QU3n5uTbx7DUdf8NnPbjS0RMwBuHi9Xt2MUgppmNz7CJxTBWsGczTiEp1CSOTPRg== +"@babel/helper-create-class-features-plugin@^7.4.4", "@babel/helper-create-class-features-plugin@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.5.0.tgz#02edb97f512d44ba23b3227f1bf2ed43454edac5" + integrity sha512-EAoMc3hE5vE5LNhMqDOwB1usHvmRjCDAnH8CD4PVkX9/Yr3W/tcz8xE8QvdZxfsFBDICwZnF2UTHIqslRpvxmA== dependencies: "@babel/helper-function-name" "^7.1.0" - "@babel/types" "^7.0.0" - lodash "^4.17.10" + "@babel/helper-member-expression-to-functions" "^7.0.0" + "@babel/helper-optimise-call-expression" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-replace-supers" "^7.4.4" + "@babel/helper-split-export-declaration" "^7.4.4" + +"@babel/helper-define-map@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.4.4.tgz#6969d1f570b46bdc900d1eba8e5d59c48ba2c12a" + integrity sha512-IX3Ln8gLhZpSuqHJSnTNBWGDE9kdkTEWl21A/K7PQ00tseBwbqCHTvNLHSBd9M0R5rER4h5Rsvj9vw0R5SieBg== + dependencies: + "@babel/helper-function-name" "^7.1.0" + "@babel/types" "^7.4.4" + lodash "^4.17.11" "@babel/helper-explode-assignable-expression@^7.1.0": version "7.1.0" @@ -115,14 +101,6 @@ "@babel/traverse" "^7.1.0" "@babel/types" "^7.0.0" -"@babel/helper-function-name@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.44.tgz#e18552aaae2231100a6e485e03854bc3532d44dd" - dependencies: - "@babel/helper-get-function-arity" "7.0.0-beta.44" - "@babel/template" "7.0.0-beta.44" - "@babel/types" "7.0.0-beta.44" - "@babel/helper-function-name@^7.1.0": version "7.1.0" resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.1.0.tgz#a0ceb01685f73355d4360c1247f582bfafc8ff53" @@ -132,12 +110,6 @@ "@babel/template" "^7.1.0" "@babel/types" "^7.0.0" -"@babel/helper-get-function-arity@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.44.tgz#d03ca6dd2b9f7b0b1e6b32c56c72836140db3a15" - dependencies: - "@babel/types" "7.0.0-beta.44" - "@babel/helper-get-function-arity@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz#83572d4320e2a4657263734113c42868b64e49c3" @@ -145,12 +117,12 @@ dependencies: "@babel/types" "^7.0.0" -"@babel/helper-hoist-variables@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.0.0.tgz#46adc4c5e758645ae7a45deb92bab0918c23bb88" - integrity sha512-Ggv5sldXUeSKsuzLkddtyhyHe2YantsxWKNi7A+7LeD12ExRDWTRk29JCXpaHPAbMaIPZSil7n+lq78WY2VY7w== +"@babel/helper-hoist-variables@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.4.4.tgz#0298b5f25c8c09c53102d52ac4a98f773eb2850a" + integrity sha512-VYk2/H/BnYbZDDg39hr3t2kKyifAm1W6zHRfhx8jGjIHpQEBv9dry7oQ2f3+J703TLu69nYdxsovl0XYfcnK4w== dependencies: - "@babel/types" "^7.0.0" + "@babel/types" "^7.4.4" "@babel/helper-member-expression-to-functions@^7.0.0": version "7.0.0" @@ -166,17 +138,17 @@ dependencies: "@babel/types" "^7.0.0" -"@babel/helper-module-transforms@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.1.0.tgz#470d4f9676d9fad50b324cdcce5fbabbc3da5787" - integrity sha512-0JZRd2yhawo79Rcm4w0LwSMILFmFXjugG3yqf+P/UsKsRS1mJCmMwwlHDlMg7Avr9LrvSpp4ZSULO9r8jpCzcw== +"@babel/helper-module-transforms@^7.1.0", "@babel/helper-module-transforms@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.4.4.tgz#96115ea42a2f139e619e98ed46df6019b94414b8" + integrity sha512-3Z1yp8TVQf+B4ynN7WoHPKS8EkdTbgAEy0nU0rs/1Kw4pDgmvYH3rz3aI11KgxKCba2cn7N+tqzV1mY2HMN96w== dependencies: "@babel/helper-module-imports" "^7.0.0" "@babel/helper-simple-access" "^7.1.0" - "@babel/helper-split-export-declaration" "^7.0.0" - "@babel/template" "^7.1.0" - "@babel/types" "^7.0.0" - lodash "^4.17.10" + "@babel/helper-split-export-declaration" "^7.4.4" + "@babel/template" "^7.4.4" + "@babel/types" "^7.4.4" + lodash "^4.17.11" "@babel/helper-optimise-call-expression@^7.0.0": version "7.0.0" @@ -190,12 +162,12 @@ resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz#bbb3fbee98661c569034237cc03967ba99b4f250" integrity sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA== -"@babel/helper-regex@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/helper-regex/-/helper-regex-7.0.0.tgz#2c1718923b57f9bbe64705ffe5640ac64d9bdb27" - integrity sha512-TR0/N0NDCcUIUEbqV6dCO+LptmmSQFQ7q70lfcEB4URsjD0E1HzicrwUH+ap6BAQ2jhCX9Q4UqZy4wilujWlkg== +"@babel/helper-regex@^7.0.0", "@babel/helper-regex@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/helper-regex/-/helper-regex-7.4.4.tgz#a47e02bc91fb259d2e6727c2a30013e3ac13c4a2" + integrity sha512-Y5nuB/kESmR3tKjU8Nkn1wMGEx1tjJX076HBMeL3XLQCu6vA/YRzuTW0bbb+qRnXvQGn+d6Rx953yffl8vEy7Q== dependencies: - lodash "^4.17.10" + lodash "^4.17.11" "@babel/helper-remap-async-to-generator@^7.1.0": version "7.1.0" @@ -208,15 +180,15 @@ "@babel/traverse" "^7.1.0" "@babel/types" "^7.0.0" -"@babel/helper-replace-supers@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.1.0.tgz#5fc31de522ec0ef0899dc9b3e7cf6a5dd655f362" - integrity sha512-BvcDWYZRWVuDeXTYZWxekQNO5D4kO55aArwZOTFXw6rlLQA8ZaDicJR1sO47h+HrnCiDFiww0fSPV0d713KBGQ== +"@babel/helper-replace-supers@^7.1.0", "@babel/helper-replace-supers@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.4.4.tgz#aee41783ebe4f2d3ab3ae775e1cc6f1a90cefa27" + integrity sha512-04xGEnd+s01nY1l15EuMS1rfKktNF+1CkKmHoErDppjAAZL+IUBZpzT748x262HF7fibaQPhbvWUl5HeSt1EXg== dependencies: "@babel/helper-member-expression-to-functions" "^7.0.0" "@babel/helper-optimise-call-expression" "^7.0.0" - "@babel/traverse" "^7.1.0" - "@babel/types" "^7.0.0" + "@babel/traverse" "^7.4.4" + "@babel/types" "^7.4.4" "@babel/helper-simple-access@^7.1.0": version "7.1.0" @@ -226,565 +198,583 @@ "@babel/template" "^7.1.0" "@babel/types" "^7.0.0" -"@babel/helper-split-export-declaration@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.44.tgz#c0b351735e0fbcb3822c8ad8db4e583b05ebd9dc" +"@babel/helper-split-export-declaration@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.4.4.tgz#ff94894a340be78f53f06af038b205c49d993677" + integrity sha512-Ro/XkzLf3JFITkW6b+hNxzZ1n5OQ80NvIUdmHspih1XAhtN3vPTuUFT4eQnela+2MaZ5ulH+iyP513KJrxbN7Q== dependencies: - "@babel/types" "7.0.0-beta.44" - -"@babel/helper-split-export-declaration@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0.tgz#3aae285c0311c2ab095d997b8c9a94cad547d813" - integrity sha512-MXkOJqva62dfC0w85mEf/LucPPS/1+04nmmRMPEBUB++hiiThQ2zPtX/mEWQ3mtzCEjIJvPY8nuwxXtQeQwUag== - dependencies: - "@babel/types" "^7.0.0" + "@babel/types" "^7.4.4" "@babel/helper-wrap-function@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.1.0.tgz#8cf54e9190706067f016af8f75cb3df829cc8c66" - integrity sha512-R6HU3dete+rwsdAfrOzTlE9Mcpk4RjU3aX3gi9grtmugQY0u79X7eogUvfXA5sI81Mfq1cn6AgxihfN33STjJA== + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.2.0.tgz#c4e0012445769e2815b55296ead43a958549f6fa" + integrity sha512-o9fP1BZLLSrYlxYEYyl2aS+Flun5gtjTIG8iln+XuEzQTs0PLagAGSXUcqruJwD5fM48jzIEggCKpIfWTcR7pQ== dependencies: "@babel/helper-function-name" "^7.1.0" "@babel/template" "^7.1.0" "@babel/traverse" "^7.1.0" - "@babel/types" "^7.0.0" - -"@babel/helpers@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.2.0.tgz#8335f3140f3144270dc63c4732a4f8b0a50b7a21" - integrity sha512-Fr07N+ea0dMcMN8nFpuK6dUIT7/ivt9yKQdEEnjVS83tG2pHwPi03gYmk/tyuwONnZ+sY+GFFPlWGgCtW1hF9A== - dependencies: - "@babel/template" "^7.1.2" - "@babel/traverse" "^7.1.5" "@babel/types" "^7.2.0" -"@babel/highlight@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-beta.44.tgz#18c94ce543916a80553edcdcf681890b200747d5" +"@babel/helpers@^7.5.4": + version "7.5.4" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.5.4.tgz#2f00608aa10d460bde0ccf665d6dcf8477357cf0" + integrity sha512-6LJ6xwUEJP51w0sIgKyfvFMJvIb9mWAfohJp0+m6eHJigkFdcH8duZ1sfhn0ltJRzwUIT/yqqhdSfRpCpL7oow== dependencies: - chalk "^2.0.0" - esutils "^2.0.2" - js-tokens "^3.0.0" + "@babel/template" "^7.4.4" + "@babel/traverse" "^7.5.0" + "@babel/types" "^7.5.0" "@babel/highlight@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0.tgz#f710c38c8d458e6dd9a201afb637fcb781ce99e4" + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.5.0.tgz#56d11312bd9248fa619591d02472be6e8cb32540" + integrity sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ== dependencies: chalk "^2.0.0" esutils "^2.0.2" js-tokens "^4.0.0" -"@babel/parser@^7.1.2", "@babel/parser@^7.1.5": - version "7.1.5" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.1.5.tgz#20b7d5e7e1811ba996f8a868962ea7dd2bfcd2fc" - integrity sha512-WXKf5K5HT6X0kKiCOezJZFljsfxKV1FpU8Tf1A7ZpGvyd/Q4hlrJm2EwoH2onaUq3O4tLDp+4gk0hHPsMyxmOg== - -"@babel/parser@^7.2.2": - version "7.2.2" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.2.2.tgz#37ebdbc88a2e1ebc6c8dd3d35ea9436e3e39e477" - integrity sha512-UNTmQ5cSLDeBGBl+s7JeowkqIHgmFAGBnLDdIzFmUNSuS5JF0XBcN59jsh/vJO/YjfsBqMxhMjoFGmNExmf0FA== +"@babel/parser@^7.0.0", "@babel/parser@^7.4.4", "@babel/parser@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.5.0.tgz#3e0713dff89ad6ae37faec3b29dcfc5c979770b7" + integrity sha512-I5nW8AhGpOXGCCNYGc+p7ExQIBxRFnS2fd/d862bNOKvmoEPjYPcfIjsfdy0ujagYOIYPczKgD9l3FsgTkAzKA== -"@babel/plugin-proposal-async-generator-functions@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.1.0.tgz#41c1a702e10081456e23a7b74d891922dd1bb6ce" - integrity sha512-Fq803F3Jcxo20MXUSDdmZZXrPe6BWyGcWBPPNB/M7WaUYESKDeKMOGIxEzQOjGSmW/NWb6UaPZrtTB2ekhB/ew== +"@babel/plugin-proposal-async-generator-functions@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.2.0.tgz#b289b306669dce4ad20b0252889a15768c9d417e" + integrity sha512-+Dfo/SCQqrwx48ptLVGLdE39YtWRuKc/Y9I5Fy0P1DDBB9lsAHpjcEJQt+4IifuSOSTLBKJObJqMvaO1pIE8LQ== dependencies: "@babel/helper-plugin-utils" "^7.0.0" "@babel/helper-remap-async-to-generator" "^7.1.0" - "@babel/plugin-syntax-async-generators" "^7.0.0" + "@babel/plugin-syntax-async-generators" "^7.2.0" "@babel/plugin-proposal-class-properties@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.1.0.tgz#9af01856b1241db60ec8838d84691aa0bd1e8df4" - integrity sha512-/PCJWN+CKt5v1xcGn4vnuu13QDoV+P7NcICP44BoonAJoPSGwVkgrXihFIQGiEjjPlUDBIw1cM7wYFLARS2/hw== + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.5.0.tgz#5bc6a0537d286fcb4fd4e89975adbca334987007" + integrity sha512-9L/JfPCT+kShiiTTzcnBJ8cOwdKVmlC1RcCf9F0F9tERVrM4iWtWnXtjWCRqNm2la2BxO1MPArWNsU9zsSJWSQ== dependencies: - "@babel/helper-function-name" "^7.1.0" - "@babel/helper-member-expression-to-functions" "^7.0.0" - "@babel/helper-optimise-call-expression" "^7.0.0" + "@babel/helper-create-class-features-plugin" "^7.5.0" "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-replace-supers" "^7.1.0" - "@babel/plugin-syntax-class-properties" "^7.0.0" "@babel/plugin-proposal-decorators@^7.1.2": - version "7.1.2" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.1.2.tgz#79829bd75fced6581ec6c7ab1930e8d738e892e7" - integrity sha512-YooynBO6PmBgHvAd0fl5e5Tq/a0pEC6RqF62ouafme8FzdIVH41Mz/u1dn8fFVm4jzEJ+g/MsOxouwybJPuP8Q== + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.4.4.tgz#de9b2a1a8ab0196f378e2a82f10b6e2a36f21cc0" + integrity sha512-z7MpQz3XC/iQJWXH9y+MaWcLPNSMY9RQSthrLzak8R8hCj0fuyNk+Dzi9kfNe/JxxlWQ2g7wkABbgWjW36MTcw== dependencies: + "@babel/helper-create-class-features-plugin" "^7.4.4" "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-replace-supers" "^7.1.0" - "@babel/helper-split-export-declaration" "^7.0.0" - "@babel/plugin-syntax-decorators" "^7.1.0" + "@babel/plugin-syntax-decorators" "^7.2.0" -"@babel/plugin-proposal-json-strings@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.0.0.tgz#3b4d7b5cf51e1f2e70f52351d28d44fc2970d01e" - integrity sha512-kfVdUkIAGJIVmHmtS/40i/fg/AGnw/rsZBCaapY5yjeO5RA9m165Xbw9KMOu2nqXP5dTFjEjHdfNdoVcHv133Q== +"@babel/plugin-proposal-dynamic-import@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.5.0.tgz#e532202db4838723691b10a67b8ce509e397c506" + integrity sha512-x/iMjggsKTFHYC6g11PL7Qy58IK8H5zqfm9e6hu4z1iH2IRyAp9u9dL80zA6R76yFovETFLKz2VJIC2iIPBuFw== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-json-strings" "^7.0.0" + "@babel/plugin-syntax-dynamic-import" "^7.2.0" -"@babel/plugin-proposal-nullish-coalescing-operator@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.0.0.tgz#b72ec31adf612d062dc0348316246127a451e45f" - integrity sha512-QIN3UFo1ul4ruAsjIqK43PeXedo1qY74zeGrODJl1KfCGeMc6qJC4rb5Ylml/smzxibqsDeVZGH+TmWHCldRQQ== +"@babel/plugin-proposal-json-strings@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.2.0.tgz#568ecc446c6148ae6b267f02551130891e29f317" + integrity sha512-MAFV1CA/YVmYwZG0fBQyXhmj0BHCB5egZHCKWIFVv/XCxAeVGIHfos3SwDck4LvCllENIAg7xMKOG5kH0dzyUg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-nullish-coalescing-operator" "^7.0.0" + "@babel/plugin-syntax-json-strings" "^7.2.0" -"@babel/plugin-proposal-object-rest-spread@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.0.0.tgz#9a17b547f64d0676b6c9cecd4edf74a82ab85e7e" - integrity sha512-14fhfoPcNu7itSen7Py1iGN0gEm87hX/B+8nZPqkdmANyyYWYMY2pjA3r8WXbWVKMzfnSNS0xY8GVS0IjXi/iw== +"@babel/plugin-proposal-nullish-coalescing-operator@^7.0.0": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.4.4.tgz#41c360d59481d88e0ce3a3f837df10121a769b39" + integrity sha512-Amph7Epui1Dh/xxUxS2+K22/MUi6+6JVTvy3P58tja3B6yKTSjwwx0/d83rF7551D6PVSSoplQb8GCwqec7HRw== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-object-rest-spread" "^7.0.0" + "@babel/plugin-syntax-nullish-coalescing-operator" "^7.2.0" -"@babel/plugin-proposal-optional-catch-binding@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.0.0.tgz#b610d928fe551ff7117d42c8bb410eec312a6425" - integrity sha512-JPqAvLG1s13B/AuoBjdBYvn38RqW6n1TzrQO839/sIpqLpbnXKacsAgpZHzLD83Sm8SDXMkkrAvEnJ25+0yIpw== +"@babel/plugin-proposal-object-rest-spread@^7.5.4": + version "7.5.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.5.4.tgz#250de35d867ce8260a31b1fdac6c4fc1baa99331" + integrity sha512-KCx0z3y7y8ipZUMAEEJOyNi11lMb/FOPUjjB113tfowgw0c16EGYos7worCKBcUAh2oG+OBnoUhsnTSoLpV9uA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-optional-catch-binding" "^7.0.0" + "@babel/plugin-syntax-object-rest-spread" "^7.2.0" -"@babel/plugin-proposal-optional-chaining@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.0.0.tgz#3d344d4152253379b8758e7d041148e8787c4a9d" - integrity sha512-7x8HLa71OzNiofbQUVakS0Kmg++6a+cXNfS7QKHbbv03SuSaumJyaWsfNgw+T7aqrJlqurYpZqrkPgXu0iZK0w== +"@babel/plugin-proposal-optional-catch-binding@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.2.0.tgz#135d81edb68a081e55e56ec48541ece8065c38f5" + integrity sha512-mgYj3jCcxug6KUcX4OBoOJz3CMrwRfQELPQ5560F70YQUBZB7uac9fqaWamKR1iWUzGiK2t0ygzjTScZnVz75g== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-optional-chaining" "^7.0.0" + "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" -"@babel/plugin-proposal-pipeline-operator@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-pipeline-operator/-/plugin-proposal-pipeline-operator-7.0.0.tgz#ab60169a5c4a598292de59a14f9810d4e47b00b8" - integrity sha512-MN189PDyTMoor/YFh9dk6HpSZLMGHCXRdAhgmzshwcalbgYh5Mkn7Ib17lOo6fmLwHdyQ4GR4yagizfeR2LwQQ== +"@babel/plugin-proposal-optional-chaining@^7.0.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.2.0.tgz#ae454f4c21c6c2ce8cb2397dc332ae8b420c5441" + integrity sha512-ea3Q6edZC/55wEBVZAEz42v528VulyO0eir+7uky/sT4XRcdkWJcFi1aPtitTlwUzGnECWJNExWww1SStt+yWw== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-pipeline-operator" "^7.0.0" + "@babel/plugin-syntax-optional-chaining" "^7.2.0" -"@babel/plugin-proposal-unicode-property-regex@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.0.0.tgz#498b39cd72536cd7c4b26177d030226eba08cd33" - integrity sha512-tM3icA6GhC3ch2SkmSxv7J/hCWKISzwycub6eGsDrFDgukD4dZ/I+x81XgW0YslS6mzNuQ1Cbzh5osjIMgepPQ== +"@babel/plugin-proposal-pipeline-operator@^7.0.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-pipeline-operator/-/plugin-proposal-pipeline-operator-7.5.0.tgz#4100ec55ef4f6a4c2490b5f5a4f2a22dfa272c06" + integrity sha512-HFYuu/yGnkn69ligXxU0ohOVvQDsMNOUJs/c4PYLUVS6ntCYOyGmRQQaSYJARJ9rvc7/ulZKIzxd4wk91hN63A== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-regex" "^7.0.0" - regexpu-core "^4.2.0" + "@babel/plugin-syntax-pipeline-operator" "^7.5.0" -"@babel/plugin-syntax-async-generators@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.0.0.tgz#bf0891dcdbf59558359d0c626fdc9490e20bc13c" - integrity sha512-im7ged00ddGKAjcZgewXmp1vxSZQQywuQXe2B1A7kajjZmDeY/ekMPmWr9zJgveSaQH0k7BcGrojQhcK06l0zA== +"@babel/plugin-proposal-unicode-property-regex@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.4.4.tgz#501ffd9826c0b91da22690720722ac7cb1ca9c78" + integrity sha512-j1NwnOqMG9mFUOH58JTFsA/+ZYzQLUZ/drqWUqxCYLGeu2JFZL8YrNC9hBxKmWtAuOCHPcRpgv7fhap09Fb4kA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-regex" "^7.4.4" + regexpu-core "^4.5.4" -"@babel/plugin-syntax-class-properties@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.0.0.tgz#e051af5d300cbfbcec4a7476e37a803489881634" - integrity sha512-cR12g0Qzn4sgkjrbrzWy2GE7m9vMl/sFkqZ3gIpAQdrvPDnLM8180i+ANDFIXfjHo9aqp0ccJlQ0QNZcFUbf9w== +"@babel/plugin-syntax-async-generators@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.2.0.tgz#69e1f0db34c6f5a0cf7e2b3323bf159a76c8cb7f" + integrity sha512-1ZrIRBv2t0GSlcwVoQ6VgSLpLgiN/FVQUzt9znxo7v2Ov4jJrs8RY8tv0wvDmFN3qIdMKWrmMMW6yZ0G19MfGg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-decorators@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-decorators/-/plugin-syntax-decorators-7.1.0.tgz#2fa7c1a7905a299c9853ebcef340306675f9cbdc" - integrity sha512-uQvRSbgQ0nQg3jsmIixXXDCgSpkBolJ9X7NYThMKCcjvE8dN2uWJUzTUNNAeuKOjARTd+wUQV0ztXpgunZYKzQ== +"@babel/plugin-syntax-decorators@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-decorators/-/plugin-syntax-decorators-7.2.0.tgz#c50b1b957dcc69e4b1127b65e1c33eef61570c1b" + integrity sha512-38QdqVoXdHUQfTpZo3rQwqQdWtCn5tMv4uV6r2RMfTqNBuv4ZBhz79SfaQWKTVmxHjeFv/DnXVC/+agHCklYWA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-dynamic-import@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.0.0.tgz#6dfb7d8b6c3be14ce952962f658f3b7eb54c33ee" - integrity sha512-Gt9xNyRrCHCiyX/ZxDGOcBnlJl0I3IWicpZRC4CdC0P5a/I07Ya2OAMEBU+J7GmRFVmIetqEYRko6QYRuKOESw== +"@babel/plugin-syntax-dynamic-import@^7.0.0", "@babel/plugin-syntax-dynamic-import@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.2.0.tgz#69c159ffaf4998122161ad8ebc5e6d1f55df8612" + integrity sha512-mVxuJ0YroI/h/tbFTPGZR8cv6ai+STMKNBq0f8hFxsxWjl94qqhsb+wXbpNMDPU3cfR1TIsVFzU3nXyZMqyK4w== dependencies: "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-export-default-from@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-export-default-from/-/plugin-syntax-export-default-from-7.0.0.tgz#084b639bce3d42f3c5bf3f68ccb42220bb2d729d" - integrity sha512-HNnjg/fFFbnuLAqr/Ocp1Y3GB4AjmXcu1xxn3ql3bS2kGrB/qi+Povshb8i3hOkE5jNozzh8r/0/lq1w8oOWbQ== + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-export-default-from/-/plugin-syntax-export-default-from-7.2.0.tgz#edd83b7adc2e0d059e2467ca96c650ab6d2f3820" + integrity sha512-c7nqUnNST97BWPtoe+Ssi+fJukc9P9/JMZ71IOMNQWza2E+Psrd46N6AEvtw6pqK+gt7ChjXyrw4SPDO79f3Lw== dependencies: "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-export-namespace-from@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.0.0.tgz#17a7389a1d2571ac4d9b77ea2defa74a930edf5d" - integrity sha512-l314XT1eMa0MWboSmG4BdKukHfSpSpQRenUoZmEpL6hqc5nc1/ddpLETjPB77gZE1dZ9qxy5D3U3UUjjcX2d4g== + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.2.0.tgz#8d257838c6b3b779db52c0224443459bd27fb039" + integrity sha512-1zGA3UNch6A+A11nIzBVEaE3DDJbjfB+eLIcf0GGOh/BJr/8NxL3546MGhV/r0RhH4xADFIEso39TKCfEMlsGA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-flow@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.0.0.tgz#70638aeaad9ee426bc532e51523cff8ff02f6f17" - integrity sha512-zGcuZWiWWDa5qTZ6iAnpG0fnX/GOu49pGR5PFvkQ9GmKNaSphXQnlNXh/LG20sqWtNrx/eB6krzfEzcwvUyeFA== +"@babel/plugin-syntax-flow@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.2.0.tgz#a765f061f803bc48f240c26f8747faf97c26bf7c" + integrity sha512-r6YMuZDWLtLlu0kqIim5o/3TNRAlWb073HwT3e2nKf9I8IIvOggPrnILYPsrrKilmn/mYEMCf/Z07w3yQJF6dg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-import-meta@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.0.0.tgz#ca946b73216c29c39a55ef2d739097fee8a85d69" - integrity sha512-FEoGvhXVAiWzpDjyZIlBGzKyNk/lnRPy7aPke3PjVkiAY0QFsvFfkjUg5diRwVfowBA8SJqvFt0ZoXNSjl70hQ== + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.2.0.tgz#2333ef4b875553a3bcd1e93f8ebc09f5b9213a40" + integrity sha512-Hq6kFSZD7+PHkmBN8bCpHR6J8QEoCuEV/B38AIQscYjgMZkGlXB7cHNFzP5jR4RCh5545yP1ujHdmO7hAgKtBA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-json-strings@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.0.0.tgz#0d259a68090e15b383ce3710e01d5b23f3770cbd" - integrity sha512-UlSfNydC+XLj4bw7ijpldc1uZ/HB84vw+U6BTuqMdIEmz/LDe63w/GHtpQMdXWdqQZFeAI9PjnHe/vDhwirhKA== +"@babel/plugin-syntax-json-strings@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.2.0.tgz#72bd13f6ffe1d25938129d2a186b11fd62951470" + integrity sha512-5UGYnMSLRE1dqqZwug+1LISpA403HzlSfsg6P9VXU6TBjcSHeNlw4DxDx7LgpF+iKZoOG/+uzqoRHTdcUpiZNg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-jsx@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.0.0.tgz#034d5e2b4e14ccaea2e4c137af7e4afb39375ffd" - integrity sha512-PdmL2AoPsCLWxhIr3kG2+F9v4WH06Q3z+NoGVpQgnUNGcagXHq5sB3OXxkSahKq9TLdNMN/AJzFYSOo8UKDMHg== +"@babel/plugin-syntax-jsx@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.2.0.tgz#0b85a3b4bc7cdf4cc4b8bf236335b907ca22e7c7" + integrity sha512-VyN4QANJkRW6lDBmENzRszvZf3/4AXaj9YR7GwrWeeN9tEBPuXbmDYVU9bYBN0D70zCWVwUy0HWq2553VCb6Hw== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-nullish-coalescing-operator@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.0.0.tgz#b60931d5a15da82625fff6657c39419969598743" - integrity sha512-oAJmMsAvTSIk9y0sZdU2S/nY44PEUuHN7EzNDMgbuR4e/OwyfR9lSmoBJBZ2lslFZIqhksrTt4i+av7uKfNYDw== +"@babel/plugin-syntax-nullish-coalescing-operator@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.2.0.tgz#f75083dfd5ade73e783db729bbd87e7b9efb7624" + integrity sha512-lRCEaKE+LTxDQtgbYajI04ddt6WW0WJq57xqkAZ+s11h4YgfRHhVA/Y2VhfPzzFD4qeLHWg32DMp9HooY4Kqlg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-numeric-separator@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.0.0.tgz#9594c7ce6ce8089a14d732cb9f6b1eeb047413ba" - integrity sha512-t9RMUPWsFXVeUZxEOhIDkVqYLi1sWOTjxFBAp8wJtaARilvkGlEQvSObd2W5YKicDktINI9XmdV0sB2FZaLOpw== + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.2.0.tgz#7470fe070c2944469a756752a69a6963135018be" + integrity sha512-DroeVNkO/BnGpL2R7+ZNZqW+E24aR/4YWxP3Qb15d6lPU8KDzF8HlIUIRCOJRn4X77/oyW4mJY+7FHfY82NLtQ== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-object-rest-spread@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.0.0.tgz#37d8fbcaf216bd658ea1aebbeb8b75e88ebc549b" - integrity sha512-5A0n4p6bIiVe5OvQPxBnesezsgFJdHhSs3uFSvaPdMqtsovajLZ+G2vZyvNe10EzJBWWo3AcHGKhAFUxqwp2dw== +"@babel/plugin-syntax-object-rest-spread@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.2.0.tgz#3b7a3e733510c57e820b9142a6579ac8b0dfad2e" + integrity sha512-t0JKGgqk2We+9may3t0xDdmneaXmyxq0xieYcKHxIsrJO64n1OiMWNUtc5gQK1PA0NpdCRrtZp4z+IUaKugrSA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-optional-catch-binding@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.0.0.tgz#886f72008b3a8b185977f7cb70713b45e51ee475" - integrity sha512-Wc+HVvwjcq5qBg1w5RG9o9RVzmCaAg/Vp0erHCKpAYV8La6I94o4GQAmFYNmkzoMO6gzoOSulpKeSSz6mPEoZw== +"@babel/plugin-syntax-optional-catch-binding@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.2.0.tgz#a94013d6eda8908dfe6a477e7f9eda85656ecf5c" + integrity sha512-bDe4xKNhb0LI7IvZHiA13kff0KEfaGX/Hv4lMA9+7TEc63hMNvfKo6ZFpXhKuEp+II/q35Gc4NoMeDZyaUbj9w== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-optional-chaining@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.0.0.tgz#1e6ecba124310b5d3a8fc1e00d50b1c4c2e05e68" - integrity sha512-QXedQsZf8yua1nNrXSePT0TsGSQH9A1iK08m9dhCMdZeJaaxYcQfXdgHWVV6Cp7WE/afPVvSKIsAHK5wP+yxDA== +"@babel/plugin-syntax-optional-chaining@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.2.0.tgz#a59d6ae8c167e7608eaa443fda9fa8fa6bf21dff" + integrity sha512-HtGCtvp5Uq/jH/WNUPkK6b7rufnCPLLlDAFN7cmACoIjaOOiXxUt3SswU5loHqrhtqTsa/WoLQ1OQ1AGuZqaWA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-pipeline-operator@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-pipeline-operator/-/plugin-syntax-pipeline-operator-7.0.0.tgz#29106ddb293898192780ff48159c77e6f20c1768" - integrity sha512-McK1JV4klGq2r0UZ1SLE2u+u37ElArBcPMGl6JizdgEXD3ttp0dpOB5ZpqpeRHkIgnl46th64UHrFDteQ4P5aw== +"@babel/plugin-syntax-pipeline-operator@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-pipeline-operator/-/plugin-syntax-pipeline-operator-7.5.0.tgz#8ea7c2c22847c797748bf07752722a317079dc1e" + integrity sha512-5FVxPiMTMXWk4R7Kq9pt272nDu8VImJdaIzvXFSTcXFbgKWWaOdbic12TvUvl6cK+AE5EgnhwvxuWik4ZYYdzg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-arrow-functions@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.0.0.tgz#a6c14875848c68a3b4b3163a486535ef25c7e749" - integrity sha512-2EZDBl1WIO/q4DIkIp4s86sdp4ZifL51MoIviLY/gG/mLSuOIEg7J8o6mhbxOTvUJkaN50n+8u41FVsr5KLy/w== +"@babel/plugin-transform-arrow-functions@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.2.0.tgz#9aeafbe4d6ffc6563bf8f8372091628f00779550" + integrity sha512-ER77Cax1+8/8jCB9fo4Ud161OZzWN5qawi4GusDuRLcDbDG+bIGYY20zb2dfAFdTRGzrfq2xZPvF0R64EHnimg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-async-to-generator@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.1.0.tgz#109e036496c51dd65857e16acab3bafdf3c57811" - integrity sha512-rNmcmoQ78IrvNCIt/R9U+cixUHeYAzgusTFgIAv+wQb9HJU4szhpDD6e5GCACmj/JP5KxuCwM96bX3L9v4ZN/g== +"@babel/plugin-transform-async-to-generator@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.5.0.tgz#89a3848a0166623b5bc481164b5936ab947e887e" + integrity sha512-mqvkzwIGkq0bEF1zLRRiTdjfomZJDV33AH3oQzHVGkI2VzEmXLpKKOBvEVaFZBJdN0XTyH38s9j/Kiqr68dggg== dependencies: "@babel/helper-module-imports" "^7.0.0" "@babel/helper-plugin-utils" "^7.0.0" "@babel/helper-remap-async-to-generator" "^7.1.0" -"@babel/plugin-transform-block-scoped-functions@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.0.0.tgz#482b3f75103927e37288b3b67b65f848e2aa0d07" - integrity sha512-AOBiyUp7vYTqz2Jibe1UaAWL0Hl9JUXEgjFvvvcSc9MVDItv46ViXFw2F7SVt1B5k+KWjl44eeXOAk3UDEaJjQ== +"@babel/plugin-transform-block-scoped-functions@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.2.0.tgz#5d3cc11e8d5ddd752aa64c9148d0db6cb79fd190" + integrity sha512-ntQPR6q1/NKuphly49+QiQiTN0O63uOwjdD6dhIjSWBI5xlrbUFh720TIpzBhpnrLfv2tNH/BXvLIab1+BAI0w== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-block-scoping@^7.1.5": - version "7.1.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.1.5.tgz#3e8e0bc9a5104519923302a24f748f72f2f61f37" - integrity sha512-jlYcDrz+5ayWC7mxgpn1Wj8zj0mmjCT2w0mPIMSwO926eXBRxpEgoN/uQVRBfjtr8ayjcmS+xk2G1jaP8JjMJQ== +"@babel/plugin-transform-block-scoping@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.4.4.tgz#c13279fabf6b916661531841a23c4b7dae29646d" + integrity sha512-jkTUyWZcTrwxu5DD4rWz6rDB5Cjdmgz6z7M7RLXOJyCUkFBawssDGcGh8M/0FTSB87avyJI1HsTwUXp9nKA1PA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - lodash "^4.17.10" + lodash "^4.17.11" -"@babel/plugin-transform-classes@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.1.0.tgz#ab3f8a564361800cbc8ab1ca6f21108038432249" - integrity sha512-rNaqoD+4OCBZjM7VaskladgqnZ1LO6o2UxuWSDzljzW21pN1KXkB7BstAVweZdxQkHAujps5QMNOTWesBciKFg== +"@babel/plugin-transform-classes@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.4.4.tgz#0ce4094cdafd709721076d3b9c38ad31ca715eb6" + integrity sha512-/e44eFLImEGIpL9qPxSRat13I5QNRgBLu2hOQJCF7VLy/otSM/sypV1+XaIw5+502RX/+6YaSAPmldk+nhHDPw== dependencies: "@babel/helper-annotate-as-pure" "^7.0.0" - "@babel/helper-define-map" "^7.1.0" + "@babel/helper-define-map" "^7.4.4" "@babel/helper-function-name" "^7.1.0" "@babel/helper-optimise-call-expression" "^7.0.0" "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-replace-supers" "^7.1.0" - "@babel/helper-split-export-declaration" "^7.0.0" + "@babel/helper-replace-supers" "^7.4.4" + "@babel/helper-split-export-declaration" "^7.4.4" globals "^11.1.0" -"@babel/plugin-transform-computed-properties@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.0.0.tgz#2fbb8900cd3e8258f2a2ede909b90e7556185e31" - integrity sha512-ubouZdChNAv4AAWAgU7QKbB93NU5sHwInEWfp+/OzJKA02E6Woh9RVoX4sZrbRwtybky/d7baTUqwFx+HgbvMA== +"@babel/plugin-transform-computed-properties@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.2.0.tgz#83a7df6a658865b1c8f641d510c6f3af220216da" + integrity sha512-kP/drqTxY6Xt3NNpKiMomfgkNn4o7+vKxK2DDKcBG9sHj51vHqMBGy8wbDS/J4lMxnqs153/T3+DmCEAkC5cpA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-destructuring@^7.0.0": - version "7.1.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.1.3.tgz#e69ff50ca01fac6cb72863c544e516c2b193012f" - integrity sha512-Mb9M4DGIOspH1ExHOUnn2UUXFOyVTiX84fXCd+6B5iWrQg/QMeeRmSwpZ9lnjYLSXtZwiw80ytVMr3zue0ucYw== +"@babel/plugin-transform-destructuring@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.5.0.tgz#f6c09fdfe3f94516ff074fe877db7bc9ef05855a" + integrity sha512-YbYgbd3TryYYLGyC7ZR+Tq8H/+bCmwoaxHfJHupom5ECstzbRLTch6gOQbhEY9Z4hiCNHEURgq06ykFv9JZ/QQ== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-dotall-regex@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.0.0.tgz#73a24da69bc3c370251f43a3d048198546115e58" - integrity sha512-00THs8eJxOJUFVx1w8i1MBF4XH4PsAjKjQ1eqN/uCH3YKwP21GCKfrn6YZFZswbOk9+0cw1zGQPHVc1KBlSxig== +"@babel/plugin-transform-dotall-regex@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.4.4.tgz#361a148bc951444312c69446d76ed1ea8e4450c3" + integrity sha512-P05YEhRc2h53lZDjRPk/OektxCVevFzZs2Gfjd545Wde3k+yFDbXORgl2e0xpbq8mLcKJ7Idss4fAg0zORN/zg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-regex" "^7.0.0" - regexpu-core "^4.1.3" + "@babel/helper-regex" "^7.4.4" + regexpu-core "^4.5.4" -"@babel/plugin-transform-duplicate-keys@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.0.0.tgz#a0601e580991e7cace080e4cf919cfd58da74e86" - integrity sha512-w2vfPkMqRkdxx+C71ATLJG30PpwtTpW7DDdLqYt2acXU7YjztzeWW2Jk1T6hKqCLYCcEA5UQM/+xTAm+QCSnuQ== +"@babel/plugin-transform-duplicate-keys@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.5.0.tgz#c5dbf5106bf84cdf691222c0974c12b1df931853" + integrity sha512-igcziksHizyQPlX9gfSjHkE2wmoCH3evvD2qR5w29/Dk0SMKE/eOI7f1HhBdNhR/zxJDqrgpoDTq5YSLH/XMsQ== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-exponentiation-operator@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.1.0.tgz#9c34c2ee7fd77e02779cfa37e403a2e1003ccc73" - integrity sha512-uZt9kD1Pp/JubkukOGQml9tqAeI8NkE98oZnHZ2qHRElmeKCodbTZgOEUtujSCSLhHSBWbzNiFSDIMC4/RBTLQ== +"@babel/plugin-transform-exponentiation-operator@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.2.0.tgz#a63868289e5b4007f7054d46491af51435766008" + integrity sha512-umh4hR6N7mu4Elq9GG8TOu9M0bakvlsREEC+ialrQN6ABS4oDQ69qJv1VtR3uxlKMCQMCvzk7vr17RHKcjx68A== dependencies: "@babel/helper-builder-binary-assignment-operator-visitor" "^7.1.0" "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-transform-flow-strip-types@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.0.0.tgz#c40ced34c2783985d90d9f9ac77a13e6fb396a01" - integrity sha512-WhXUNb4It5a19RsgKKbQPrjmy4yWOY1KynpEbNw7bnd1QTcrT/EIl3MJvnGgpgvrKyKbqX7nUNOJfkpLOnoDKA== + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.4.4.tgz#d267a081f49a8705fc9146de0768c6b58dccd8f7" + integrity sha512-WyVedfeEIILYEaWGAUWzVNyqG4sfsNooMhXWsu/YzOvVGcsnPb5PguysjJqI3t3qiaYj0BR8T2f5njdjTGe44Q== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-flow" "^7.0.0" + "@babel/plugin-syntax-flow" "^7.2.0" -"@babel/plugin-transform-for-of@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.0.0.tgz#f2ba4eadb83bd17dc3c7e9b30f4707365e1c3e39" - integrity sha512-TlxKecN20X2tt2UEr2LNE6aqA0oPeMT1Y3cgz8k4Dn1j5ObT8M3nl9aA37LLklx0PBZKETC9ZAf9n/6SujTuXA== +"@babel/plugin-transform-for-of@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.4.4.tgz#0267fc735e24c808ba173866c6c4d1440fc3c556" + integrity sha512-9T/5Dlr14Z9TIEXLXkt8T1DU7F24cbhwhMNUziN3hB1AXoZcdzPcTiKGRn/6iOymDqtTKWnr/BtRKN9JwbKtdQ== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-function-name@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.1.0.tgz#29c5550d5c46208e7f730516d41eeddd4affadbb" - integrity sha512-VxOa1TMlFMtqPW2IDYZQaHsFrq/dDoIjgN098NowhexhZcz3UGlvPgZXuE1jEvNygyWyxRacqDpCZt+par1FNg== +"@babel/plugin-transform-function-name@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.4.4.tgz#e1436116abb0610c2259094848754ac5230922ad" + integrity sha512-iU9pv7U+2jC9ANQkKeNF6DrPy4GBa4NWQtl6dHB4Pb3izX2JOEvDTFarlNsBj/63ZEzNNIAMs3Qw4fNCcSOXJA== dependencies: "@babel/helper-function-name" "^7.1.0" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-literals@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.0.0.tgz#2aec1d29cdd24c407359c930cdd89e914ee8ff86" - integrity sha512-1NTDBWkeNXgpUcyoVFxbr9hS57EpZYXpje92zv0SUzjdu3enaRwF/l3cmyRnXLtIdyJASyiS6PtybK+CgKf7jA== +"@babel/plugin-transform-literals@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.2.0.tgz#690353e81f9267dad4fd8cfd77eafa86aba53ea1" + integrity sha512-2ThDhm4lI4oV7fVQ6pNNK+sx+c/GM5/SaML0w/r4ZB7sAneD/piDJtwdKlNckXeyGK7wlwg2E2w33C/Hh+VFCg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-modules-amd@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.1.0.tgz#f9e0a7072c12e296079b5a59f408ff5b97bf86a8" - integrity sha512-wt8P+xQ85rrnGNr2x1iV3DW32W8zrB6ctuBkYBbf5/ZzJY99Ob4MFgsZDFgczNU76iy9PWsy4EuxOliDjdKw6A== +"@babel/plugin-transform-member-expression-literals@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.2.0.tgz#fa10aa5c58a2cb6afcf2c9ffa8cb4d8b3d489a2d" + integrity sha512-HiU3zKkSU6scTidmnFJ0bMX8hz5ixC93b4MHMiYebmk2lUVNGOboPsqQvx5LzooihijUoLR/v7Nc1rbBtnc7FA== dependencies: - "@babel/helper-module-transforms" "^7.1.0" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-modules-commonjs@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.1.0.tgz#0a9d86451cbbfb29bd15186306897c67f6f9a05c" - integrity sha512-wtNwtMjn1XGwM0AXPspQgvmE6msSJP15CX2RVfpTSTNPLhKhaOjaIfBaVfj4iUZ/VrFSodcFedwtPg/NxwQlPA== +"@babel/plugin-transform-modules-amd@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.5.0.tgz#ef00435d46da0a5961aa728a1d2ecff063e4fb91" + integrity sha512-n20UsQMKnWrltocZZm24cRURxQnWIvsABPJlw/fvoy9c6AgHZzoelAIzajDHAQrDpuKFFPPcFGd7ChsYuIUMpg== dependencies: "@babel/helper-module-transforms" "^7.1.0" "@babel/helper-plugin-utils" "^7.0.0" + babel-plugin-dynamic-import-node "^2.3.0" + +"@babel/plugin-transform-modules-commonjs@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.5.0.tgz#425127e6045231360858eeaa47a71d75eded7a74" + integrity sha512-xmHq0B+ytyrWJvQTc5OWAC4ii6Dhr0s22STOoydokG51JjWhyYo5mRPXoi+ZmtHQhZZwuXNN+GG5jy5UZZJxIQ== + dependencies: + "@babel/helper-module-transforms" "^7.4.4" + "@babel/helper-plugin-utils" "^7.0.0" "@babel/helper-simple-access" "^7.1.0" + babel-plugin-dynamic-import-node "^2.3.0" -"@babel/plugin-transform-modules-systemjs@^7.0.0": - version "7.1.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.1.3.tgz#2119a3e3db612fd74a19d88652efbfe9613a5db0" - integrity sha512-PvTxgjxQAq4pvVUZF3mD5gEtVDuId8NtWkJsZLEJZMZAW3TvgQl1pmydLLN1bM8huHFVVU43lf0uvjQj9FRkKw== +"@babel/plugin-transform-modules-systemjs@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.5.0.tgz#e75266a13ef94202db2a0620977756f51d52d249" + integrity sha512-Q2m56tyoQWmuNGxEtUyeEkm6qJYFqs4c+XyXH5RAuYxObRNz9Zgj/1g2GMnjYp2EUyEy7YTrxliGCXzecl/vJg== dependencies: - "@babel/helper-hoist-variables" "^7.0.0" + "@babel/helper-hoist-variables" "^7.4.4" "@babel/helper-plugin-utils" "^7.0.0" + babel-plugin-dynamic-import-node "^2.3.0" -"@babel/plugin-transform-modules-umd@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.1.0.tgz#a29a7d85d6f28c3561c33964442257cc6a21f2a8" - integrity sha512-enrRtn5TfRhMmbRwm7F8qOj0qEYByqUvTttPEGimcBH4CJHphjyK1Vg7sdU7JjeEmgSpM890IT/efS2nMHwYig== +"@babel/plugin-transform-modules-umd@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.2.0.tgz#7678ce75169f0877b8eb2235538c074268dd01ae" + integrity sha512-BV3bw6MyUH1iIsGhXlOK6sXhmSarZjtJ/vMiD9dNmpY8QXFFQTj+6v92pcfy1iqa8DeAfJFwoxcrS/TUZda6sw== dependencies: "@babel/helper-module-transforms" "^7.1.0" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-new-target@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.0.0.tgz#ae8fbd89517fa7892d20e6564e641e8770c3aa4a" - integrity sha512-yin069FYjah+LbqfGeTfzIBODex/e++Yfa0rH0fpfam9uTbuEeEOx5GLGr210ggOV77mVRNoeqSYqeuaqSzVSw== +"@babel/plugin-transform-named-capturing-groups-regex@^7.4.5": + version "7.4.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.4.5.tgz#9d269fd28a370258199b4294736813a60bbdd106" + integrity sha512-z7+2IsWafTBbjNsOxU/Iv5CvTJlr5w4+HGu1HovKYTtgJ362f7kBcQglkfmlspKKZ3bgrbSGvLfNx++ZJgCWsg== + dependencies: + regexp-tree "^0.1.6" + +"@babel/plugin-transform-new-target@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.4.4.tgz#18d120438b0cc9ee95a47f2c72bc9768fbed60a5" + integrity sha512-r1z3T2DNGQwwe2vPGZMBNjioT2scgWzK9BCnDEh+46z8EEwXBq24uRzd65I7pjtugzPSj921aM15RpESgzsSuA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-object-super@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.1.0.tgz#b1ae194a054b826d8d4ba7ca91486d4ada0f91bb" - integrity sha512-/O02Je1CRTSk2SSJaq0xjwQ8hG4zhZGNjE8psTsSNPXyLRCODv7/PBozqT5AmQMzp7MI3ndvMhGdqp9c96tTEw== +"@babel/plugin-transform-object-super@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.2.0.tgz#b35d4c10f56bab5d650047dad0f1d8e8814b6598" + integrity sha512-VMyhPYZISFZAqAPVkiYb7dUe2AsVi2/wCT5+wZdsNO31FojQJa9ns40hzZ6U9f50Jlq4w6qwzdBB2uwqZ00ebg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" "@babel/helper-replace-supers" "^7.1.0" -"@babel/plugin-transform-parameters@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.1.0.tgz#44f492f9d618c9124026e62301c296bf606a7aed" - integrity sha512-vHV7oxkEJ8IHxTfRr3hNGzV446GAb+0hgbA7o/0Jd76s+YzccdWuTU296FOCOl/xweU4t/Ya4g41yWz80RFCRw== +"@babel/plugin-transform-parameters@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.4.4.tgz#7556cf03f318bd2719fe4c922d2d808be5571e16" + integrity sha512-oMh5DUO1V63nZcu/ZVLQFqiihBGo4OpxJxR1otF50GMeCLiRx5nUdtokd+u9SuVJrvvuIh9OosRFPP4pIPnwmw== dependencies: - "@babel/helper-call-delegate" "^7.1.0" + "@babel/helper-call-delegate" "^7.4.4" "@babel/helper-get-function-arity" "^7.0.0" "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-transform-property-literals@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.2.0.tgz#03e33f653f5b25c4eb572c98b9485055b389e905" + integrity sha512-9q7Dbk4RhgcLp8ebduOpCbtjh7C0itoLYHXd9ueASKAG/is5PQtMR5VJGka9NKqGhYEGn5ITahd4h9QeBMylWQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-react-display-name@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.0.0.tgz#93759e6c023782e52c2da3b75eca60d4f10533ee" - integrity sha512-BX8xKuQTO0HzINxT6j/GiCwoJB0AOMs0HmLbEnAvcte8U8rSkNa/eSCAY+l1OA4JnCVq2jw2p6U8QQryy2fTPg== + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.2.0.tgz#ebfaed87834ce8dc4279609a4f0c324c156e3eb0" + integrity sha512-Htf/tPa5haZvRMiNSQSFifK12gtr/8vwfr+A9y69uF0QcU77AVu4K7MiHEkTxF7lQoHOL0F9ErqgfNEAKgXj7A== dependencies: "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-transform-react-jsx-self@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.0.0.tgz#a84bb70fea302d915ea81d9809e628266bb0bc11" - integrity sha512-pymy+AK12WO4safW1HmBpwagUQRl9cevNX+82AIAtU1pIdugqcH+nuYP03Ja6B+N4gliAaKWAegIBL/ymALPHA== + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.2.0.tgz#461e21ad9478f1031dd5e276108d027f1b5240ba" + integrity sha512-v6S5L/myicZEy+jr6ielB0OR8h+EH/1QFx/YJ7c7Ua+7lqsjj/vW6fD5FR9hB/6y7mGbfT4vAURn3xqBxsUcdg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-jsx" "^7.0.0" + "@babel/plugin-syntax-jsx" "^7.2.0" "@babel/plugin-transform-react-jsx-source@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.0.0.tgz#28e00584f9598c0dd279f6280eee213fa0121c3c" - integrity sha512-OSeEpFJEH5dw/TtxTg4nijl4nHBbhqbKL94Xo/Y17WKIf2qJWeIk/QeXACF19lG1vMezkxqruwnTjVizaW7u7w== + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.5.0.tgz#583b10c49cf057e237085bcbd8cc960bd83bd96b" + integrity sha512-58Q+Jsy4IDCZx7kqEZuSDdam/1oW8OdDX8f+Loo6xyxdfg1yF0GE2XNJQSTZCaMol93+FBzpWiPEwtbMloAcPg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-jsx" "^7.0.0" + "@babel/plugin-syntax-jsx" "^7.2.0" "@babel/plugin-transform-react-jsx@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.0.0.tgz#524379e4eca5363cd10c4446ba163f093da75f3e" - integrity sha512-0TMP21hXsSUjIQJmu/r7RiVxeFrXRcMUigbKu0BLegJK9PkYodHstaszcig7zxXfaBji2LYUdtqIkHs+hgYkJQ== + version "7.3.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.3.0.tgz#f2cab99026631c767e2745a5368b331cfe8f5290" + integrity sha512-a/+aRb7R06WcKvQLOu4/TpjKOdvVEKRLWFpKcNuHhiREPgGRB4TQJxq07+EZLS8LFVYpfq1a5lDUnuMdcCpBKg== dependencies: - "@babel/helper-builder-react-jsx" "^7.0.0" + "@babel/helper-builder-react-jsx" "^7.3.0" "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-jsx" "^7.0.0" + "@babel/plugin-syntax-jsx" "^7.2.0" -"@babel/plugin-transform-regenerator@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.0.0.tgz#5b41686b4ed40bef874d7ed6a84bdd849c13e0c1" - integrity sha512-sj2qzsEx8KDVv1QuJc/dEfilkg3RRPvPYx/VnKLtItVQRWt1Wqf5eVCOLZm29CiGFfYYsA3VPjfizTCV0S0Dlw== +"@babel/plugin-transform-regenerator@^7.4.5": + version "7.4.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.4.5.tgz#629dc82512c55cee01341fb27bdfcb210354680f" + integrity sha512-gBKRh5qAaCWntnd09S8QC7r3auLCqq5DI6O0DlfoyDjslSBVqBibrMdsqO+Uhmx3+BlOmE/Kw1HFxmGbv0N9dA== dependencies: - regenerator-transform "^0.13.3" + regenerator-transform "^0.14.0" -"@babel/plugin-transform-shorthand-properties@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.0.0.tgz#85f8af592dcc07647541a0350e8c95c7bf419d15" - integrity sha512-g/99LI4vm5iOf5r1Gdxq5Xmu91zvjhEG5+yZDJW268AZELAu4J1EiFLnkSG3yuUsZyOipVOVUKoGPYwfsTymhw== +"@babel/plugin-transform-reserved-words@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.2.0.tgz#4792af87c998a49367597d07fedf02636d2e1634" + integrity sha512-fz43fqW8E1tAB3DKF19/vxbpib1fuyCwSPE418ge5ZxILnBhWyhtPgz8eh1RCGGJlwvksHkyxMxh0eenFi+kFw== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-spread@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.0.0.tgz#93583ce48dd8c85e53f3a46056c856e4af30b49b" - integrity sha512-L702YFy2EvirrR4shTj0g2xQp7aNwZoWNCkNu2mcoU0uyzMl0XRwDSwzB/xp6DSUFiBmEXuyAyEN16LsgVqGGQ== +"@babel/plugin-transform-shorthand-properties@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.2.0.tgz#6333aee2f8d6ee7e28615457298934a3b46198f0" + integrity sha512-QP4eUM83ha9zmYtpbnyjTLAGKQritA5XW/iG9cjtuOI8s1RuL/3V6a3DeSHfKutJQ+ayUfeZJPcnCYEQzaPQqg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-sticky-regex@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.0.0.tgz#30a9d64ac2ab46eec087b8530535becd90e73366" - integrity sha512-LFUToxiyS/WD+XEWpkx/XJBrUXKewSZpzX68s+yEOtIbdnsRjpryDw9U06gYc6klYEij/+KQVRnD3nz3AoKmjw== +"@babel/plugin-transform-spread@^7.2.0": + version "7.2.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.2.2.tgz#3103a9abe22f742b6d406ecd3cd49b774919b406" + integrity sha512-KWfky/58vubwtS0hLqEnrWJjsMGaOeSBn90Ezn5Jeg9Z8KKHmELbP1yGylMlm5N6TPKeY9A2+UaSYLdxahg01w== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-sticky-regex@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.2.0.tgz#a1e454b5995560a9c1e0d537dfc15061fd2687e1" + integrity sha512-KKYCoGaRAf+ckH8gEL3JHUaFVyNHKe3ASNsZ+AlktgHevvxGigoIttrEJb8iKN03Q7Eazlv1s6cx2B2cQ3Jabw== dependencies: "@babel/helper-plugin-utils" "^7.0.0" "@babel/helper-regex" "^7.0.0" -"@babel/plugin-transform-template-literals@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.0.0.tgz#084f1952efe5b153ddae69eb8945f882c7a97c65" - integrity sha512-vA6rkTCabRZu7Nbl9DfLZE1imj4tzdWcg5vtdQGvj+OH9itNNB6hxuRMHuIY8SGnEt1T9g5foqs9LnrHzsqEFg== +"@babel/plugin-transform-template-literals@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.4.4.tgz#9d28fea7bbce637fb7612a0750989d8321d4bcb0" + integrity sha512-mQrEC4TWkhLN0z8ygIvEL9ZEToPhG5K7KDW3pzGqOfIGZ28Jb0POUkeWcoz8HnHvhFy6dwAT1j8OzqN8s804+g== dependencies: "@babel/helper-annotate-as-pure" "^7.0.0" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-typeof-symbol@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.0.0.tgz#4dcf1e52e943e5267b7313bff347fdbe0f81cec9" - integrity sha512-1r1X5DO78WnaAIvs5uC48t41LLckxsYklJrZjNKcevyz83sF2l4RHbw29qrCPr/6ksFsdfRpT/ZgxNWHXRnffg== +"@babel/plugin-transform-typeof-symbol@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.2.0.tgz#117d2bcec2fbf64b4b59d1f9819894682d29f2b2" + integrity sha512-2LNhETWYxiYysBtrBTqL8+La0jIoQQnIScUJc74OYvUGRmkskNY4EzLCnjHBzdmb38wqtTaixpo1NctEcvMDZw== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-unicode-regex@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.0.0.tgz#c6780e5b1863a76fe792d90eded9fcd5b51d68fc" - integrity sha512-uJBrJhBOEa3D033P95nPHu3nbFwFE9ZgXsfEitzoIXIwqAZWk7uXcg06yFKXz9FSxBH5ucgU/cYdX0IV8ldHKw== +"@babel/plugin-transform-unicode-regex@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.4.4.tgz#ab4634bb4f14d36728bf5978322b35587787970f" + integrity sha512-il+/XdNw01i93+M9J9u4T7/e/Ue/vWfNZE4IRUQjplu2Mqb/AFTDimkw2tdEdSH50wuQXZAbXSql0UphQke+vA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-regex" "^7.0.0" - regexpu-core "^4.1.3" + "@babel/helper-regex" "^7.4.4" + regexpu-core "^4.5.4" "@babel/preset-env@^7.1.5": - version "7.1.5" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.1.5.tgz#a28b5482ca8bc2f2d0712234d6c690240b92495d" - integrity sha512-pQ+2o0YyCp98XG0ODOHJd9z4GsSoV5jicSedRwCrU8uiqcJahwQiOq0asSZEb/m/lwyu6X5INvH/DSiwnQKncw== + version "7.5.4" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.5.4.tgz#64bc15041a3cbb0798930319917e70fcca57713d" + integrity sha512-hFnFnouyRNiH1rL8YkX1ANCNAUVC8Djwdqfev8i1415tnAG+7hlA5zhZ0Q/3Q5gkop4HioIPbCEWAalqcbxRoQ== dependencies: "@babel/helper-module-imports" "^7.0.0" "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-proposal-async-generator-functions" "^7.1.0" - "@babel/plugin-proposal-json-strings" "^7.0.0" - "@babel/plugin-proposal-object-rest-spread" "^7.0.0" - "@babel/plugin-proposal-optional-catch-binding" "^7.0.0" - "@babel/plugin-proposal-unicode-property-regex" "^7.0.0" - "@babel/plugin-syntax-async-generators" "^7.0.0" - "@babel/plugin-syntax-object-rest-spread" "^7.0.0" - "@babel/plugin-syntax-optional-catch-binding" "^7.0.0" - "@babel/plugin-transform-arrow-functions" "^7.0.0" - "@babel/plugin-transform-async-to-generator" "^7.1.0" - "@babel/plugin-transform-block-scoped-functions" "^7.0.0" - "@babel/plugin-transform-block-scoping" "^7.1.5" - "@babel/plugin-transform-classes" "^7.1.0" - "@babel/plugin-transform-computed-properties" "^7.0.0" - "@babel/plugin-transform-destructuring" "^7.0.0" - "@babel/plugin-transform-dotall-regex" "^7.0.0" - "@babel/plugin-transform-duplicate-keys" "^7.0.0" - "@babel/plugin-transform-exponentiation-operator" "^7.1.0" - "@babel/plugin-transform-for-of" "^7.0.0" - "@babel/plugin-transform-function-name" "^7.1.0" - "@babel/plugin-transform-literals" "^7.0.0" - "@babel/plugin-transform-modules-amd" "^7.1.0" - "@babel/plugin-transform-modules-commonjs" "^7.1.0" - "@babel/plugin-transform-modules-systemjs" "^7.0.0" - "@babel/plugin-transform-modules-umd" "^7.1.0" - "@babel/plugin-transform-new-target" "^7.0.0" - "@babel/plugin-transform-object-super" "^7.1.0" - "@babel/plugin-transform-parameters" "^7.1.0" - "@babel/plugin-transform-regenerator" "^7.0.0" - "@babel/plugin-transform-shorthand-properties" "^7.0.0" - "@babel/plugin-transform-spread" "^7.0.0" - "@babel/plugin-transform-sticky-regex" "^7.0.0" - "@babel/plugin-transform-template-literals" "^7.0.0" - "@babel/plugin-transform-typeof-symbol" "^7.0.0" - "@babel/plugin-transform-unicode-regex" "^7.0.0" - browserslist "^4.1.0" + "@babel/plugin-proposal-async-generator-functions" "^7.2.0" + "@babel/plugin-proposal-dynamic-import" "^7.5.0" + "@babel/plugin-proposal-json-strings" "^7.2.0" + "@babel/plugin-proposal-object-rest-spread" "^7.5.4" + "@babel/plugin-proposal-optional-catch-binding" "^7.2.0" + "@babel/plugin-proposal-unicode-property-regex" "^7.4.4" + "@babel/plugin-syntax-async-generators" "^7.2.0" + "@babel/plugin-syntax-dynamic-import" "^7.2.0" + "@babel/plugin-syntax-json-strings" "^7.2.0" + "@babel/plugin-syntax-object-rest-spread" "^7.2.0" + "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" + "@babel/plugin-transform-arrow-functions" "^7.2.0" + "@babel/plugin-transform-async-to-generator" "^7.5.0" + "@babel/plugin-transform-block-scoped-functions" "^7.2.0" + "@babel/plugin-transform-block-scoping" "^7.4.4" + "@babel/plugin-transform-classes" "^7.4.4" + "@babel/plugin-transform-computed-properties" "^7.2.0" + "@babel/plugin-transform-destructuring" "^7.5.0" + "@babel/plugin-transform-dotall-regex" "^7.4.4" + "@babel/plugin-transform-duplicate-keys" "^7.5.0" + "@babel/plugin-transform-exponentiation-operator" "^7.2.0" + "@babel/plugin-transform-for-of" "^7.4.4" + "@babel/plugin-transform-function-name" "^7.4.4" + "@babel/plugin-transform-literals" "^7.2.0" + "@babel/plugin-transform-member-expression-literals" "^7.2.0" + "@babel/plugin-transform-modules-amd" "^7.5.0" + "@babel/plugin-transform-modules-commonjs" "^7.5.0" + "@babel/plugin-transform-modules-systemjs" "^7.5.0" + "@babel/plugin-transform-modules-umd" "^7.2.0" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.4.5" + "@babel/plugin-transform-new-target" "^7.4.4" + "@babel/plugin-transform-object-super" "^7.2.0" + "@babel/plugin-transform-parameters" "^7.4.4" + "@babel/plugin-transform-property-literals" "^7.2.0" + "@babel/plugin-transform-regenerator" "^7.4.5" + "@babel/plugin-transform-reserved-words" "^7.2.0" + "@babel/plugin-transform-shorthand-properties" "^7.2.0" + "@babel/plugin-transform-spread" "^7.2.0" + "@babel/plugin-transform-sticky-regex" "^7.2.0" + "@babel/plugin-transform-template-literals" "^7.4.4" + "@babel/plugin-transform-typeof-symbol" "^7.2.0" + "@babel/plugin-transform-unicode-regex" "^7.4.4" + "@babel/types" "^7.5.0" + browserslist "^4.6.0" + core-js-compat "^3.1.1" invariant "^2.2.2" js-levenshtein "^1.1.3" - semver "^5.3.0" + semver "^5.5.0" "@babel/preset-flow@^7.0.0": version "7.0.0" @@ -805,176 +795,124 @@ "@babel/plugin-transform-react-jsx-self" "^7.0.0" "@babel/plugin-transform-react-jsx-source" "^7.0.0" -"@babel/template@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.44.tgz#f8832f4fdcee5d59bf515e595fc5106c529b394f" - dependencies: - "@babel/code-frame" "7.0.0-beta.44" - "@babel/types" "7.0.0-beta.44" - babylon "7.0.0-beta.44" - lodash "^4.2.0" - -"@babel/template@^7.1.0", "@babel/template@^7.1.2": - version "7.1.2" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.1.2.tgz#090484a574fef5a2d2d7726a674eceda5c5b5644" - integrity sha512-SY1MmplssORfFiLDcOETrW7fCLl+PavlwMh92rrGcikQaRq4iWPVH0MpwPpY3etVMx6RnDjXtr6VZYr/IbP/Ag== +"@babel/template@^7.1.0", "@babel/template@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.4.4.tgz#f4b88d1225689a08f5bc3a17483545be9e4ed237" + integrity sha512-CiGzLN9KgAvgZsnivND7rkA+AeJ9JB0ciPOD4U59GKbQP2iQl+olF1l76kJOupqidozfZ32ghwBEJDhnk9MEcw== dependencies: "@babel/code-frame" "^7.0.0" - "@babel/parser" "^7.1.2" - "@babel/types" "^7.1.2" - -"@babel/template@^7.2.2": - version "7.2.2" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.2.2.tgz#005b3fdf0ed96e88041330379e0da9a708eb2907" - integrity sha512-zRL0IMM02AUDwghf5LMSSDEz7sBCO2YnNmpg3uWTZj/v1rcG2BmQUvaGU8GhU8BvfMh1k2KIAYZ7Ji9KXPUg7g== - dependencies: - "@babel/code-frame" "^7.0.0" - "@babel/parser" "^7.2.2" - "@babel/types" "^7.2.2" - -"@babel/traverse@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.44.tgz#a970a2c45477ad18017e2e465a0606feee0d2966" - dependencies: - "@babel/code-frame" "7.0.0-beta.44" - "@babel/generator" "7.0.0-beta.44" - "@babel/helper-function-name" "7.0.0-beta.44" - "@babel/helper-split-export-declaration" "7.0.0-beta.44" - "@babel/types" "7.0.0-beta.44" - babylon "7.0.0-beta.44" - debug "^3.1.0" - globals "^11.1.0" - invariant "^2.2.0" - lodash "^4.2.0" + "@babel/parser" "^7.4.4" + "@babel/types" "^7.4.4" -"@babel/traverse@^7.1.0", "@babel/traverse@^7.1.5": - version "7.1.5" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.1.5.tgz#5aafca2039aa058c104cf2bfeb9fc4a857ccbca9" - integrity sha512-eU6XokWypl0MVJo+MTSPUtlfPePkrqsF26O+l1qFGlCKWwmiYAYy2Sy44Qw8m2u/LbPCsxYt90rghmqhYMGpPA== +"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.4.4", "@babel/traverse@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.5.0.tgz#4216d6586854ef5c3c4592dab56ec7eb78485485" + integrity sha512-SnA9aLbyOCcnnbQEGwdfBggnc142h/rbqqsXcaATj2hZcegCl903pUD/lfpsNBlBSuWow/YDfRyJuWi2EPR5cg== dependencies: "@babel/code-frame" "^7.0.0" - "@babel/generator" "^7.1.5" + "@babel/generator" "^7.5.0" "@babel/helper-function-name" "^7.1.0" - "@babel/helper-split-export-declaration" "^7.0.0" - "@babel/parser" "^7.1.5" - "@babel/types" "^7.1.5" - debug "^3.1.0" - globals "^11.1.0" - lodash "^4.17.10" - -"@babel/traverse@^7.2.2": - version "7.2.2" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.2.2.tgz#961039de1f9bcb946d807efe2dba9c92e859d188" - integrity sha512-E5Bn9FSwHpSkUhthw/XEuvFZxIgrqb9M8cX8j5EUQtrUG5DQUy6bFyl7G7iQ1D1Czudor+xkmp81JbLVVM0Sjg== - dependencies: - "@babel/code-frame" "^7.0.0" - "@babel/generator" "^7.2.2" - "@babel/helper-function-name" "^7.1.0" - "@babel/helper-split-export-declaration" "^7.0.0" - "@babel/parser" "^7.2.2" - "@babel/types" "^7.2.2" + "@babel/helper-split-export-declaration" "^7.4.4" + "@babel/parser" "^7.5.0" + "@babel/types" "^7.5.0" debug "^4.1.0" globals "^11.1.0" - lodash "^4.17.10" - -"@babel/types@7.0.0-beta.44": - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.44.tgz#6b1b164591f77dec0a0342aca995f2d046b3a757" - dependencies: - esutils "^2.0.2" - lodash "^4.2.0" - to-fast-properties "^2.0.0" + lodash "^4.17.11" -"@babel/types@^7.0.0", "@babel/types@^7.1.2", "@babel/types@^7.1.5": - version "7.1.5" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.1.5.tgz#12fe64e91a431234b7017b4227a78cc0eec4e081" - integrity sha512-sJeqa/d9eM/bax8Ivg+fXF7FpN3E/ZmTrWbkk6r+g7biVYfALMnLin4dKijsaqEhpd2xvOGfQTkQkD31YCVV4A== +"@babel/types@^7.0.0", "@babel/types@^7.2.0", "@babel/types@^7.3.0", "@babel/types@^7.4.4", "@babel/types@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.5.0.tgz#e47d43840c2e7f9105bc4d3a2c371b4d0c7832ab" + integrity sha512-UFpDVqRABKsW01bvw7/wSUe56uy6RXM5+VJibVVAybDGxEW25jdwiFJEf7ASvSaC7sN7rbE/l3cLp2izav+CtQ== dependencies: esutils "^2.0.2" - lodash "^4.17.10" - to-fast-properties "^2.0.0" - -"@babel/types@^7.2.0", "@babel/types@^7.2.2": - version "7.2.2" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.2.2.tgz#44e10fc24e33af524488b716cdaee5360ea8ed1e" - integrity sha512-fKCuD6UFUMkR541eDWL+2ih/xFZBXPOg/7EQFeTluMDebfqR4jrpaCjLhkWlQS4hT6nRa2PMEgXKbRB5/H2fpg== - dependencies: - esutils "^2.0.2" - lodash "^4.17.10" + lodash "^4.17.11" to-fast-properties "^2.0.0" "@samverschueren/stream-to-observable@^0.3.0": version "0.3.0" resolved "https://registry.yarnpkg.com/@samverschueren/stream-to-observable/-/stream-to-observable-0.3.0.tgz#ecdf48d532c58ea477acfcab80348424f8d0662f" + integrity sha512-MI4Xx6LHs4Webyvi6EbspgyAb4D2Q2VtnCQ1blOJcoLS6mVa8lNN2rkIy1CVxfTUpoyIbCTkXES1rLXztFD1lg== dependencies: any-observable "^0.3.0" acorn-jsx@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" + integrity sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s= dependencies: acorn "^3.0.4" -acorn-jsx@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-4.1.1.tgz#e8e41e48ea2fe0c896740610ab6a4ffd8add225e" - dependencies: - acorn "^5.0.3" +acorn-jsx@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.1.tgz#32a064fd925429216a09b141102bfdd185fae40e" + integrity sha512-HJ7CfNHrfJLlNTzIEUTj43LNWGkqpRLxm3YjAlcD0ACydk9XynzYsCBHxut+iqt+1aBXkx9UP/w/ZqMr13XIzg== acorn@^3.0.4: version "3.3.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" + integrity sha1-ReN/s56No/JbruP/U2niu18iAXo= -acorn@^5.0.3, acorn@^5.6.0: +acorn@^5.5.0: version "5.7.3" resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" + integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== -acorn@^5.4.0: - version "5.4.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.4.1.tgz#fdc58d9d17f4a4e98d102ded826a9b9759125102" - -ajv-keywords@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.2.0.tgz#e86b819c602cf8821ad637413698f1dec021847a" +acorn@^6.0.7: + version "6.2.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.2.0.tgz#67f0da2fc339d6cfb5d6fb244fd449f33cd8bbe3" + integrity sha512-8oe72N3WPMjA+2zVG71Ia0nXZ8DpQH+QyyHO+p06jT8eg8FGG3FbcUIi8KziHlAfheJQZeoqbvq1mQSQHXKYLw== -ajv@^6.0.1, ajv@^6.5.3: - version "6.5.4" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.5.4.tgz#247d5274110db653706b550fcc2b797ca28cfc59" +ajv@^6.10.0, ajv@^6.9.1: + version "6.10.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.2.tgz#d3cea04d6b017b2894ad69040fec8b623eb4bd52" + integrity sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw== dependencies: fast-deep-equal "^2.0.1" fast-json-stable-stringify "^2.0.0" json-schema-traverse "^0.4.1" uri-js "^4.2.2" -ansi-escapes@^1.0.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" +ansi-colors@3.2.3: + version "3.2.3" + resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-3.2.3.tgz#57d35b8686e851e2cc04c403f1c00203976a1813" + integrity sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw== -ansi-escapes@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.0.0.tgz#ec3e8b4e9f8064fc02c3ac9b65f1c275bda8ef92" +ansi-escapes@^3.0.0, ansi-escapes@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" + integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== ansi-regex@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= ansi-regex@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= + +ansi-regex@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" + integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" + integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4= ansi-styles@^3.2.0, ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== dependencies: color-convert "^1.9.0" any-observable@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/any-observable/-/any-observable-0.3.0.tgz#af933475e5806a67d0d7df090dd5e8bef65d119b" + integrity sha512-/FQM1EDkTsf63Ub2C6O7GuYFDsSXUwsaZDurV0np41ocwq0jthUAYCmhBX9f+KwlaCgIuWyr/4WlUQUBfKfZog== argparse@^1.0.7: version "1.0.10" @@ -986,63 +924,74 @@ argparse@^1.0.7: arr-diff@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" + integrity sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA= arr-flatten@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" + integrity sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg== arr-union@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" + integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= -array-union@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" +array-includes@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.0.3.tgz#184b48f62d92d7452bb31b323165c7f8bd02266d" + integrity sha1-GEtI9i2S10UrsxsyMWXH+L0CJm0= dependencies: - array-uniq "^1.0.1" - -array-uniq@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" + define-properties "^1.1.2" + es-abstract "^1.7.0" array-unique@^0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" - -arrify@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" + integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= assign-symbols@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" + integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= + +astral-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" + integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== atob@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" + integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== -babel-eslint@^8.2.6: - version "8.2.6" - resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-8.2.6.tgz#6270d0c73205628067c0f7ae1693a9e797acefd9" +babel-eslint@^10.0.2: + version "10.0.2" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.0.2.tgz#182d5ac204579ff0881684b040560fdcc1558456" + integrity sha512-UdsurWPtgiPgpJ06ryUnuaSXC2s0WoSZnQmEpbAH65XZSdwowgN5MvyP7e88nW07FYXv72erVtpBkxyDVKhH1Q== dependencies: - "@babel/code-frame" "7.0.0-beta.44" - "@babel/traverse" "7.0.0-beta.44" - "@babel/types" "7.0.0-beta.44" - babylon "7.0.0-beta.44" + "@babel/code-frame" "^7.0.0" + "@babel/parser" "^7.0.0" + "@babel/traverse" "^7.0.0" + "@babel/types" "^7.0.0" eslint-scope "3.7.1" eslint-visitor-keys "^1.0.0" -babylon@7.0.0-beta.44: - version "7.0.0-beta.44" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.44.tgz#89159e15e6e30c5096e22d738d8c0af8a0e8ca1d" +babel-plugin-dynamic-import-node@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.0.tgz#f00f507bdaa3c3e3ff6e7e5e98d90a7acab96f7f" + integrity sha512-o6qFkpeQEBxcqt0XYlWzAVxNCSCZdUgcR8IRlhD/8DylxjjO4foPcvTW0GGKa/cVt3rvxZ7o5ippJ+/0nvLhlQ== + dependencies: + object.assign "^4.1.0" balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= base@^0.11.1: version "0.11.2" resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" + integrity sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg== dependencies: cache-base "^1.0.1" class-utils "^0.3.5" @@ -1055,6 +1004,7 @@ base@^0.11.1: brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== dependencies: balanced-match "^1.0.0" concat-map "0.0.1" @@ -1062,6 +1012,7 @@ brace-expansion@^1.1.7: braces@^2.3.1: version "2.3.2" resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" + integrity sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w== dependencies: arr-flatten "^1.1.0" array-unique "^0.3.2" @@ -1074,26 +1025,24 @@ braces@^2.3.1: split-string "^3.0.2" to-regex "^3.0.1" -browser-stdout@1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" +browser-stdout@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" + integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== -browserslist@^4.1.0: - version "4.3.4" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.3.4.tgz#4477b737db6a1b07077275b24791e680d4300425" - integrity sha512-u5iz+ijIMUlmV8blX82VGFrB9ecnUg5qEt55CMZ/YJEhha+d8qpBfOFuutJ6F/VKRXjZoD33b6uvarpPxcl3RA== +browserslist@^4.6.0, browserslist@^4.6.2: + version "4.6.6" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.6.6.tgz#6e4bf467cde520bc9dbdf3747dafa03531cec453" + integrity sha512-D2Nk3W9JL9Fp/gIcWei8LrERCS+eXu9AM5cfXA8WEZ84lFks+ARnZ0q/R69m2SV3Wjma83QDDPxsNKXUwdIsyA== dependencies: - caniuse-lite "^1.0.30000899" - electron-to-chromium "^1.3.82" - node-releases "^1.0.1" - -builtin-modules@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" + caniuse-lite "^1.0.30000984" + electron-to-chromium "^1.3.191" + node-releases "^1.1.25" cache-base@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" + integrity sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ== dependencies: collection-visit "^1.0.0" component-emitter "^1.2.1" @@ -1105,24 +1054,44 @@ cache-base@^1.0.1: union-value "^1.0.0" unset-value "^1.0.0" -caller-path@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" +caller-callsite@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/caller-callsite/-/caller-callsite-2.0.0.tgz#847e0fce0a223750a9a027c54b33731ad3154134" + integrity sha1-hH4PzgoiN1CpoCfFSzNzGtMVQTQ= dependencies: - callsites "^0.2.0" + callsites "^2.0.0" -callsites@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" +caller-path@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-2.0.0.tgz#468f83044e369ab2010fac5f06ceee15bb2cb1f4" + integrity sha1-Ro+DBE42mrIBD6xfBs7uFbsssfQ= + dependencies: + caller-callsite "^2.0.0" + +callsites@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-2.0.0.tgz#06eb84f00eea413da86affefacbffb36093b3c50" + integrity sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA= + +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + +camelcase@^5.0.0: + version "5.3.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== -caniuse-lite@^1.0.30000899: - version "1.0.30000906" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000906.tgz#7c44e498a2504f7a5db3b4f91285bbc821157a77" - integrity sha512-ME7JFX6h0402om/nC/8Lw+q23QvPe2ust9U0ntLmkX9F2zaGwq47fZkjlyHKirFBuq1EM+T/LXBcDdW4bvkCTA== +caniuse-lite@^1.0.30000984: + version "1.0.30000984" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000984.tgz#dc96c3c469e9bcfc6ad5bdd24c77ec918ea76fe0" + integrity sha512-n5tKOjMaZ1fksIpQbjERuqCyfgec/m9pferkFQbLmWtqLUdmt12hNhjSwsmPdqeiG2NkITOQhr1VYIwWSAceiA== -chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3: +chalk@^1.0.0, chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg= dependencies: ansi-styles "^2.2.1" escape-string-regexp "^1.0.2" @@ -1130,9 +1099,10 @@ chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" -chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e" +chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.1, chalk@^2.4.1, chalk@^2.4.2: + version "2.4.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== dependencies: ansi-styles "^3.2.1" escape-string-regexp "^1.0.5" @@ -1141,43 +1111,34 @@ chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.1: chardet@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" + integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== -ci-info@^1.3.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.4.0.tgz#4841d53cad49f11b827b648ebde27a6e189b412f" - -circular-json@^0.3.1: - version "0.3.3" - resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" +ci-info@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" + integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== class-utils@^0.3.5: version "0.3.6" resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" + integrity sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg== dependencies: arr-union "^3.1.0" define-property "^0.2.5" isobject "^3.0.0" static-extend "^0.1.1" -cli-cursor@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-1.0.2.tgz#64da3f7d56a54412e59794bd62dc35295e8f2987" - dependencies: - restore-cursor "^1.0.1" - -cli-cursor@^2.1.0: +cli-cursor@^2.0.0, cli-cursor@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" + integrity sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU= dependencies: restore-cursor "^2.0.0" -cli-spinners@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-0.1.2.tgz#bb764d88e185fb9e1e6a2a1f19772318f605e31c" - cli-truncate@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/cli-truncate/-/cli-truncate-0.2.1.tgz#9f15cfbb0705005369216c626ac7d05ab90dd574" + integrity sha1-nxXPuwcFAFNpIWxiasfQWrkN1XQ= dependencies: slice-ansi "0.0.4" string-width "^1.0.1" @@ -1185,47 +1146,61 @@ cli-truncate@^0.2.1: cli-width@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" + integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk= + +cliui@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-4.1.0.tgz#348422dbe82d800b3022eef4f6ac10bf2e4d1b49" + integrity sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ== + dependencies: + string-width "^2.1.1" + strip-ansi "^4.0.0" + wrap-ansi "^2.0.0" code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= collection-visit@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" + integrity sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA= dependencies: map-visit "^1.0.0" object-visit "^1.0.0" color-convert@^1.9.0: - version "1.9.2" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.2.tgz#49881b8fba67df12a96bdf3f56c0aab9e7913147" + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== dependencies: - color-name "1.1.1" + color-name "1.1.3" -color-name@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.1.tgz#4b1415304cf50028ea81643643bd82ea05803689" - -commander@2.11.0: - version "2.11.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= commander@^2.14.1, commander@^2.9.0: - version "2.17.1" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" + version "2.20.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422" + integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ== component-emitter@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.2.1.tgz#137918d6d78283f7df7a6b7c5a63e140e69425e6" + version "1.3.0" + resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" + integrity sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg== concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= contains-path@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" + integrity sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo= convert-source-map@^1.1.0: version "1.6.0" @@ -1237,26 +1212,45 @@ convert-source-map@^1.1.0: copy-descriptor@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" + integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= + +core-js-compat@^3.1.1: + version "3.1.4" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.1.4.tgz#e4d0c40fbd01e65b1d457980fe4112d4358a7408" + integrity sha512-Z5zbO9f1d0YrJdoaQhphVAnKPimX92D6z8lCGphH89MNRxlL1prI9ExJPqVwP0/kgkQCv8c4GJGT8X16yUncOg== + dependencies: + browserslist "^4.6.2" + core-js-pure "3.1.4" + semver "^6.1.1" + +core-js-pure@3.1.4: + version "3.1.4" + resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.1.4.tgz#5fa17dc77002a169a3566cc48dc774d2e13e3769" + integrity sha512-uJ4Z7iPNwiu1foygbcZYJsJs1jiXrTTCvxfLDXNhI/I+NHbSIEyr548y4fcsCEyWY0XgfAG/qqaunJ1SThHenA== -cosmiconfig@^5.0.2: - version "5.0.6" - resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.0.6.tgz#dca6cf680a0bd03589aff684700858c81abeeb39" +cosmiconfig@^5.0.2, cosmiconfig@^5.0.7: + version "5.2.1" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.2.1.tgz#040f726809c591e77a17c0a3626ca45b4f168b1a" + integrity sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA== dependencies: + import-fresh "^2.0.0" is-directory "^0.3.1" - js-yaml "^3.9.0" + js-yaml "^3.13.1" parse-json "^4.0.0" cross-spawn@^5.0.1: version "5.1.0" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" + integrity sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk= dependencies: lru-cache "^4.0.1" shebang-command "^1.2.0" which "^1.2.9" -cross-spawn@^6.0.5: +cross-spawn@^6.0.0, cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" + integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== dependencies: nice-try "^1.0.4" path-key "^2.0.1" @@ -1265,237 +1259,293 @@ cross-spawn@^6.0.5: which "^1.2.9" date-fns@^1.27.2: - version "1.29.0" - resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.29.0.tgz#12e609cdcb935127311d04d33334e2960a2a54e6" + version "1.30.1" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c" + integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw== -debug@3.1.0, debug@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" +debug@3.2.6, debug@^3.1.0: + version "3.2.6" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" + integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== dependencies: - ms "2.0.0" + ms "^2.1.1" debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== dependencies: ms "2.0.0" -debug@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.0.tgz#373687bffa678b38b1cd91f861b63850035ddc87" - integrity sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg== +debug@^4.0.1, debug@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" + integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== dependencies: ms "^2.1.1" +decamelize@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= + decode-uri-component@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" + integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= dedent@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" + integrity sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw= deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" + integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= + +define-properties@^1.1.2: + version "1.1.3" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" + integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== + dependencies: + object-keys "^1.0.12" define-property@^0.2.5: version "0.2.5" resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" + integrity sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY= dependencies: is-descriptor "^0.1.0" define-property@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" + integrity sha1-dp66rz9KY6rTr56NMEybvnm/sOY= dependencies: is-descriptor "^1.0.0" define-property@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" + integrity sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ== dependencies: is-descriptor "^1.0.2" isobject "^3.0.1" -del@^2.0.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8" - dependencies: - globby "^5.0.0" - is-path-cwd "^1.0.0" - is-path-in-cwd "^1.0.0" - object-assign "^4.0.1" - pify "^2.0.0" - pinkie-promise "^2.0.0" - rimraf "^2.2.8" - -diff@3.3.1: - version "3.3.1" - resolved "https://registry.yarnpkg.com/diff/-/diff-3.3.1.tgz#aa8567a6eed03c531fc89d3f711cd0e5259dec75" +diff@3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" + integrity sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA== doctrine@1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" + integrity sha1-N53Ocw9hZvds76TmcHoVmwLFpvo= dependencies: esutils "^2.0.2" isarray "^1.0.0" -doctrine@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== dependencies: esutils "^2.0.2" -electron-to-chromium@^1.3.82: - version "1.3.83" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.83.tgz#74584eb0972bb6777811c5d68d988c722f5e6666" - integrity sha512-DqJoDarxq50dcHsOOlMLNoy+qQitlMNbYb6wwbE0oUw2veHdRkpNrhmngiUYKMErdJ8SJ48rpJsZTQgy5SoEAA== +electron-to-chromium@^1.3.191: + version "1.3.191" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.191.tgz#c451b422cd8b2eab84dedabab5abcae1eaefb6f0" + integrity sha512-jasjtY5RUy/TOyiUYM2fb4BDaPZfm6CXRFeJDMfFsXYADGxUN49RBqtgB7EL2RmJXeIRUk9lM1U6A5yk2YJMPQ== elegant-spinner@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/elegant-spinner/-/elegant-spinner-1.0.1.tgz#db043521c95d7e303fd8f345bedc3349cfb0729e" + integrity sha1-2wQ1IcldfjA/2PNFvtwzSc+wcp4= -error-ex@^1.2.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.1.tgz#f855a86ce61adc4e8621c3cda21e7a7612c3a8dc" +emoji-regex@^7.0.1: + version "7.0.3" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" + integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== + +end-of-stream@^1.1.0: + version "1.4.1" + resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.1.tgz#ed29634d19baba463b6ce6b80a37213eab71ec43" + integrity sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q== dependencies: - is-arrayish "^0.2.1" + once "^1.4.0" -error-ex@^1.3.1: +error-ex@^1.2.0, error-ex@^1.3.1: version "1.3.2" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" + integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== dependencies: is-arrayish "^0.2.1" +es-abstract@^1.5.1, es-abstract@^1.7.0: + version "1.13.0" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.13.0.tgz#ac86145fdd5099d8dd49558ccba2eaf9b88e24e9" + integrity sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg== + dependencies: + es-to-primitive "^1.2.0" + function-bind "^1.1.1" + has "^1.0.3" + is-callable "^1.1.4" + is-regex "^1.0.4" + object-keys "^1.0.12" + +es-to-primitive@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.0.tgz#edf72478033456e8dda8ef09e00ad9650707f377" + integrity sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg== + dependencies: + is-callable "^1.1.4" + is-date-object "^1.0.1" + is-symbol "^1.0.2" + escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= -eslint-config-babel@^7.0.1: - version "7.0.2" - resolved "https://registry.yarnpkg.com/eslint-config-babel/-/eslint-config-babel-7.0.2.tgz#cbde74f61cee087d8cd6e607fcfa087869a02d99" +eslint-config-babel@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/eslint-config-babel/-/eslint-config-babel-9.0.0.tgz#bcfb9e9a1892aff29b8773cb9d2c76639de83c07" + integrity sha512-J7l2KdDKi2y9QifMqXdSIkghrVXr6fcpxegj+803C+4xBfpp0h2LcY9X5N+ivJMBoX6G2PJ/TBTM1Kro0MELBA== -eslint-import-resolver-node@^0.3.1: +eslint-import-resolver-node@^0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz#58f15fb839b8d0576ca980413476aab2472db66a" + integrity sha512-sfmTqJfPSizWu4aymbPr4Iidp5yKm8yDkHp+Ir3YiTHiiDfxh69mOUsmiqW6RZ9zRXFaF64GtYmN7e+8GHBv6Q== dependencies: debug "^2.6.9" resolve "^1.5.0" -eslint-module-utils@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.2.0.tgz#b270362cd88b1a48ad308976ce7fa54e98411746" +eslint-module-utils@^2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.4.0.tgz#8b93499e9b00eab80ccb6614e69f03678e84e09a" + integrity sha512-14tltLm38Eu3zS+mt0KvILC3q8jyIAH518MlG+HO0p+yK885Lb1UHTY/UgR91eOyGdmxAPb+OLoW4znqIT6Ndw== dependencies: debug "^2.6.8" - pkg-dir "^1.0.0" + pkg-dir "^2.0.0" -eslint-plugin-flowtype@^2.30.3: - version "2.45.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.45.0.tgz#20d8b15d1e1e71ea4e9498e8be3fc62c0752fcbf" +eslint-plugin-flowtype@^3.11.1: + version "3.11.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-3.11.1.tgz#1aae15a10dbcd5aecc89897f810f2e9fcc18a5e3" + integrity sha512-4NiaaGZuz9iEGRTK8j4lkA/scibOXSYaYoHbsTtgLOxxqQCkbWV3xt8ETqILKg7DAYDqB69z1H5U71UmtdF9hw== dependencies: - lodash "^4.15.0" + lodash "^4.17.11" eslint-plugin-import@^2.14.0: - version "2.14.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.14.0.tgz#6b17626d2e3e6ad52cfce8807a845d15e22111a8" + version "2.18.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.18.0.tgz#7a5ba8d32622fb35eb9c8db195c2090bd18a3678" + integrity sha512-PZpAEC4gj/6DEMMoU2Df01C5c50r7zdGIN52Yfi7CvvWaYssG7Jt5R9nFG5gmqodxNOz9vQS87xk6Izdtpdrig== dependencies: + array-includes "^3.0.3" contains-path "^0.1.0" - debug "^2.6.8" + debug "^2.6.9" doctrine "1.5.0" - eslint-import-resolver-node "^0.3.1" - eslint-module-utils "^2.2.0" - has "^1.0.1" - lodash "^4.17.4" - minimatch "^3.0.3" + eslint-import-resolver-node "^0.3.2" + eslint-module-utils "^2.4.0" + has "^1.0.3" + lodash "^4.17.11" + minimatch "^3.0.4" read-pkg-up "^2.0.0" - resolve "^1.6.0" + resolve "^1.11.0" -eslint-plugin-prettier@^2.1.2: - version "2.6.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.6.0.tgz#33e4e228bdb06142d03c560ce04ec23f6c767dd7" +eslint-plugin-prettier@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.0.tgz#8695188f95daa93b0dc54b249347ca3b79c4686d" + integrity sha512-XWX2yVuwVNLOUhQijAkXz+rMPPoCr7WFiAl8ig6I7Xn+pPVhDhzg4DxHpmbeb0iqjO9UronEA3Tb09ChnFVHHA== dependencies: - fast-diff "^1.1.1" - jest-docblock "^21.0.0" + prettier-linter-helpers "^1.0.0" eslint-scope@3.7.1: version "3.7.1" - resolved "http://registry.npm.taobao.org/eslint-scope/download/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" + integrity sha1-PWPD7f2gLgbgGkUq2IyqzHzctug= dependencies: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-scope@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.0.tgz#50bf3071e9338bcdc43331794a0cb533f0136172" +eslint-scope@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848" + integrity sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg== dependencies: esrecurse "^4.1.0" estraverse "^4.1.1" eslint-utils@^1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.3.1.tgz#9a851ba89ee7c460346f97cf8939c7298827e512" + version "1.4.0" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.0.tgz#e2c3c8dba768425f897cf0f9e51fe2e241485d4c" + integrity sha512-7ehnzPaP5IIEh1r1tkjuIrxqhNkzUJa9z3R92tLJdZIVdWaczEhr3EbhGtsMrVxi1KeR8qA7Off6SWc5WNQqyQ== + dependencies: + eslint-visitor-keys "^1.0.0" eslint-visitor-keys@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" + integrity sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ== -eslint@^5.6.0: - version "5.6.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.6.0.tgz#b6f7806041af01f71b3f1895cbb20971ea4b6223" +eslint@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.0.1.tgz#4a32181d72cb999d6f54151df7d337131f81cda7" + integrity sha512-DyQRaMmORQ+JsWShYsSg4OPTjY56u1nCjAmICrE8vLWqyLKxhFXOthwMj1SA8xwfrv0CofLNVnqbfyhwCkaO0w== dependencies: "@babel/code-frame" "^7.0.0" - ajv "^6.5.3" + ajv "^6.10.0" chalk "^2.1.0" cross-spawn "^6.0.5" - debug "^3.1.0" - doctrine "^2.1.0" - eslint-scope "^4.0.0" + debug "^4.0.1" + doctrine "^3.0.0" + eslint-scope "^4.0.3" eslint-utils "^1.3.1" eslint-visitor-keys "^1.0.0" - espree "^4.0.0" + espree "^6.0.0" esquery "^1.0.1" esutils "^2.0.2" - file-entry-cache "^2.0.0" + file-entry-cache "^5.0.1" functional-red-black-tree "^1.0.1" - glob "^7.1.2" + glob-parent "^3.1.0" globals "^11.7.0" ignore "^4.0.6" + import-fresh "^3.0.0" imurmurhash "^0.1.4" - inquirer "^6.1.0" - is-resolvable "^1.1.0" - js-yaml "^3.12.0" + inquirer "^6.2.2" + is-glob "^4.0.0" + js-yaml "^3.13.1" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.3.0" - lodash "^4.17.5" + lodash "^4.17.11" minimatch "^3.0.4" mkdirp "^0.5.1" natural-compare "^1.4.0" optionator "^0.8.2" - path-is-inside "^1.0.2" - pluralize "^7.0.0" progress "^2.0.0" - regexpp "^2.0.0" - require-uncached "^1.0.3" + regexpp "^2.0.1" semver "^5.5.1" strip-ansi "^4.0.0" strip-json-comments "^2.0.1" - table "^4.0.3" + table "^5.2.3" text-table "^0.2.0" espree@^3.5.2: - version "3.5.3" - resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.3.tgz#931e0af64e7fbbed26b050a29daad1fc64799fa6" + version "3.5.4" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.4.tgz#b0f447187c8a8bed944b815a660bddf5deb5d1a7" + integrity sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A== dependencies: - acorn "^5.4.0" + acorn "^5.5.0" acorn-jsx "^3.0.0" -espree@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-4.0.0.tgz#253998f20a0f82db5d866385799d912a83a36634" +espree@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-6.0.0.tgz#716fc1f5a245ef5b9a7fdb1d7b0d3f02322e75f6" + integrity sha512-lJvCS6YbCn3ImT3yKkPe0+tJ+mH6ljhGNjHQH9mRtiO6gjhVAOhVXW1yjnwqGwTkK3bGbye+hb00nFNmu0l/1Q== dependencies: - acorn "^5.6.0" - acorn-jsx "^4.1.1" + acorn "^6.0.7" + acorn-jsx "^5.0.0" + eslint-visitor-keys "^1.0.0" esprima@^4.0.0: version "4.0.1" @@ -1505,26 +1555,31 @@ esprima@^4.0.0: esquery@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708" + integrity sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA== dependencies: estraverse "^4.0.0" esrecurse@^4.1.0: version "4.2.1" resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" + integrity sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ== dependencies: estraverse "^4.1.0" estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1: version "4.2.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" + integrity sha1-De4/7TH81GlhjOc0IJn8GvoL2xM= esutils@^2.0.0, esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" + integrity sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs= execa@^0.9.0: version "0.9.0" resolved "https://registry.yarnpkg.com/execa/-/execa-0.9.0.tgz#adb7ce62cf985071f60580deb4a88b9e34712d01" + integrity sha512-BbUMBiX4hqiHZUA5+JujIjNb6TyAlp2D5KLheMjMluwOuzcnylDL4AxZYLLn1n2AGB49eSWwyKvvEQoRpnAtmA== dependencies: cross-spawn "^5.0.1" get-stream "^3.0.0" @@ -1534,13 +1589,23 @@ execa@^0.9.0: signal-exit "^3.0.0" strip-eof "^1.0.0" -exit-hook@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8" +execa@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8" + integrity sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA== + dependencies: + cross-spawn "^6.0.0" + get-stream "^4.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" expand-brackets@^2.1.4: version "2.1.4" resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" + integrity sha1-t3c14xXOMPa27/D4OwQVGiJEliI= dependencies: debug "^2.3.3" define-property "^0.2.5" @@ -1553,19 +1618,22 @@ expand-brackets@^2.1.4: extend-shallow@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" + integrity sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8= dependencies: is-extendable "^0.1.0" extend-shallow@^3.0.0, extend-shallow@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" + integrity sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg= dependencies: assign-symbols "^1.0.0" is-extendable "^1.0.1" -external-editor@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.0.3.tgz#5866db29a97826dbe4bf3afd24070ead9ea43a27" +external-editor@^3.0.3: + version "3.1.0" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.1.0.tgz#cb03f740befae03ea4d283caed2741a83f335495" + integrity sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew== dependencies: chardet "^0.7.0" iconv-lite "^0.4.24" @@ -1574,6 +1642,7 @@ external-editor@^3.0.0: extglob@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" + integrity sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw== dependencies: array-unique "^0.3.2" define-property "^1.0.0" @@ -1587,22 +1656,27 @@ extglob@^2.0.4: fast-deep-equal@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" + integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= -fast-diff@^1.1.1: - version "1.1.2" - resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.1.2.tgz#4b62c42b8e03de3f848460b639079920695d0154" +fast-diff@^1.1.2: + version "1.2.0" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" + integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== fast-json-stable-stringify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" + integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I= fast-levenshtein@~2.0.4: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= figures@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" + integrity sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4= dependencies: escape-string-regexp "^1.0.5" object-assign "^4.1.0" @@ -1610,19 +1684,21 @@ figures@^1.7.0: figures@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" + integrity sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI= dependencies: escape-string-regexp "^1.0.5" -file-entry-cache@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" +file-entry-cache@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-5.0.1.tgz#ca0f6efa6dd3d561333fb14515065c2fafdf439c" + integrity sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g== dependencies: - flat-cache "^1.2.1" - object-assign "^4.0.1" + flat-cache "^2.0.1" fill-range@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" + integrity sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc= dependencies: extend-shallow "^2.0.1" is-number "^3.0.0" @@ -1632,76 +1708,119 @@ fill-range@^4.0.0: find-parent-dir@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/find-parent-dir/-/find-parent-dir-0.3.0.tgz#33c44b429ab2b2f0646299c5f9f718f376ff8d54" + integrity sha1-M8RLQpqysvBkYpnF+fcY83b/jVQ= -find-up@^1.0.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" +find-up@3.0.0, find-up@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" + integrity sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg== dependencies: - path-exists "^2.0.0" - pinkie-promise "^2.0.0" + locate-path "^3.0.0" -find-up@^2.0.0: +find-up@^2.0.0, find-up@^2.1.0: version "2.1.0" - resolved "http://registry.npm.taobao.org/find-up/download/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + integrity sha1-RdG35QbHF93UgndaK3eSCjwMV6c= dependencies: locate-path "^2.0.0" -find-up@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" +flat-cache@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0" + integrity sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA== dependencies: - locate-path "^3.0.0" + flatted "^2.0.0" + rimraf "2.6.3" + write "1.0.3" -flat-cache@^1.2.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.0.tgz#d3030b32b38154f4e3b7e9c709f490f7ef97c481" +flat@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/flat/-/flat-4.1.0.tgz#090bec8b05e39cba309747f1d588f04dbaf98db2" + integrity sha512-Px/TiLIznH7gEDlPXcUD4KnBusa6kR6ayRUVcnEAbreRIuhkqow/mun59BuRXwoYk7ZQOLW1ZM05ilIvK38hFw== dependencies: - circular-json "^0.3.1" - del "^2.0.2" - graceful-fs "^4.1.2" - write "^0.2.1" + is-buffer "~2.0.3" + +flatted@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08" + integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg== for-in@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" + integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= fragment-cache@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" + integrity sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk= dependencies: map-cache "^0.2.2" fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= -function-bind@^1.0.2: +function-bind@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== functional-red-black-tree@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" + integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= -get-own-enumerable-property-symbols@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-2.0.1.tgz#5c4ad87f2834c4b9b4e84549dc1e0650fb38c24b" +get-caller-file@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" + integrity sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w== + +get-caller-file@^2.0.1: + version "2.0.5" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== + +get-own-enumerable-property-symbols@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.0.tgz#b877b49a5c16aefac3655f2ed2ea5b684df8d203" + integrity sha512-CIJYJC4GGF06TakLg8z4GQKvDsx9EMspVxOYih7LerEL/WosUnFIww45CGfxfeKHqlg3twgUrYRT1O3WQqjGCg== get-stdin@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b" + integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g== get-stream@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" + integrity sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ= + +get-stream@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" + integrity sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w== + dependencies: + pump "^3.0.0" get-value@^2.0.3, get-value@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" + integrity sha1-3BXKHGcjh8p2vTesCjlbogQqLCg= -glob@7.1.2, glob@^7.0.3, glob@^7.0.5, glob@^7.1.2: - version "7.1.2" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" +glob-parent@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae" + integrity sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4= + dependencies: + is-glob "^3.1.0" + path-dirname "^1.0.0" + +glob@7.1.3: + version "7.1.3" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1" + integrity sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" @@ -1710,46 +1829,54 @@ glob@7.1.2, glob@^7.0.3, glob@^7.0.5, glob@^7.1.2: once "^1.3.0" path-is-absolute "^1.0.0" -globals@^11.1.0, globals@^11.7.0: - version "11.7.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.7.0.tgz#a583faa43055b1aca771914bf68258e2fc125673" - -globby@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d" +glob@^7.1.3: + version "7.1.4" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" + integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A== dependencies: - array-union "^1.0.1" - arrify "^1.0.0" - glob "^7.0.3" - object-assign "^4.0.1" - pify "^2.0.0" - pinkie-promise "^2.0.0" + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +globals@^11.1.0, globals@^11.7.0: + version "11.12.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" + integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== graceful-fs@^4.1.2: - version "4.1.11" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" + version "4.2.0" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.0.tgz#8d8fdc73977cb04104721cb53666c1ca64cd328b" + integrity sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg== -growl@1.10.3: - version "1.10.3" - resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.3.tgz#1926ba90cf3edfe2adb4927f5880bc22c66c790f" +growl@1.10.5: + version "1.10.5" + resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e" + integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA== has-ansi@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + integrity sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE= dependencies: ansi-regex "^2.0.0" -has-flag@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" - has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= + +has-symbols@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44" + integrity sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q= has-value@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" + integrity sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8= dependencies: get-value "^2.0.3" has-values "^0.1.4" @@ -1758,6 +1885,7 @@ has-value@^0.3.1: has-value@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" + integrity sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc= dependencies: get-value "^2.0.6" has-values "^1.0.0" @@ -1766,37 +1894,43 @@ has-value@^1.0.0: has-values@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" + integrity sha1-bWHeldkd/Km5oCCJrThL/49it3E= has-values@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" + integrity sha1-lbC2P+whRmGab+V/51Yo1aOe/k8= dependencies: is-number "^3.0.0" kind-of "^4.0.0" -has@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28" +has@^1.0.1, has@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" + integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== dependencies: - function-bind "^1.0.2" + function-bind "^1.1.1" -he@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" +he@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" + integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== hosted-git-info@^2.1.4: - version "2.5.0" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.5.0.tgz#6d60e34b3abbc8313062c3b798ef8d901a07af3c" + version "2.7.1" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" + integrity sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w== husky@^1.0.0-rc.13: - version "1.0.0-rc.13" - resolved "https://registry.yarnpkg.com/husky/-/husky-1.0.0-rc.13.tgz#49c3cc210bfeac24d4ad272f770b7505c9091828" + version "1.3.1" + resolved "https://registry.yarnpkg.com/husky/-/husky-1.3.1.tgz#26823e399300388ca2afff11cfa8a86b0033fae0" + integrity sha512-86U6sVVVf4b5NYSZ0yvv88dRgBSSXXmHaiq5pP4KDj5JVzdwKgBjEtUPOm8hcoytezFwbU+7gotXNhpHdystlg== dependencies: - cosmiconfig "^5.0.2" - execa "^0.9.0" + cosmiconfig "^5.0.7" + execa "^1.0.0" find-up "^3.0.0" get-stdin "^6.0.0" - is-ci "^1.1.0" + is-ci "^2.0.0" pkg-dir "^3.0.0" please-upgrade-node "^3.1.1" read-pkg "^4.0.1" @@ -1806,109 +1940,149 @@ husky@^1.0.0-rc.13: iconv-lite@^0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" + integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== dependencies: safer-buffer ">= 2.1.2 < 3" ignore@^4.0.6: version "4.0.6" resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" + integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== + +import-fresh@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-2.0.0.tgz#d81355c15612d386c61f9ddd3922d4304822a546" + integrity sha1-2BNVwVYS04bGH53dOSLUMEgipUY= + dependencies: + caller-path "^2.0.0" + resolve-from "^3.0.0" + +import-fresh@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.1.0.tgz#6d33fa1dcef6df930fae003446f33415af905118" + integrity sha512-PpuksHKGt8rXfWEr9m9EHIpgyyaltBy8+eF6GJM0QCAxMgxCfucMF3mjecK2QsJr0amJW7gTqh5/wht0z2UhEQ== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" - -indent-string@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-2.1.0.tgz#8e2d48348742121b4a8218b7a137e9a52049dc80" - dependencies: - repeating "^2.0.0" + integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= indent-string@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-3.2.0.tgz#4a5fd6d27cc332f37e5419a504dbb837105c9289" + integrity sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok= inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= dependencies: once "^1.3.0" wrappy "1" inherits@2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== -inquirer@^6.1.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.2.0.tgz#51adcd776f661369dc1e894859c2560a224abdd8" +inquirer@^6.2.2: + version "6.5.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.0.tgz#2303317efc9a4ea7ec2e2df6f86569b734accf42" + integrity sha512-scfHejeG/lVZSpvCXpsB4j/wQNPM5JC8kiElOI0OUTwmc1RTpXr4H32/HOlQHcZiYl2z2VElwuCVDRG8vFmbnA== dependencies: - ansi-escapes "^3.0.0" - chalk "^2.0.0" + ansi-escapes "^3.2.0" + chalk "^2.4.2" cli-cursor "^2.1.0" cli-width "^2.0.0" - external-editor "^3.0.0" + external-editor "^3.0.3" figures "^2.0.0" - lodash "^4.17.10" + lodash "^4.17.12" mute-stream "0.0.7" run-async "^2.2.0" - rxjs "^6.1.0" + rxjs "^6.4.0" string-width "^2.1.0" - strip-ansi "^4.0.0" + strip-ansi "^5.1.0" through "^2.3.6" -invariant@^2.2.0, invariant@^2.2.2: +invariant@^2.2.2: version "2.2.4" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" + integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== dependencies: loose-envify "^1.0.0" +invert-kv@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-2.0.0.tgz#7393f5afa59ec9ff5f67a27620d11c226e3eec02" + integrity sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA== + is-accessor-descriptor@^0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" + integrity sha1-qeEss66Nh2cn7u84Q/igiXtcmNY= dependencies: kind-of "^3.0.2" is-accessor-descriptor@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" + integrity sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ== dependencies: kind-of "^6.0.0" is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= is-buffer@^1.1.5: version "1.1.6" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" + integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== -is-builtin-module@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe" - dependencies: - builtin-modules "^1.0.0" +is-buffer@~2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.3.tgz#4ecf3fcf749cbd1e472689e109ac66261a25e725" + integrity sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw== -is-ci@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.2.0.tgz#3f4a08d6303a09882cef3f0fb97439c5f5ce2d53" +is-callable@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" + integrity sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA== + +is-ci@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c" + integrity sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w== dependencies: - ci-info "^1.3.0" + ci-info "^2.0.0" is-data-descriptor@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" + integrity sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y= dependencies: kind-of "^3.0.2" is-data-descriptor@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" + integrity sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ== dependencies: kind-of "^6.0.0" +is-date-object@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" + integrity sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY= + is-descriptor@^0.1.0: version "0.1.6" resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" + integrity sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg== dependencies: is-accessor-descriptor "^0.1.6" is-data-descriptor "^0.1.4" @@ -1917,6 +2091,7 @@ is-descriptor@^0.1.0: is-descriptor@^1.0.0, is-descriptor@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" + integrity sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg== dependencies: is-accessor-descriptor "^1.0.0" is-data-descriptor "^1.0.0" @@ -1925,150 +2100,159 @@ is-descriptor@^1.0.0, is-descriptor@^1.0.2: is-directory@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/is-directory/-/is-directory-0.3.1.tgz#61339b6f2475fc772fd9c9d83f5c8575dc154ae1" + integrity sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE= is-extendable@^0.1.0, is-extendable@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + integrity sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik= is-extendable@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" + integrity sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA== dependencies: is-plain-object "^2.0.4" -is-extglob@^2.1.1: +is-extglob@^2.1.0, is-extglob@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" - -is-finite@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" - dependencies: - number-is-nan "^1.0.0" + integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= is-fullwidth-code-point@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= dependencies: number-is-nan "^1.0.0" is-fullwidth-code-point@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= + +is-glob@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a" + integrity sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo= + dependencies: + is-extglob "^2.1.0" is-glob@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.0.tgz#9521c76845cc2610a85203ddf080a958c2ffabc0" + version "4.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" + integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== dependencies: is-extglob "^2.1.1" is-number@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" + integrity sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU= dependencies: kind-of "^3.0.2" is-obj@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" + integrity sha1-PkcprB9f3gJc19g6iW2rn09n2w8= is-observable@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-observable/-/is-observable-1.1.0.tgz#b3e986c8f44de950867cab5403f5a3465005975e" + integrity sha512-NqCa4Sa2d+u7BWc6CukaObG3Fh+CU9bvixbpcXYhy2VvYS7vVGIdAgnIS5Ks3A/cqk4rebLJ9s8zBstT2aKnIA== dependencies: symbol-observable "^1.1.0" -is-path-cwd@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" - -is-path-in-cwd@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz#6477582b8214d602346094567003be8a9eac04dc" - dependencies: - is-path-inside "^1.0.0" - -is-path-inside@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.1.tgz#8ef5b7de50437a3fdca6b4e865ef7aa55cb48036" - dependencies: - path-is-inside "^1.0.1" - -is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4: +is-plain-object@^2.0.3, is-plain-object@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== dependencies: isobject "^3.0.1" is-promise@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" + integrity sha1-eaKp7OfwlugPNtKy87wWwf9L8/o= + +is-regex@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" + integrity sha1-VRdIm1RwkbCTDglWVM7SXul+lJE= + dependencies: + has "^1.0.1" is-regexp@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-regexp/-/is-regexp-1.0.0.tgz#fd2d883545c46bac5a633e7b9a09e87fa2cb5069" - -is-resolvable@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88" + integrity sha1-/S2INUXEa6xaYz57mgnof6LLUGk= is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= + +is-symbol@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.2.tgz#a055f6ae57192caee329e7a860118b497a950f38" + integrity sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw== + dependencies: + has-symbols "^1.0.0" is-windows@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" + integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== isarray@1.0.0, isarray@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= isobject@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" + integrity sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk= dependencies: isarray "1.0.0" isobject@^3.0.0, isobject@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" - -jest-docblock@^21.0.0: - version "21.2.0" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-21.2.0.tgz#51529c3b30d5fd159da60c27ceedc195faf8d414" + integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= jest-get-type@^22.1.0: version "22.4.3" resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-22.4.3.tgz#e3a8504d8479342dd4420236b322869f18900ce4" + integrity sha512-/jsz0Y+V29w1chdXVygEKSz2nBoHoYqNShPe+QgxSNjAuP1i8+k4LbQNrfoliKej0P45sivkSCh7yiD6ubHS3w== jest-validate@^23.5.0: - version "23.5.0" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-23.5.0.tgz#f5df8f761cf43155e1b2e21d6e9de8a2852d0231" + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-23.6.0.tgz#36761f99d1ed33fcd425b4e4c5595d62b6597474" + integrity sha512-OFKapYxe72yz7agrDAWi8v2WL8GIfVqcbKRCLbRG9PAxtzF9b1SEDdTpytNDN12z2fJynoBwpMpvj2R39plI2A== dependencies: chalk "^2.0.1" jest-get-type "^22.1.0" leven "^2.1.0" - pretty-format "^23.5.0" + pretty-format "^23.6.0" js-levenshtein@^1.1.3: - version "1.1.4" - resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.4.tgz#3a56e3cbf589ca0081eb22cd9ba0b1290a16d26e" - integrity sha512-PxfGzSs0ztShKrUYPIn5r0MtyAhYcCwmndozzpz8YObbPnD1jFxzlBGbRnX2mIu6Z13xN6+PTu05TQFnZFlzow== - -js-tokens@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" + version "1.1.6" + resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.6.tgz#c6cee58eb3550372df8deb85fad5ce66ce01d59d" + integrity sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g== "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-yaml@^3.12.0, js-yaml@^3.9.0: +js-yaml@3.13.1, js-yaml@^3.13.1: version "3.13.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== @@ -2077,8 +2261,9 @@ js-yaml@^3.12.0, js-yaml@^3.9.0: esprima "^4.0.0" jsesc@^2.5.1: - version "2.5.1" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.1.tgz#e421a2a8e20d6b0819df28908f782526b96dd1fe" + version "2.5.2" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" + integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== jsesc@~0.5.0: version "0.5.0" @@ -2088,14 +2273,17 @@ jsesc@~0.5.0: json-parse-better-errors@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" + integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw== json-schema-traverse@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= json5@^2.1.0: version "2.1.0" @@ -2107,37 +2295,51 @@ json5@^2.1.0: kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: version "3.2.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + integrity sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ= dependencies: is-buffer "^1.1.5" kind-of@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" + integrity sha1-IIE989cSkosgc3hpGkUGb65y3Vc= dependencies: is-buffer "^1.1.5" kind-of@^5.0.0: version "5.1.0" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" + integrity sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw== kind-of@^6.0.0, kind-of@^6.0.2: version "6.0.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" + integrity sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA== + +lcid@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/lcid/-/lcid-2.0.0.tgz#6ef5d2df60e52f82eb228a4c373e8d1f397253cf" + integrity sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA== + dependencies: + invert-kv "^2.0.0" leven@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" + integrity sha1-wuep93IJTe6dNCAq6KzORoeHVYA= levn@^0.3.0, levn@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" + integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= dependencies: prelude-ls "~1.1.2" type-check "~0.3.2" lint-staged@^7.2.2: - version "7.2.2" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-7.2.2.tgz#0983d55d497f19f36d11ff2c8242b2f56cc2dd05" + version "7.3.0" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-7.3.0.tgz#90ff33e5ca61ed3dbac35b6f6502dbefdc0db58d" + integrity sha512-AXk40M9DAiPi7f4tdJggwuKIViUplYtVj1os1MVEteW7qOkU50EOehayCfO9TsoGK24o/EsWb41yrEgfJDDjCw== dependencies: chalk "^2.3.1" commander "^2.14.1" @@ -2165,10 +2367,12 @@ lint-staged@^7.2.2: listr-silent-renderer@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/listr-silent-renderer/-/listr-silent-renderer-1.1.1.tgz#924b5a3757153770bf1a8e3fbf74b8bbf3f9242e" + integrity sha1-kktaN1cVN3C/Go4/v3S4u/P5JC4= -listr-update-renderer@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/listr-update-renderer/-/listr-update-renderer-0.4.0.tgz#344d980da2ca2e8b145ba305908f32ae3f4cc8a7" +listr-update-renderer@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/listr-update-renderer/-/listr-update-renderer-0.5.0.tgz#4ea8368548a7b8aecb7e06d8c95cb45ae2ede6a2" + integrity sha512-tKRsZpKz8GSGqoI/+caPmfrypiaq+OQCbd+CovEC24uk1h952lVj5sC7SqyFUm+OaJ5HN/a1YLt5cit2FMNsFA== dependencies: chalk "^1.1.3" cli-truncate "^0.2.1" @@ -2176,42 +2380,38 @@ listr-update-renderer@^0.4.0: figures "^1.7.0" indent-string "^3.0.0" log-symbols "^1.0.2" - log-update "^1.0.2" + log-update "^2.3.0" strip-ansi "^3.0.1" -listr-verbose-renderer@^0.4.0: - version "0.4.1" - resolved "https://registry.yarnpkg.com/listr-verbose-renderer/-/listr-verbose-renderer-0.4.1.tgz#8206f4cf6d52ddc5827e5fd14989e0e965933a35" +listr-verbose-renderer@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/listr-verbose-renderer/-/listr-verbose-renderer-0.5.0.tgz#f1132167535ea4c1261102b9f28dac7cba1e03db" + integrity sha512-04PDPqSlsqIOaaaGZ+41vq5FejI9auqTInicFRndCBgE3bXG8D6W1I+mWhk+1nqbHmyhla/6BUrd5OSiHwKRXw== dependencies: - chalk "^1.1.3" - cli-cursor "^1.0.2" + chalk "^2.4.1" + cli-cursor "^2.1.0" date-fns "^1.27.2" - figures "^1.7.0" + figures "^2.0.0" listr@^0.14.1: - version "0.14.1" - resolved "https://registry.yarnpkg.com/listr/-/listr-0.14.1.tgz#8a7afa4a7135cee4c921d128e0b7dfc6e522d43d" + version "0.14.3" + resolved "https://registry.yarnpkg.com/listr/-/listr-0.14.3.tgz#2fea909604e434be464c50bddba0d496928fa586" + integrity sha512-RmAl7su35BFd/xoMamRjpIE4j3v+L28o8CT5YhAXQJm1fD+1l9ngXY8JAQRJ+tFK2i5njvi0iRUKV09vPwA0iA== dependencies: "@samverschueren/stream-to-observable" "^0.3.0" - cli-truncate "^0.2.1" - figures "^1.7.0" - indent-string "^2.1.0" is-observable "^1.1.0" is-promise "^2.1.0" is-stream "^1.1.0" listr-silent-renderer "^1.1.1" - listr-update-renderer "^0.4.0" - listr-verbose-renderer "^0.4.0" - log-symbols "^1.0.2" - log-update "^1.0.2" - ora "^0.2.3" - p-map "^1.1.1" - rxjs "^6.1.0" - strip-ansi "^3.0.1" + listr-update-renderer "^0.5.0" + listr-verbose-renderer "^0.5.0" + p-map "^2.0.0" + rxjs "^6.3.3" load-json-file@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8" + integrity sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg= dependencies: graceful-fs "^4.1.2" parse-json "^2.2.0" @@ -2221,6 +2421,7 @@ load-json-file@^2.0.0: locate-path@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" + integrity sha1-K1aLJl7slExtnA3pw9u7ygNUzY4= dependencies: p-locate "^2.0.0" path-exists "^3.0.0" @@ -2228,60 +2429,86 @@ locate-path@^2.0.0: locate-path@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" + integrity sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A== dependencies: p-locate "^3.0.0" path-exists "^3.0.0" -lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.0: +lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.5: version "4.17.14" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.14.tgz#9ce487ae66c96254fe20b599f21b6816028078ba" integrity sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw== -log-symbols@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-1.0.2.tgz#376ff7b58ea3086a0f09facc74617eca501e1a18" - dependencies: - chalk "^1.0.0" - -log-symbols@^2.2.0: +log-symbols@2.2.0, log-symbols@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a" + integrity sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg== dependencies: chalk "^2.0.1" -log-update@^1.0.2: +log-symbols@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/log-update/-/log-update-1.0.2.tgz#19929f64c4093d2d2e7075a1dad8af59c296b8d1" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-1.0.2.tgz#376ff7b58ea3086a0f09facc74617eca501e1a18" + integrity sha1-N2/3tY6jCGoPCfrMdGF+ylAeGhg= + dependencies: + chalk "^1.0.0" + +log-update@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/log-update/-/log-update-2.3.0.tgz#88328fd7d1ce7938b29283746f0b1bc126b24708" + integrity sha1-iDKP19HOeTiykoN0bwsbwSayRwg= dependencies: - ansi-escapes "^1.0.0" - cli-cursor "^1.0.2" + ansi-escapes "^3.0.0" + cli-cursor "^2.0.0" + wrap-ansi "^3.0.1" loose-envify@^1.0.0: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" + integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== dependencies: js-tokens "^3.0.0 || ^4.0.0" lru-cache@^4.0.1: - version "4.1.3" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.3.tgz#a1175cf3496dfc8436c156c334b4955992bce69c" + version "4.1.5" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" + integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g== dependencies: pseudomap "^1.0.2" yallist "^2.1.2" +map-age-cleaner@^0.1.1: + version "0.1.3" + resolved "https://registry.yarnpkg.com/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz#7d583a7306434c055fe474b0f45078e6e1b4b92a" + integrity sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w== + dependencies: + p-defer "^1.0.0" + map-cache@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" + integrity sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8= map-visit@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" + integrity sha1-7Nyo8TFE5mDxtb1B8S80edmN+48= dependencies: object-visit "^1.0.0" +mem@^4.0.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/mem/-/mem-4.3.0.tgz#461af497bc4ae09608cdb2e60eefb69bff744178" + integrity sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w== + dependencies: + map-age-cleaner "^0.1.1" + mimic-fn "^2.0.0" + p-is-promise "^2.0.0" + micromatch@^3.1.8: version "3.1.10" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" + integrity sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== dependencies: arr-diff "^4.0.0" array-unique "^0.3.2" @@ -2300,16 +2527,24 @@ micromatch@^3.1.8: mimic-fn@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" + integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== -minimatch@^3.0.3, minimatch@^3.0.4: +mimic-fn@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== + +minimatch@3.0.4, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== dependencies: brace-expansion "^1.1.7" minimist@0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= minimist@^1.2.0: version "1.2.0" @@ -2317,8 +2552,9 @@ minimist@^1.2.0: integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= mixin-deep@^1.2.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.1.tgz#a49e7268dce1a0d9698e45326c5626df3543d0fe" + version "1.3.2" + resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566" + integrity sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA== dependencies: for-in "^1.0.2" is-extendable "^1.0.1" @@ -2326,40 +2562,63 @@ mixin-deep@^1.2.0: mkdirp@0.5.1, mkdirp@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= dependencies: minimist "0.0.8" -mocha@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-5.0.1.tgz#759b62c836b0732382a62b6b1fb245ec1bc943ac" +mocha@^6.1.4: + version "6.1.4" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-6.1.4.tgz#e35fada242d5434a7e163d555c705f6875951640" + integrity sha512-PN8CIy4RXsIoxoFJzS4QNnCH4psUCPWc4/rPrst/ecSJJbLBkubMiyGCP2Kj/9YnWbotFqAoeXyXMucj7gwCFg== dependencies: - browser-stdout "1.3.0" - commander "2.11.0" - debug "3.1.0" - diff "3.3.1" + ansi-colors "3.2.3" + browser-stdout "1.3.1" + debug "3.2.6" + diff "3.5.0" escape-string-regexp "1.0.5" - glob "7.1.2" - growl "1.10.3" - he "1.1.1" + find-up "3.0.0" + glob "7.1.3" + growl "1.10.5" + he "1.2.0" + js-yaml "3.13.1" + log-symbols "2.2.0" + minimatch "3.0.4" mkdirp "0.5.1" - supports-color "4.4.0" + ms "2.1.1" + node-environment-flags "1.0.5" + object.assign "4.1.0" + strip-json-comments "2.0.1" + supports-color "6.0.0" + which "1.3.1" + wide-align "1.1.3" + yargs "13.2.2" + yargs-parser "13.0.0" + yargs-unparser "1.5.0" ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= -ms@^2.1.1: +ms@2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== +ms@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + mute-stream@0.0.7: version "0.0.7" - resolved "http://registry.npm.taobao.org/mute-stream/download/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" + integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s= nanomatch@^1.2.9: version "1.2.13" resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" + integrity sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA== dependencies: arr-diff "^4.0.0" array-unique "^0.3.2" @@ -2376,42 +2635,56 @@ nanomatch@^1.2.9: natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= nice-try@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" + integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== -node-releases@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.0.3.tgz#3414ed84595096459c251699bfcb47d88324a9e4" - integrity sha512-ZaZWMsbuDcetpHmYeKWPO6e63pSXLb50M7lJgCbcM2nC/nQC3daNifmtp5a2kp7EWwYfhuvH6zLPWkrF8IiDdw== +node-environment-flags@1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/node-environment-flags/-/node-environment-flags-1.0.5.tgz#fa930275f5bf5dae188d6192b24b4c8bbac3d76a" + integrity sha512-VNYPRfGfmZLx0Ye20jWzHUjyTW/c+6Wq+iLhDzUI4XmhrDd9l/FozXV3F2xOaXjvp0co0+v1YSR3CMP6g+VvLQ== + dependencies: + object.getownpropertydescriptors "^2.0.3" + semver "^5.7.0" + +node-releases@^1.1.25: + version "1.1.25" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.25.tgz#0c2d7dbc7fed30fbe02a9ee3007b8c90bf0133d3" + integrity sha512-fI5BXuk83lKEoZDdH3gRhtsNgh05/wZacuXkgbiYkceE7+QIMXOg98n9ZV7mz27B+kFHnqHcUpscZZlGRSmTpQ== dependencies: semver "^5.3.0" normalize-package-data@^2.3.2: - version "2.4.0" - resolved "http://registry.npm.taobao.org/normalize-package-data/download/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f" + version "2.5.0" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" + integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== dependencies: hosted-git-info "^2.1.4" - is-builtin-module "^1.0.0" + resolve "^1.10.0" semver "2 || 3 || 4 || 5" validate-npm-package-license "^3.0.1" npm-path@^2.0.2: version "2.0.4" resolved "https://registry.yarnpkg.com/npm-path/-/npm-path-2.0.4.tgz#c641347a5ff9d6a09e4d9bce5580c4f505278e64" + integrity sha512-IFsj0R9C7ZdR5cP+ET342q77uSRdtWOlWpih5eC+lu29tIDbNEgDbzgVJ5UFvYHWhxDZ5TFkJafFioO0pPQjCw== dependencies: which "^1.2.10" npm-run-path@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" + integrity sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8= dependencies: path-key "^2.0.0" npm-which@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/npm-which/-/npm-which-3.0.1.tgz#9225f26ec3a285c209cae67c3b11a6b4ab7140aa" + integrity sha1-kiXybsOihcIJyuZ8OxGmtKtxQKo= dependencies: commander "^2.9.0" npm-path "^2.0.2" @@ -2420,50 +2693,77 @@ npm-which@^3.0.1: number-is-nan@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= -object-assign@^4.0.1, object-assign@^4.1.0: +object-assign@^4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= object-copy@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" + integrity sha1-fn2Fi3gb18mRpBupde04EnVOmYw= dependencies: copy-descriptor "^0.1.0" define-property "^0.2.5" kind-of "^3.0.3" +object-keys@^1.0.11, object-keys@^1.0.12: + version "1.1.1" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" + integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== + object-visit@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" + integrity sha1-95xEk68MU3e1n+OdOV5BBC3QRbs= dependencies: isobject "^3.0.0" +object.assign@4.1.0, object.assign@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.0.tgz#968bf1100d7956bb3ca086f006f846b3bc4008da" + integrity sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w== + dependencies: + define-properties "^1.1.2" + function-bind "^1.1.1" + has-symbols "^1.0.0" + object-keys "^1.0.11" + +object.getownpropertydescriptors@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16" + integrity sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY= + dependencies: + define-properties "^1.1.2" + es-abstract "^1.5.1" + object.pick@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" + integrity sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c= dependencies: isobject "^3.0.1" -once@^1.3.0: +once@^1.3.0, once@^1.3.1, once@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= dependencies: wrappy "1" -onetime@^1.0.0: - version "1.1.0" - resolved "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789" - onetime@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" + integrity sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ= dependencies: mimic-fn "^1.0.0" optionator@^0.8.2: version "0.8.2" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" + integrity sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q= dependencies: deep-is "~0.1.3" fast-levenshtein "~2.0.4" @@ -2472,68 +2772,101 @@ optionator@^0.8.2: type-check "~0.3.2" wordwrap "~1.0.0" -ora@^0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/ora/-/ora-0.2.3.tgz#37527d220adcd53c39b73571d754156d5db657a4" +os-locale@^3.0.0, os-locale@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-3.1.0.tgz#a802a6ee17f24c10483ab9935719cef4ed16bf1a" + integrity sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q== dependencies: - chalk "^1.1.1" - cli-cursor "^1.0.2" - cli-spinners "^0.1.2" - object-assign "^4.0.1" + execa "^1.0.0" + lcid "^2.0.0" + mem "^4.0.0" os-tmpdir@~1.0.2: version "1.0.2" - resolved "http://registry.npm.taobao.org/os-tmpdir/download/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= + +p-defer@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-1.0.0.tgz#9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c" + integrity sha1-n26xgvbJqozXQwBKfU+WsZaw+ww= p-finally@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= + +p-is-promise@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-2.1.0.tgz#918cebaea248a62cf7ffab8e3bca8c5f882fc42e" + integrity sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg== p-limit@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.2.0.tgz#0e92b6bedcb59f022c13d0f1949dc82d15909f1c" + version "1.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" + integrity sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q== dependencies: p-try "^1.0.0" p-limit@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.0.0.tgz#e624ed54ee8c460a778b3c9f3670496ff8a57aec" + version "2.2.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.0.tgz#417c9941e6027a9abcba5092dd2904e255b5fbc2" + integrity sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ== dependencies: p-try "^2.0.0" p-locate@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" + integrity sha1-IKAQOyIqcMj9OcwuWAaA893l7EM= dependencies: p-limit "^1.1.0" p-locate@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" + integrity sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ== dependencies: p-limit "^2.0.0" p-map@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/p-map/-/p-map-1.2.0.tgz#e4e94f311eabbc8633a1e79908165fca26241b6b" + integrity sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA== + +p-map@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/p-map/-/p-map-2.1.0.tgz#310928feef9c9ecc65b68b17693018a665cea175" + integrity sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw== p-try@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" + integrity sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M= p-try@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.0.0.tgz#85080bb87c64688fa47996fe8f7dfbe8211760b1" + version "2.2.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" + integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== + +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" parse-json@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" + integrity sha1-9ID0BDTvgHQfhGkJn43qGPVaTck= dependencies: error-ex "^1.2.0" parse-json@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" + integrity sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA= dependencies: error-ex "^1.3.1" json-parse-better-errors "^1.0.1" @@ -2541,94 +2874,102 @@ parse-json@^4.0.0: pascalcase@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" + integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= -path-exists@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" - dependencies: - pinkie-promise "^2.0.0" +path-dirname@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/path-dirname/-/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0" + integrity sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA= path-exists@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= -path-is-inside@^1.0.1, path-is-inside@^1.0.2: +path-is-inside@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" + integrity sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM= path-key@^2.0.0, path-key@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= -path-parse@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" +path-parse@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" + integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== path-type@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73" + integrity sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM= dependencies: pify "^2.0.0" pify@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + integrity sha1-7RQaasBDqEnqWISY59yosVMw6Qw= pify@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" + integrity sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY= -pinkie-promise@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" - dependencies: - pinkie "^2.0.0" - -pinkie@^2.0.0: - version "2.0.4" - resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" - -pkg-dir@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-1.0.0.tgz#7a4b508a8d5bb2d629d447056ff4e9c9314cf3d4" +pkg-dir@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-2.0.0.tgz#f6d5d1109e19d63edf428e0bd57e12777615334b" + integrity sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s= dependencies: - find-up "^1.0.0" + find-up "^2.1.0" pkg-dir@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-3.0.0.tgz#2749020f239ed990881b1f71210d51eb6523bea3" + integrity sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw== dependencies: find-up "^3.0.0" please-upgrade-node@^3.0.2, please-upgrade-node@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/please-upgrade-node/-/please-upgrade-node-3.1.1.tgz#ed320051dfcc5024fae696712c8288993595e8ac" + integrity sha512-KY1uHnQ2NlQHqIJQpnh/i54rKkuxCEBx+voJIS/Mvb+L2iYd2NMotwduhKTMjfC1uKoX3VXOxLjIYG66dfJTVQ== dependencies: semver-compare "^1.0.0" -pluralize@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" - posix-character-classes@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" + integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" + integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= + +prettier-linter-helpers@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" + integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== + dependencies: + fast-diff "^1.1.2" prettier@^1.4.4: - version "1.14.2" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.2.tgz#0ac1c6e1a90baa22a62925f41963c841983282f9" + version "1.18.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea" + integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw== -pretty-format@^23.5.0: - version "23.5.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-23.5.0.tgz#0f9601ad9da70fe690a269cd3efca732c210687c" +pretty-format@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-23.6.0.tgz#5eaac8eeb6b33b987b7fe6097ea6a8a146ab5760" + integrity sha512-zf9NV1NSlDLDjycnwm6hpFATCGl/K1lt0R/GdkAK2O5LN/rwJoB+Mh93gGJjut4YbmecbfgLWVGSTCr0Ewvvbw== dependencies: ansi-regex "^3.0.0" ansi-styles "^3.2.0" @@ -2639,20 +2980,32 @@ private@^0.1.6: integrity sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg== progress@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f" + version "2.0.3" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" + integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== pseudomap@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM= + +pump@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" + integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" punycode@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== read-pkg-up@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" + integrity sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4= dependencies: find-up "^2.0.0" read-pkg "^2.0.0" @@ -2660,6 +3013,7 @@ read-pkg-up@^2.0.0: read-pkg@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-2.0.0.tgz#8ef1c0623c6a6db0dc6713c4bfac46332b2368f8" + integrity sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg= dependencies: load-json-file "^2.0.0" normalize-package-data "^2.3.2" @@ -2668,15 +3022,16 @@ read-pkg@^2.0.0: read-pkg@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-4.0.1.tgz#963625378f3e1c4d48c85872b5a6ec7d5d093237" + integrity sha1-ljYlN48+HE1IyFhytabsfV0JMjc= dependencies: normalize-package-data "^2.3.2" parse-json "^4.0.0" pify "^3.0.0" -regenerate-unicode-properties@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-7.0.0.tgz#107405afcc4a190ec5ed450ecaa00ed0cafa7a4c" - integrity sha512-s5NGghCE4itSlUS+0WUj88G6cfMVMmH8boTPNvABf8od+2dhT9WDlWu8n01raQAJZMOK8Ch6jSexaRO7swd6aw== +regenerate-unicode-properties@^8.0.2: + version "8.1.0" + resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-8.1.0.tgz#ef51e0f0ea4ad424b77bf7cb41f3e015c70a3f0e" + integrity sha512-LGZzkgtLY79GeXLm8Dp0BVLdQlWICzBnJz/ipWUgo59qBaZ+BHtq51P2q1uVZlppMuUAT37SDk39qUbjTWB7bA== dependencies: regenerate "^1.4.0" @@ -2685,100 +3040,106 @@ regenerate@^1.4.0: resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.0.tgz#4a856ec4b56e4077c557589cae85e7a4c8869a11" integrity sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg== -regenerator-transform@^0.13.3: - version "0.13.3" - resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.13.3.tgz#264bd9ff38a8ce24b06e0636496b2c856b57bcbb" - integrity sha512-5ipTrZFSq5vU2YoGoww4uaRVAK4wyYC4TSICibbfEPOruUu8FFP7ErV0BjmbIOEpn3O/k9na9UEdYR/3m7N6uA== +regenerator-transform@^0.14.0: + version "0.14.0" + resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.14.0.tgz#2ca9aaf7a2c239dd32e4761218425b8c7a86ecaf" + integrity sha512-rtOelq4Cawlbmq9xuMR5gdFmv7ku/sFoB7sRiywx7aq53bc52b4j6zvH7Te1Vt/X2YveDKnCGUbioieU7FEL3w== dependencies: private "^0.1.6" regex-not@^1.0.0, regex-not@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" + integrity sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A== dependencies: extend-shallow "^3.0.2" safe-regex "^1.1.0" -regexpp@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.0.tgz#b2a7534a85ca1b033bcf5ce9ff8e56d4e0755365" +regexp-tree@^0.1.6: + version "0.1.11" + resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.11.tgz#c9c7f00fcf722e0a56c7390983a7a63dd6c272f3" + integrity sha512-7/l/DgapVVDzZobwMCCgMlqiqyLFJ0cduo/j+3BcDJIB+yJdsYCfKuI3l/04NV+H/rfNRdPIDbXNZHM9XvQatg== -regexpu-core@^4.1.3, regexpu-core@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.2.0.tgz#a3744fa03806cffe146dea4421a3e73bdcc47b1d" - integrity sha512-Z835VSnJJ46CNBttalHD/dB+Sj2ezmY6Xp38npwU87peK6mqOzOpV8eYktdkLTEkzzD+JsTcxd84ozd8I14+rw== +regexpp@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" + integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== + +regexpu-core@^4.5.4: + version "4.5.4" + resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.5.4.tgz#080d9d02289aa87fe1667a4f5136bc98a6aebaae" + integrity sha512-BtizvGtFQKGPUcTy56o3nk1bGRp4SZOTYrDtGNlqCQufptV5IkkLN6Emw+yunAJjzf+C9FQFtvq7IoA3+oMYHQ== dependencies: regenerate "^1.4.0" - regenerate-unicode-properties "^7.0.0" - regjsgen "^0.4.0" - regjsparser "^0.3.0" + regenerate-unicode-properties "^8.0.2" + regjsgen "^0.5.0" + regjsparser "^0.6.0" unicode-match-property-ecmascript "^1.0.4" - unicode-match-property-value-ecmascript "^1.0.2" + unicode-match-property-value-ecmascript "^1.1.0" -regjsgen@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.4.0.tgz#c1eb4c89a209263f8717c782591523913ede2561" - integrity sha512-X51Lte1gCYUdlwhF28+2YMO0U6WeN0GLpgpA7LK7mbdDnkQYiwvEpmpe0F/cv5L14EbxgrdayAG3JETBv0dbXA== +regjsgen@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.5.0.tgz#a7634dc08f89209c2049adda3525711fb97265dd" + integrity sha512-RnIrLhrXCX5ow/E5/Mh2O4e/oa1/jW0eaBKTSy3LaCj+M3Bqvm97GWDp2yUtzIs4LEn65zR2yiYGFqb2ApnzDA== -regjsparser@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.3.0.tgz#3c326da7fcfd69fa0d332575a41c8c0cdf588c96" - integrity sha512-zza72oZBBHzt64G7DxdqrOo/30bhHkwMUoT0WqfGu98XLd7N+1tsy5MJ96Bk4MD0y74n629RhmrGW6XlnLLwCA== +regjsparser@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.6.0.tgz#f1e6ae8b7da2bae96c99399b868cd6c933a2ba9c" + integrity sha512-RQ7YyokLiQBomUJuUG8iGVvkgOLxwyZM8k6d3q5SAXpg4r5TZJZigKFvC6PpD+qQ98bCDC5YelPeA3EucDoNeQ== dependencies: jsesc "~0.5.0" repeat-element@^1.1.2: version "1.1.3" resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" + integrity sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g== repeat-string@^1.6.1: version "1.6.1" resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= -repeating@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" - dependencies: - is-finite "^1.0.0" - -require-uncached@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" - dependencies: - caller-path "^0.1.0" - resolve-from "^1.0.0" +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= -resolve-from@^1.0.0: +require-main-filename@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" + integrity sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE= + +require-main-filename@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" + integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== + +resolve-from@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-3.0.0.tgz#b22c7af7d9d6881bc8b6e653335eebcb0a188748" + integrity sha1-six699nWiBvItuZTM17rywoYh0g= + +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== resolve-url@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" + integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= -resolve@^1.3.2, resolve@^1.6.0: - version "1.8.1" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.8.1.tgz#82f1ec19a423ac1fbd080b0bab06ba36e84a7a26" - integrity sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA== - dependencies: - path-parse "^1.0.5" - -resolve@^1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36" - dependencies: - path-parse "^1.0.5" - -restore-cursor@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541" +resolve@^1.10.0, resolve@^1.11.0, resolve@^1.3.2, resolve@^1.5.0: + version "1.11.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.11.1.tgz#ea10d8110376982fef578df8fc30b9ac30a07a3e" + integrity sha512-vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw== dependencies: - exit-hook "^1.0.0" - onetime "^1.0.0" + path-parse "^1.0.6" restore-cursor@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" + integrity sha1-n37ih/gv0ybU/RYpI9YhKe7g368= dependencies: onetime "^2.0.0" signal-exit "^3.0.2" @@ -2786,26 +3147,31 @@ restore-cursor@^2.0.0: ret@~0.1.10: version "0.1.15" resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" + integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== -rimraf@^2.2.8: - version "2.6.2" - resolved "http://registry.npm.taobao.org/rimraf/download/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" +rimraf@2.6.3: + version "2.6.3" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" + integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== dependencies: - glob "^7.0.5" + glob "^7.1.3" run-async@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" + integrity sha1-A3GrSuC91yDUFm19/aZP96RFpsA= dependencies: is-promise "^2.1.0" run-node@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/run-node/-/run-node-1.0.0.tgz#46b50b946a2aa2d4947ae1d886e9856fd9cabe5e" + integrity sha512-kc120TBlQ3mih1LSzdAJXo4xn/GWS2ec0l3S+syHDXP9uRr0JAT8Qd3mdMuyjqCzeZktgP3try92cEgf9Nks8A== -rxjs@^6.1.0: - version "6.2.2" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.2.2.tgz#eb75fa3c186ff5289907d06483a77884586e1cf9" +rxjs@^6.3.3, rxjs@^6.4.0: + version "6.5.2" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.2.tgz#2e35ce815cd46d84d02a209fb4e5921e051dbec7" + integrity sha512-HUb7j3kvb7p7eCUHE3FqjoDsC1xfZQ4AHFWfTKSpZ+sAhhz5X1WX0ZuUqWbzB2QhSLp3DoLUG+hMdEDKqWo2Zg== dependencies: tslib "^1.9.0" @@ -2817,42 +3183,39 @@ safe-buffer@~5.1.1: safe-regex@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" + integrity sha1-QKNmnzsHfR6UPURinhV91IAjvy4= dependencies: ret "~0.1.10" "safer-buffer@>= 2.1.2 < 3": version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== semver-compare@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc" + integrity sha1-De4hahyUGrN+nvsXiPavxf9VN/w= -"semver@2 || 3 || 4 || 5": - version "5.5.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" - -semver@^5.3.0, semver@^5.4.1, semver@^5.6.0: - version "5.6.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" - integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg== - -semver@^5.5.0, semver@^5.5.1: - version "5.5.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.1.tgz#7dfdd8814bdb7cabc7be0fb1d734cfb66c940477" +"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0, semver@^5.7.0: + version "5.7.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b" + integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA== -set-value@^0.4.3: - version "0.4.3" - resolved "https://registry.yarnpkg.com/set-value/-/set-value-0.4.3.tgz#7db08f9d3d22dc7f78e53af3c3bf4666ecdfccf1" - dependencies: - extend-shallow "^2.0.1" - is-extendable "^0.1.1" - is-plain-object "^2.0.1" - to-object-path "^0.3.0" +semver@^6.1.1: + version "6.2.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.2.0.tgz#4d813d9590aaf8a9192693d6c85b9344de5901db" + integrity sha512-jdFC1VdUGT/2Scgbimf7FSx9iJLXoqfglSF+gJeuNWVpiE37OIbc1jywR/GJyFdz3mnkz2/id0L0J/cr0izR5A== -set-value@^2.0.0: +set-blocking@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.0.tgz#71ae4a88f0feefbbf52d1ea604f3fb315ebb6274" + resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= + +set-value@^2.0.0, set-value@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.1.tgz#a18d40530e6f07de4228c7defe4227af8cad005b" + integrity sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw== dependencies: extend-shallow "^2.0.1" is-extendable "^0.1.1" @@ -2862,34 +3225,43 @@ set-value@^2.0.0: shebang-command@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo= dependencies: shebang-regex "^1.0.0" shebang-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= slash@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" + integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== slice-ansi@0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" + integrity sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU= -slice-ansi@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d" +slice-ansi@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636" + integrity sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ== dependencies: + ansi-styles "^3.2.0" + astral-regex "^1.0.0" is-fullwidth-code-point "^2.0.0" snapdragon-node@^2.0.1: version "2.1.1" resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" + integrity sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw== dependencies: define-property "^1.0.0" isobject "^3.0.0" @@ -2898,12 +3270,14 @@ snapdragon-node@^2.0.1: snapdragon-util@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/snapdragon-util/-/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" + integrity sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ== dependencies: kind-of "^3.2.0" snapdragon@^0.8.1: version "0.8.2" resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" + integrity sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg== dependencies: base "^0.11.1" debug "^2.2.0" @@ -2917,6 +3291,7 @@ snapdragon@^0.8.1: source-map-resolve@^0.5.0: version "0.5.2" resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259" + integrity sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA== dependencies: atob "^2.1.1" decode-uri-component "^0.2.0" @@ -2927,28 +3302,43 @@ source-map-resolve@^0.5.0: source-map-url@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" + integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM= source-map@^0.5.0, source-map@^0.5.6: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= -spdx-correct@~1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40" +spdx-correct@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.0.tgz#fb83e504445268f154b074e218c87c003cd31df4" + integrity sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q== dependencies: - spdx-license-ids "^1.0.2" + spdx-expression-parse "^3.0.0" + spdx-license-ids "^3.0.0" -spdx-expression-parse@~1.0.0: - version "1.0.4" - resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz#9bdf2f20e1f40ed447fbe273266191fced51626c" +spdx-exceptions@^2.1.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz#2ea450aee74f2a89bfb94519c07fcd6f41322977" + integrity sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA== + +spdx-expression-parse@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz#99e119b7a5da00e05491c9fa338b7904823b41d0" + integrity sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg== + dependencies: + spdx-exceptions "^2.1.0" + spdx-license-ids "^3.0.0" -spdx-license-ids@^1.0.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz#c9df7a3424594ade6bd11900d596696dc06bac57" +spdx-license-ids@^3.0.0: + version "3.0.5" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz#3694b5804567a458d3c8045842a6358632f62654" + integrity sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q== split-string@^3.0.1, split-string@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" + integrity sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw== dependencies: extend-shallow "^3.0.0" @@ -2960,10 +3350,12 @@ sprintf-js@~1.0.2: staged-git-files@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/staged-git-files/-/staged-git-files-1.1.1.tgz#37c2218ef0d6d26178b1310719309a16a59f8f7b" + integrity sha512-H89UNKr1rQJvI1c/PIR3kiAMBV23yvR7LItZiV74HWZwzt7f3YHuujJ9nJZlt58WlFox7XQsOahexwk7nTe69A== static-extend@^0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" + integrity sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY= dependencies: define-property "^0.2.5" object-copy "^0.1.0" @@ -2971,112 +3363,146 @@ static-extend@^0.1.1: string-argv@^0.0.2: version "0.0.2" resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.0.2.tgz#dac30408690c21f3c3630a3ff3a05877bdcbd736" + integrity sha1-2sMECGkMIfPDYwo/86BYd73L1zY= string-width@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= dependencies: code-point-at "^1.0.0" is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -string-width@^2.1.0, string-width@^2.1.1: +"string-width@^1.0.2 || 2", string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== dependencies: is-fullwidth-code-point "^2.0.0" strip-ansi "^4.0.0" +string-width@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" + integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== + dependencies: + emoji-regex "^7.0.1" + is-fullwidth-code-point "^2.0.0" + strip-ansi "^5.1.0" + stringify-object@^3.2.2: - version "3.2.2" - resolved "https://registry.yarnpkg.com/stringify-object/-/stringify-object-3.2.2.tgz#9853052e5a88fb605a44cd27445aa257ad7ffbcd" + version "3.3.0" + resolved "https://registry.yarnpkg.com/stringify-object/-/stringify-object-3.3.0.tgz#703065aefca19300d3ce88af4f5b3956d7556629" + integrity sha512-rHqiFh1elqCQ9WPLIC8I0Q/g/wj5J1eMkyoiD6eoQApWHP0FtlK7rqnhmabL5VUY9JQCcqwwvlOaSuutekgyrw== dependencies: - get-own-enumerable-property-symbols "^2.0.1" + get-own-enumerable-property-symbols "^3.0.0" is-obj "^1.0.1" is-regexp "^1.0.0" strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= dependencies: ansi-regex "^2.0.0" strip-ansi@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= dependencies: ansi-regex "^3.0.0" +strip-ansi@^5.1.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" + integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== + dependencies: + ansi-regex "^4.1.0" + strip-bom@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM= strip-eof@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= -strip-json-comments@^2.0.1: +strip-json-comments@2.0.1, strip-json-comments@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= -supports-color@4.4.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.4.0.tgz#883f7ddabc165142b2a61427f3352ded195d1a3e" +supports-color@6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-6.0.0.tgz#76cfe742cf1f41bb9b1c29ad03068c05b4c0e40a" + integrity sha512-on9Kwidc1IUQo+bQdhi8+Tijpo0e1SS6RoGo2guUwn5vdaxw8RXOF9Vb2ws+ihWOmh4JnCJOvaziZWP1VABaLg== dependencies: - has-flag "^2.0.0" + has-flag "^3.0.0" supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" + integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc= supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== dependencies: has-flag "^3.0.0" symbol-observable@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" + integrity sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ== -table@^4.0.3: - version "4.0.3" - resolved "https://registry.npmjs.org/table/-/table-4.0.3.tgz#00b5e2b602f1794b9acaf9ca908a76386a7813bc" +table@^5.2.3: + version "5.4.1" + resolved "https://registry.yarnpkg.com/table/-/table-5.4.1.tgz#0691ae2ebe8259858efb63e550b6d5f9300171e8" + integrity sha512-E6CK1/pZe2N75rGZQotFOdmzWQ1AILtgYbMAbAjvms0S1l5IDB47zG3nCnFGB/w+7nB3vKofbLXCH7HPBo864w== dependencies: - ajv "^6.0.1" - ajv-keywords "^3.0.0" - chalk "^2.1.0" - lodash "^4.17.4" - slice-ansi "1.0.0" - string-width "^2.1.1" + ajv "^6.9.1" + lodash "^4.17.11" + slice-ansi "^2.1.0" + string-width "^3.0.0" text-table@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= through@^2.3.6: version "2.3.8" - resolved "http://registry.npm.taobao.org/through/download/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= tmp@^0.0.33: version "0.0.33" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" + integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== dependencies: os-tmpdir "~1.0.2" to-fast-properties@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4= to-object-path@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" + integrity sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68= dependencies: kind-of "^3.0.2" to-regex-range@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" + integrity sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg= dependencies: is-number "^3.0.0" repeat-string "^1.6.1" @@ -3084,6 +3510,7 @@ to-regex-range@^2.1.0: to-regex@^3.0.1, to-regex@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" + integrity sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw== dependencies: define-property "^2.0.2" extend-shallow "^3.0.2" @@ -3093,14 +3520,17 @@ to-regex@^3.0.1, to-regex@^3.0.2: trim-right@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" + integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM= tslib@^1.9.0: - version "1.9.3" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" + version "1.10.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" + integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== type-check@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" + integrity sha1-WITKtRLPHTVeP7eE8wgEsrUg23I= dependencies: prelude-ls "~1.1.2" @@ -3117,28 +3547,30 @@ unicode-match-property-ecmascript@^1.0.4: unicode-canonical-property-names-ecmascript "^1.0.4" unicode-property-aliases-ecmascript "^1.0.4" -unicode-match-property-value-ecmascript@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.0.2.tgz#9f1dc76926d6ccf452310564fd834ace059663d4" - integrity sha512-Rx7yODZC1L/T8XKo/2kNzVAQaRE88AaMvI1EF/Xnj3GW2wzN6fop9DDWuFAKUVFH7vozkz26DzP0qyWLKLIVPQ== +unicode-match-property-value-ecmascript@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.1.0.tgz#5b4b426e08d13a80365e0d657ac7a6c1ec46a277" + integrity sha512-hDTHvaBk3RmFzvSl0UVrUmC3PuW9wKVnpoUDYH0JDkSIovzw+J5viQmeYHxVSBptubnr7PbH2e0fnpDRQnQl5g== unicode-property-aliases-ecmascript@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.0.4.tgz#5a533f31b4317ea76f17d807fa0d116546111dd0" - integrity sha512-2WSLa6OdYd2ng8oqiGIWnJqyFArvhn+5vgx5GTxMbUYjCYKUcuKS62YLFF0R/BDGlB1yzXjQOLtPAfHsgirEpg== + version "1.0.5" + resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.0.5.tgz#a9cc6cc7ce63a0a3023fc99e341b94431d405a57" + integrity sha512-L5RAqCfXqAwR3RriF8pM0lU0w4Ryf/GgzONwi6KnL1taJQa7x1TCxdJnILX59WIGOwR57IVxn7Nej0fz1Ny6fw== union-value@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.0.tgz#5c71c34cb5bad5dcebe3ea0cd08207ba5aa1aea4" + version "1.0.1" + resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847" + integrity sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg== dependencies: arr-union "^3.1.0" get-value "^2.0.6" is-extendable "^0.1.1" - set-value "^0.4.3" + set-value "^2.0.1" unset-value@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" + integrity sha1-g3aHP30jNRef+x5vw6jtDfyKtVk= dependencies: has-value "^0.3.1" isobject "^3.0.0" @@ -3146,44 +3578,154 @@ unset-value@^1.0.0: uri-js@^4.2.2: version "4.2.2" resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" + integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ== dependencies: punycode "^2.1.0" urix@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" + integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= use@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" + integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== validate-npm-package-license@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz#2804babe712ad3379459acfbe24746ab2c303fbc" + version "3.0.4" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" + integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew== dependencies: - spdx-correct "~1.0.0" - spdx-expression-parse "~1.0.0" + spdx-correct "^3.0.0" + spdx-expression-parse "^3.0.0" -which@^1.2.10, which@^1.2.9: +which-module@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" + integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= + +which@1.3.1, which@^1.2.10, which@^1.2.9: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" + integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== dependencies: isexe "^2.0.0" +wide-align@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" + integrity sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA== + dependencies: + string-width "^1.0.2 || 2" + wordwrap@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus= + +wrap-ansi@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" + integrity sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU= + dependencies: + string-width "^1.0.1" + strip-ansi "^3.0.1" + +wrap-ansi@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-3.0.1.tgz#288a04d87eda5c286e060dfe8f135ce8d007f8ba" + integrity sha1-KIoE2H7aXChuBg3+jxNc6NAH+Lo= + dependencies: + string-width "^2.1.1" + strip-ansi "^4.0.0" wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= -write@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" +write@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/write/-/write-1.0.3.tgz#0800e14523b923a387e415123c865616aae0f5c3" + integrity sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig== dependencies: mkdirp "^0.5.1" +"y18n@^3.2.1 || ^4.0.0", y18n@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" + integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== + yallist@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" + integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI= + +yargs-parser@13.0.0: + version "13.0.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.0.0.tgz#3fc44f3e76a8bdb1cc3602e860108602e5ccde8b" + integrity sha512-w2LXjoL8oRdRQN+hOyppuXs+V/fVAYtpcrRxZuF7Kt/Oc+Jr2uAcVntaUTNT6w5ihoWfFDpNY8CPx1QskxZ/pw== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + +yargs-parser@^11.1.1: + version "11.1.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-11.1.1.tgz#879a0865973bca9f6bab5cbdf3b1c67ec7d3bcf4" + integrity sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + +yargs-parser@^13.0.0: + version "13.1.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.1.tgz#d26058532aa06d365fe091f6a1fc06b2f7e5eca0" + integrity sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + +yargs-unparser@1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-1.5.0.tgz#f2bb2a7e83cbc87bb95c8e572828a06c9add6e0d" + integrity sha512-HK25qidFTCVuj/D1VfNiEndpLIeJN78aqgR23nL3y4N0U/91cOAzqfHlF8n2BvoNDcZmJKin3ddNSvOxSr8flw== + dependencies: + flat "^4.1.0" + lodash "^4.17.11" + yargs "^12.0.5" + +yargs@13.2.2: + version "13.2.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.2.2.tgz#0c101f580ae95cea7f39d927e7770e3fdc97f993" + integrity sha512-WyEoxgyTD3w5XRpAQNYUB9ycVH/PQrToaTXdYXRdOXvEy1l19br+VJsc0vcO8PTGg5ro/l/GY7F/JMEBmI0BxA== + dependencies: + cliui "^4.0.0" + find-up "^3.0.0" + get-caller-file "^2.0.1" + os-locale "^3.1.0" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^3.0.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^13.0.0" + +yargs@^12.0.5: + version "12.0.5" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.5.tgz#05f5997b609647b64f66b81e3b4b10a368e7ad13" + integrity sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw== + dependencies: + cliui "^4.0.0" + decamelize "^1.2.0" + find-up "^3.0.0" + get-caller-file "^1.0.1" + os-locale "^3.0.0" + require-directory "^2.1.1" + require-main-filename "^1.0.1" + set-blocking "^2.0.0" + string-width "^2.0.0" + which-module "^2.0.0" + y18n "^3.2.1 || ^4.0.0" + yargs-parser "^11.1.1" From 6b3e9e3f1e857507ce2b826288e5c3dccf8cf693 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Aug 2019 21:16:13 -0500 Subject: [PATCH 468/569] Bump eslint-utils from 1.4.0 to 1.4.2 (babel/babel-eslint#796) Bumps [eslint-utils](https://github.com/mysticatea/eslint-utils) from 1.4.0 to 1.4.2. - [Release notes](https://github.com/mysticatea/eslint-utils/releases) - [Commits](https://github.com/mysticatea/eslint-utils/compare/v1.4.0...v1.4.2) Signed-off-by: dependabot[bot] --- eslint/babel-eslint-parser/yarn.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index 73f0201860e2..d07a7c381491 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -1477,16 +1477,16 @@ eslint-scope@^4.0.3: estraverse "^4.1.1" eslint-utils@^1.3.1: - version "1.4.0" - resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.0.tgz#e2c3c8dba768425f897cf0f9e51fe2e241485d4c" - integrity sha512-7ehnzPaP5IIEh1r1tkjuIrxqhNkzUJa9z3R92tLJdZIVdWaczEhr3EbhGtsMrVxi1KeR8qA7Off6SWc5WNQqyQ== + version "1.4.2" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.2.tgz#166a5180ef6ab7eb462f162fd0e6f2463d7309ab" + integrity sha512-eAZS2sEUMlIeCjBeubdj45dmBHQwPHWyBcT1VSYB7o9x9WRRqKxyUoiXlRjyAwzN7YEzHJlYg0NmzDRWx6GP4Q== dependencies: eslint-visitor-keys "^1.0.0" eslint-visitor-keys@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" - integrity sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ== + version "1.1.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2" + integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A== eslint@^6.0.1: version "6.0.1" From 3396fdd7f7aff3c50e6fb9388b1e40cfc333e5e7 Mon Sep 17 00:00:00 2001 From: Chiawen Chen Date: Sat, 2 Nov 2019 07:08:32 +0800 Subject: [PATCH 469/569] Breaking: make AST match Espree 6 (babel/babel-eslint#785) --- .../lib/babylon-to-espree/convertAST.js | 20 --------------- eslint/babel-eslint-parser/package.json | 2 +- .../test/specs/babel-eslint.js | 4 ++- eslint/babel-eslint-parser/yarn.lock | 25 ------------------- 4 files changed, 4 insertions(+), 47 deletions(-) diff --git a/eslint/babel-eslint-parser/lib/babylon-to-espree/convertAST.js b/eslint/babel-eslint-parser/lib/babylon-to-espree/convertAST.js index 0ef37750d7ab..9f2fb000b920 100644 --- a/eslint/babel-eslint-parser/lib/babylon-to-espree/convertAST.js +++ b/eslint/babel-eslint-parser/lib/babylon-to-espree/convertAST.js @@ -47,26 +47,6 @@ const astTransformVisitor = { exit(path) { const node = path.node; - if (path.isJSXText()) { - node.type = "Literal"; - } - - if ( - path.isRestElement() && - path.parent && - path.parent.type === "ObjectPattern" - ) { - node.type = "ExperimentalRestProperty"; - } - - if ( - path.isSpreadElement() && - path.parent && - path.parent.type === "ObjectExpression" - ) { - node.type = "ExperimentalSpreadProperty"; - } - if (path.isTypeParameter()) { node.type = "Identifier"; node.typeAnnotation = node.bound; diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 7ba87298d99b..f0369ede4ede 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -59,7 +59,7 @@ "eslint-plugin-flowtype": "^3.11.1", "eslint-plugin-import": "^2.14.0", "eslint-plugin-prettier": "^3.1.0", - "espree": "^3.5.2", + "espree": "^6.0.0", "husky": "^1.0.0-rc.13", "lint-staged": "^7.2.2", "mocha": "^6.1.4", diff --git a/eslint/babel-eslint-parser/test/specs/babel-eslint.js b/eslint/babel-eslint-parser/test/specs/babel-eslint.js index dd83cc7831a9..7dedf3819243 100644 --- a/eslint/babel-eslint-parser/test/specs/babel-eslint.js +++ b/eslint/babel-eslint-parser/test/specs/babel-eslint.js @@ -451,7 +451,9 @@ describe("babylon-to-espree", () => { }); it("super outside method", () => { - parseAndAssertSame("function F() { super(); }"); + assert.throws(() => { + parseAndAssertSame("function F() { super(); }"); + }, /SyntaxError: 'super' keyword outside a method/); }); it("StringLiteral", () => { diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index d07a7c381491..dbb24b80454f 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -835,28 +835,11 @@ dependencies: any-observable "^0.3.0" -acorn-jsx@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" - integrity sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s= - dependencies: - acorn "^3.0.4" - acorn-jsx@^5.0.0: version "5.0.1" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.1.tgz#32a064fd925429216a09b141102bfdd185fae40e" integrity sha512-HJ7CfNHrfJLlNTzIEUTj43LNWGkqpRLxm3YjAlcD0ACydk9XynzYsCBHxut+iqt+1aBXkx9UP/w/ZqMr13XIzg== -acorn@^3.0.4: - version "3.3.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" - integrity sha1-ReN/s56No/JbruP/U2niu18iAXo= - -acorn@^5.5.0: - version "5.7.3" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" - integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== - acorn@^6.0.7: version "6.2.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.2.0.tgz#67f0da2fc339d6cfb5d6fb244fd449f33cd8bbe3" @@ -1530,14 +1513,6 @@ eslint@^6.0.1: table "^5.2.3" text-table "^0.2.0" -espree@^3.5.2: - version "3.5.4" - resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.4.tgz#b0f447187c8a8bed944b815a660bddf5deb5d1a7" - integrity sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A== - dependencies: - acorn "^5.5.0" - acorn-jsx "^3.0.0" - espree@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/espree/-/espree-6.0.0.tgz#716fc1f5a245ef5b9a7fdb1d7b0d3f02322e75f6" From 5b35722d632b01691682e546209757f35df09d7a Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Fri, 1 Nov 2019 18:08:47 -0500 Subject: [PATCH 470/569] Bump semver@6 (babel/babel-eslint#802) --- eslint/babel-eslint-parser/package.json | 2 +- eslint/babel-eslint-parser/yarn.lock | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index f0369ede4ede..3a5d1d282b74 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -35,7 +35,7 @@ "dependencies": { "eslint-scope": "3.7.1", "eslint-visitor-keys": "^1.0.0", - "semver": "^5.6.0" + "semver": "^6.3.0" }, "devDependencies": { "@babel/core": "^7.2.0", diff --git a/eslint/babel-eslint-parser/yarn.lock b/eslint/babel-eslint-parser/yarn.lock index dbb24b80454f..aab080f5cb3f 100644 --- a/eslint/babel-eslint-parser/yarn.lock +++ b/eslint/babel-eslint-parser/yarn.lock @@ -3172,7 +3172,7 @@ semver-compare@^1.0.0: resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc" integrity sha1-De4hahyUGrN+nvsXiPavxf9VN/w= -"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0, semver@^5.7.0: +"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.7.0: version "5.7.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b" integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA== @@ -3182,6 +3182,11 @@ semver@^6.1.1: resolved "https://registry.yarnpkg.com/semver/-/semver-6.2.0.tgz#4d813d9590aaf8a9192693d6c85b9344de5901db" integrity sha512-jdFC1VdUGT/2Scgbimf7FSx9iJLXoqfglSF+gJeuNWVpiE37OIbc1jywR/GJyFdz3mnkz2/id0L0J/cr0izR5A== +semver@^6.3.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" + integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + set-blocking@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" From c442efa7c5a44f19f321a3d6aa839118081ef75b Mon Sep 17 00:00:00 2001 From: jquense Date: Fri, 19 Jun 2015 00:01:10 -0400 Subject: [PATCH 471/569] Initial --- eslint/babel-eslint-plugin/.gitignore | 1 + eslint/babel-eslint-plugin/.travis.yml | 7 + eslint/babel-eslint-plugin/LICENSE | 23 + eslint/babel-eslint-plugin/README.md | 38 + eslint/babel-eslint-plugin/helpers.js | 15 + eslint/babel-eslint-plugin/index.js | 8 + eslint/babel-eslint-plugin/package.json | 37 + .../rules/generator-star-spacing.js | 92 +++ .../rules/generator-star.js | 84 +++ .../rules/object-shorthand.js | 73 ++ .../tests/generator-star-spacing.js | 680 ++++++++++++++++++ .../tests/generator-star.js | 32 + .../tests/object-shorthand.js | 100 +++ 13 files changed, 1190 insertions(+) create mode 100644 eslint/babel-eslint-plugin/.gitignore create mode 100644 eslint/babel-eslint-plugin/.travis.yml create mode 100644 eslint/babel-eslint-plugin/LICENSE create mode 100644 eslint/babel-eslint-plugin/README.md create mode 100644 eslint/babel-eslint-plugin/helpers.js create mode 100644 eslint/babel-eslint-plugin/index.js create mode 100644 eslint/babel-eslint-plugin/package.json create mode 100644 eslint/babel-eslint-plugin/rules/generator-star-spacing.js create mode 100644 eslint/babel-eslint-plugin/rules/generator-star.js create mode 100644 eslint/babel-eslint-plugin/rules/object-shorthand.js create mode 100644 eslint/babel-eslint-plugin/tests/generator-star-spacing.js create mode 100644 eslint/babel-eslint-plugin/tests/generator-star.js create mode 100644 eslint/babel-eslint-plugin/tests/object-shorthand.js diff --git a/eslint/babel-eslint-plugin/.gitignore b/eslint/babel-eslint-plugin/.gitignore new file mode 100644 index 000000000000..3c3629e647f5 --- /dev/null +++ b/eslint/babel-eslint-plugin/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/eslint/babel-eslint-plugin/.travis.yml b/eslint/babel-eslint-plugin/.travis.yml new file mode 100644 index 000000000000..5a7ce2a7f99e --- /dev/null +++ b/eslint/babel-eslint-plugin/.travis.yml @@ -0,0 +1,7 @@ +--- +git: + depth: 1 +language: node_js +node_js: + - '0.12' + - 'io.js' \ No newline at end of file diff --git a/eslint/babel-eslint-plugin/LICENSE b/eslint/babel-eslint-plugin/LICENSE new file mode 100644 index 000000000000..3d0e2f3067b8 --- /dev/null +++ b/eslint/babel-eslint-plugin/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2014-2015 Jason Quense +Original work by respective rule authors; copywrites noted in files. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md new file mode 100644 index 000000000000..5de7ba997ef2 --- /dev/null +++ b/eslint/babel-eslint-plugin/README.md @@ -0,0 +1,38 @@ +# eslint-plugin-babel + +An eslint plugin companion to babel-eslint. babel-eslint does a great job of adapting the eslint parser to valid babel code, it can't change built in rules to deal with the syntactic differences. eslint-plugin-babel reimplements problematic rules to not give false positives or negatives. + +### Install + +```sh +npm install eslint-plugin-babel -S +``` + +enable the plugin by adjusting your `.eslintrc` file to include the plugin: + +```json +{ + "plugins": [ + "babel" + ] +} +``` + +Finally enable all the rules you like to use (remember to disable the originals as well!). + +```json +{ + "rules": { + "babel/object-shorthand": 1, + "babel/generator-star": 1, + "babel/generator-star-spacing": 1, + } +} +``` +### Rules + +Each rule cooresponds to a core eslint rule, and has the same options. + +- `babel/object-shorthand`: doesn't fail when using object spread (`...obj`) +- `babel/generator-star`: Handles async/await functions correctly +- `babel/generator-star-spacing`: Handles async/await functions correctly diff --git a/eslint/babel-eslint-plugin/helpers.js b/eslint/babel-eslint-plugin/helpers.js new file mode 100644 index 000000000000..77f42a3bf404 --- /dev/null +++ b/eslint/babel-eslint-plugin/helpers.js @@ -0,0 +1,15 @@ +var _parse = require('babel-core').parse; + +module.exports = { + parse: function(code){ + var ast = null + try { + ast = _parse(code, { locations: true, ranges: true }).body[0] //unwrap body + } + catch (err){ + console.warn(err) + } + + return ast + } +} \ No newline at end of file diff --git a/eslint/babel-eslint-plugin/index.js b/eslint/babel-eslint-plugin/index.js new file mode 100644 index 000000000000..86fbe85988ba --- /dev/null +++ b/eslint/babel-eslint-plugin/index.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = { + rules: { + 'object-shorthand': require('./rules/object-shorthand'), + 'generator-star': require('./rules/object-shorthand') + } +}; diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json new file mode 100644 index 000000000000..39201ad510a1 --- /dev/null +++ b/eslint/babel-eslint-plugin/package.json @@ -0,0 +1,37 @@ +{ + "name": "eslint-plugin-babel", + "version": "1.0.0", + "description": "eslint rule plugin companion to babel-eslint", + "main": "index.js", + "scripts": { + "test": "mocha -R spec ./tests/*.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/babel/eslint-plugin-babel.git" + }, + "keywords": [ + "babel", + "eslint", + "eslintplugin", + "babel-eslint" + ], + "author": "jquense @monasticpanic", + "license": "MIT", + "bugs": { + "url": "https://github.com/babel/eslint-plugin-babel/issues" + }, + "homepage": "https://github.com/babel/eslint-plugin-babel#readme", + "devDependencies": { + "babel-eslint": "^3.1.17", + "eslint": "^0.23.0", + "eslint-tester": "^0.8.0", + "is-my-json-valid": "^2.12.0", + "mocha": "^2.2.5", + "mocha-phantomjs": "^3.5.3", + "phantomjs": "^1.9.17" + }, + "dependencies": { + "babel-core": "^5.5.8" + } +} diff --git a/eslint/babel-eslint-plugin/rules/generator-star-spacing.js b/eslint/babel-eslint-plugin/rules/generator-star-spacing.js new file mode 100644 index 000000000000..b122ed19c8b1 --- /dev/null +++ b/eslint/babel-eslint-plugin/rules/generator-star-spacing.js @@ -0,0 +1,92 @@ +/** + * @fileoverview Rule to check the spacing around the * in generator functions. + * @author Jamund Ferguson + * @copyright 2015 Brandon Mills. All rights reserved. + * @copyright 2014 Jamund Ferguson. All rights reserved. + */ + +"use strict"; + +module.exports = function(context) { + + var mode = { + before: { before: true, after: false }, + after: { before: false, after: true }, + both: { before: true, after: true }, + neither: { before: false, after: false } + }[context.options[0] || "before"]; + + function isAsyncGenerator(node){ + return context.getFirstToken(node, 2).value === '*' + } + + /** + * Checks the spacing between two tokens before or after the star token. + * @param {string} side Either "before" or "after". + * @param {Token} leftToken `function` keyword token if side is "before", or + * star token if side is "after". + * @param {Token} rightToken Star token if side is "before", or identifier + * token if side is "after". + * @returns {void} + */ + function checkSpacing(side, leftToken, rightToken) { + if (!!(rightToken.range[0] - leftToken.range[1]) !== mode[side]) { + context.report( + leftToken.value === "*" ? leftToken : rightToken, + "{{type}} space {{side}} *.", + { + type: mode[side] ? "Missing" : "Unexpected", + side: side + } + ); + } + } + + /** + * Enforces the spacing around the star if node is a generator function. + * @param {ASTNode} node A function expression or declaration node. + * @returns {void} + */ + function checkFunction(node) { + var first = context.getFirstToken(node) + , isMethod = node.parent.method || node.parent.type === "MethodDefinition" + , isAsync = first.value === 'async'; + + var prevToken, starToken, nextToken; + + + if ( !node.generator || (isAsync && !isAsyncGenerator(node))) { + return; + } + + if (isMethod) { + starToken = context.getTokenBefore(node, 1); + } else { + starToken = context.getFirstToken(node, isAsync ? 2 : 1); + } + + // Only check before when preceded by `function` keyword + prevToken = context.getTokenBefore(starToken); + if (prevToken.value === "function" || prevToken.value === "static") { + checkSpacing("before", prevToken, starToken); + } + + // Only check after when followed by an identifier + nextToken = context.getTokenAfter(starToken); + if (nextToken.type === "Identifier") { + checkSpacing("after", starToken, nextToken); + } + } + + return { + "FunctionDeclaration": checkFunction, + "FunctionExpression": checkFunction + }; + +}; + +module.exports.schema = [ + { + "enum": ["before", "after", "both", "neither"] + } +]; \ No newline at end of file diff --git a/eslint/babel-eslint-plugin/rules/generator-star.js b/eslint/babel-eslint-plugin/rules/generator-star.js new file mode 100644 index 000000000000..b5247f4f6880 --- /dev/null +++ b/eslint/babel-eslint-plugin/rules/generator-star.js @@ -0,0 +1,84 @@ +/** + * @fileoverview Rule to check for the position of the * in your generator functions + * @author Jamund Ferguson + * @copyright 2014 Jamund Ferguson. All rights reserved. + */ + +"use strict"; + +var parse = require('../helpers').parse + +module.exports = function(context) { + + var position = context.options[0] || "end"; + + function isAsyncGenerator(node){ + return context.getFirstToken(node, 2).value === '*' + } + + /** + * Check the position of the star compared to the expected position. + * @param {ASTNode} node - the entire function node + * @returns {void} + */ + function checkStarPosition(node) { + + var first = context.getFirstToken(node) + , isAsync = first.value === 'async' + , starToken; + + + if (!node.generator || (isAsync && !isAsyncGenerator(node))) { + return; + } + + // Blocked, pending decision to fix or work around in eslint/espree#36 + if (context.getAncestors().pop().method) { + return; + } + + starToken = context.getFirstToken(node, isAsync ? 2 : 1); + + //console.log(declaration, starToken) + + // check for function *name() {} + if (position === "end") { + if (starToken.range[1] !== context.getTokenAfter(starToken).range[0]) { + // * starts where the next identifier begins + context.report(node, "Expected a space before *."); + } + } + + // check for function* name() {} + if (position === "start") { + + // * begins where the previous identifier ends + if (starToken.range[0] !== context.getTokenBefore(starToken).range[1]) { + context.report(node, "Expected no space before *."); + } + } + + // check for function * name() {} + if (position === "middle") { + + // must be a space before and afer the * + if (starToken.range[0] <= context.getTokenBefore(starToken).range[1] || + starToken.range[1] >= context.getTokenAfter(starToken).range[0]) { + context.report(node, "Expected spaces around *."); + } + } + + } + + return { + "FunctionDeclaration": checkStarPosition, + "FunctionExpression": checkStarPosition + }; + +}; + +module.exports.schema = [ + { + "enum": ["start", "middle", "end"] + } +]; \ No newline at end of file diff --git a/eslint/babel-eslint-plugin/rules/object-shorthand.js b/eslint/babel-eslint-plugin/rules/object-shorthand.js new file mode 100644 index 000000000000..e584bfb684c9 --- /dev/null +++ b/eslint/babel-eslint-plugin/rules/object-shorthand.js @@ -0,0 +1,73 @@ + +/** + * @fileoverview Rule to enforce concise object methods and properties. + * @author Jamund Ferguson + * @copyright 2015 Jamund Ferguson. All rights reserved. + */ + +'use strict'; + +var OPTIONS = { + always: 'always', + never: 'never', + methods: 'methods', + properties: 'properties' + }; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var APPLY = context.options[0] || OPTIONS.always; + var APPLY_TO_METHODS = APPLY === OPTIONS.methods || APPLY === OPTIONS.always; + var APPLY_TO_PROPS = APPLY === OPTIONS.properties || APPLY === OPTIONS.always; + var APPLY_NEVER = APPLY === OPTIONS.never; + + return { + Property: function(node) { + var isConciseProperty = node.method || node.shorthand + , isSpreadProperty = !!this.getSource(node).match(/^\.\.\./) + , type; + + // if we're 'never' and concise we should warn now + if (APPLY_NEVER && isConciseProperty) { + type = node.method ? 'method' : 'property'; + context.report(node, 'Expected longform ' + type + ' syntax.'); + } + + // at this point if we're concise or if we're 'never' we can leave + if (APPLY_NEVER || isConciseProperty) { + return; + } + + if (node.kind === 'get' || node.kind === 'set') { + return; + } + + if (isSpreadProperty) { + return; + } + + if (node.value.type === 'FunctionExpression' && node.value.id == null && APPLY_TO_METHODS) { + // {x: function(){}} should be written as {x() {}} + context.report(node, 'Expected method shorthand.'); + } + else if (node.value.type === 'Identifier' && node.key.name === node.value.name && APPLY_TO_PROPS) { + // {x: x} should be written as {x} + context.report(node, 'Expected property shorthand.'); + } + else if (node.value.type === 'Identifier' && node.key.type === 'Literal' && node.key.value === node.value.name && APPLY_TO_PROPS) { + // {'x': x} should be written as {x} + context.report(node, 'Expected property shorthand.'); + } + } + }; +}; + +module.exports.schema = [ + { + 'enum': ['always', 'methods', 'properties', 'never'] + } +]; diff --git a/eslint/babel-eslint-plugin/tests/generator-star-spacing.js b/eslint/babel-eslint-plugin/tests/generator-star-spacing.js new file mode 100644 index 000000000000..4de1141b1023 --- /dev/null +++ b/eslint/babel-eslint-plugin/tests/generator-star-spacing.js @@ -0,0 +1,680 @@ +/* eslint-disable */ +var linter = require('eslint').linter + , ESLintTester = require('eslint-tester') + , eslintTester = new ESLintTester(linter); + +var features = { + generators: true +}; + +function ok(code, args){ + return { code: code, args: args, parser: 'babel-eslint', ecmaFeatures: features } +} + +function err(code, errors, args){ + var e = ok(code, args) + e.errors = errors + return e +} + +var features = { + generators: true +}; + +function ok(code, args){ + return { code: code, args: args, parser: 'babel-eslint', ecmaFeatures: features } +} + +function err(code, errors, args){ + var e = ok(code, args) + e.errors = errors + return e +} + + +eslintTester.addRuleTest('rules/generator-star-spacing', { + valid: [ + ok('var test = async function(){}'), + ok('async function test(){}'), + ok('var test = async function *(){}'), + ok('async function *test(){}', [1, "before"]) , + ok('async function* test(){}', [1, "after"]), + ok('async function * test(){}', [1, "both"]), + ok('async function*test(){}', [1, "neither"]), + { + code: "function foo(){}" + }, + { + code: "function *foo(){}", + ecmaFeatures: { generators: true } + }, + { + code: "function *foo(arg1, arg2){}", + ecmaFeatures: { generators: true } + }, + { + code: "var foo = function *foo(){};", + ecmaFeatures: { generators: true } + }, + { + code: "var foo = function *(){};", + ecmaFeatures: { generators: true } + }, + { + code: "var foo = function * (){};", + ecmaFeatures: { generators: true } + }, + { + code: "var foo = { *foo(){} };", + ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } + }, + { + code: "var foo = {*foo(){} };", + ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } + }, + { + code: "class Foo { *foo(){} }", + ecmaFeatures: { classes: true, generators: true } + }, + { + code: "class Foo {*foo(){} }", + ecmaFeatures: { classes: true, generators: true } + }, + { + code: "class Foo { static *foo(){} }", + ecmaFeatures: { classes: true, generators: true } + }, + + // "before" + { + code: "function foo(){}", + args: [2, "before"] + }, + { + code: "function *foo(){}", + args: [2, "before"], + ecmaFeatures: { generators: true } + }, + { + code: "function *foo(arg1, arg2){}", + args: [2, "before"], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = function *foo(){};", + args: [2, "before"], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = function *(){};", + args: [2, "before"], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = function * (){};", + args: [2, "before"], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = { *foo(){} };", + args: [2, "before"], + ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } + }, + { + code: "var foo = {*foo(){} };", + args: [2, "before"], + ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } + }, + { + code: "class Foo { *foo(){} }", + args: [2, "before"], + ecmaFeatures: { classes: true, generators: true } + }, + { + code: "class Foo {*foo(){} }", + args: [2, "before"], + ecmaFeatures: { classes: true, generators: true } + }, + { + code: "class Foo { static *foo(){} }", + args: [2, "before"], + ecmaFeatures: { classes: true, generators: true } + }, + + // "after" + { + code: "function foo(){}", + args: [2, "after"] + }, + { + code: "function* foo(){}", + args: [2, "after"], + ecmaFeatures: { generators: true } + }, + { + code: "function* foo(arg1, arg2){}", + args: [2, "after"], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = function* foo(){};", + args: [2, "after"], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = function* (){};", + args: [2, "after"], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = function*(){};", + args: [2, "after"], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = {* foo(){} };", + args: [2, "after"], + ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } + }, + { + code: "var foo = { * foo(){} };", + args: [2, "after"], + ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } + }, + { + code: "class Foo {* foo(){} }", + args: [2, "after"], + ecmaFeatures: { classes: true, generators: true } + }, + { + code: "class Foo { * foo(){} }", + args: [2, "after"], + ecmaFeatures: { classes: true, generators: true } + }, + { + code: "class Foo { static* foo(){} }", + args: [2, "after"], + ecmaFeatures: { classes: true, generators: true } + }, + + // "both" + { + code: "function foo(){}", + args: [2, "both"] + }, + { + code: "function * foo(){}", + args: [2, "both"], + ecmaFeatures: { generators: true } + }, + { + code: "function * foo(arg1, arg2){}", + args: [2, "both"], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = function * foo(){};", + args: [2, "both"], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = function * (){};", + args: [2, "both"], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = function *(){};", + args: [2, "both"], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = { * foo(){} };", + args: [2, "both"], + ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } + }, + { + code: "var foo = {* foo(){} };", + args: [2, "both"], + ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } + }, + { + code: "class Foo { * foo(){} }", + args: [2, "both"], + ecmaFeatures: { classes: true, generators: true } + }, + { + code: "class Foo {* foo(){} }", + args: [2, "both"], + ecmaFeatures: { classes: true, generators: true } + }, + { + code: "class Foo { static * foo(){} }", + args: [2, "both"], + ecmaFeatures: { classes: true, generators: true } + }, + + // "neither" + { + code: "function foo(){}", + args: [2, "neither"] + }, + { + code: "function*foo(){}", + args: [2, "neither"], + ecmaFeatures: { generators: true } + }, + { + code: "function*foo(arg1, arg2){}", + args: [2, "neither"], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = function*foo(){};", + args: [2, "neither"], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = function*(){};", + args: [2, "neither"], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = function* (){};", + args: [2, "neither"], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = {*foo(){} };", + args: [2, "neither"], + ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } + }, + { + code: "var foo = { *foo(){} };", + args: [2, "neither"], + ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } + }, + { + code: "class Foo {*foo(){} }", + args: [2, "neither"], + ecmaFeatures: { classes: true, generators: true } + }, + { + code: "class Foo { *foo(){} }", + args: [2, "neither"], + ecmaFeatures: { classes: true, generators: true } + }, + { + code: "class Foo { static*foo(){} }", + args: [2, "neither"], + ecmaFeatures: { classes: true, generators: true } + } + + ], + + invalid: [ + // Default ("before") + err('async function*test(){}', [ + { message: 'Missing space before *.' }, + ]), + err('async function* test(){}', [ + { + message: "Missing space before *.", + type: "Punctuator" + }, { + message: "Unexpected space after *.", + type: "Punctuator" + } + ]), + + { + code: "function*foo(){}", + ecmaFeatures: { generators: true }, + errors: [{ + message: "Missing space before *.", + type: "Punctuator" + }] + }, + { + code: "function* foo(arg1, arg2){}", + ecmaFeatures: { generators: true }, + errors: [{ + message: "Missing space before *.", + type: "Punctuator" + }, { + message: "Unexpected space after *.", + type: "Punctuator" + }] + }, + { + code: "var foo = function*foo(){};", + ecmaFeatures: { generators: true }, + errors: [{ + message: "Missing space before *.", + type: "Punctuator" + }] + }, + { + code: "var foo = function* (){};", + ecmaFeatures: { generators: true }, + errors: [{ + message: "Missing space before *.", + type: "Punctuator" + }] + }, + { + code: "var foo = {* foo(){} };", + ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true }, + errors: [{ + message: "Unexpected space after *.", + type: "Punctuator" + }] + }, + { + code: "class Foo {* foo(){} }", + ecmaFeatures: { classes: true, generators: true }, + errors: [{ + message: "Unexpected space after *.", + type: "Punctuator" + }] + }, + { + code: "class Foo { static* foo(){} }", + ecmaFeatures: { classes: true, generators: true }, + errors: [{ + message: "Missing space before *.", + type: "Punctuator" + }, { + message: "Unexpected space after *.", + type: "Punctuator" + }] + }, + + // "before" + { + code: "function*foo(){}", + args: [2, "before"], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Missing space before *.", + type: "Punctuator" + }] + }, + { + code: "function* foo(arg1, arg2){}", + args: [2, "before"], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Missing space before *.", + type: "Punctuator" + }, { + message: "Unexpected space after *.", + type: "Punctuator" + }] + }, + { + code: "var foo = function*foo(){};", + args: [2, "before"], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Missing space before *.", + type: "Punctuator" + }] + }, + { + code: "var foo = function* (){};", + args: [2, "before"], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Missing space before *.", + type: "Punctuator" + }] + }, + { + code: "var foo = {* foo(){} };", + args: [2, "before"], + ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true }, + errors: [{ + message: "Unexpected space after *.", + type: "Punctuator" + }] + }, + { + code: "class Foo {* foo(){} }", + args: [2, "before"], + ecmaFeatures: { classes: true, generators: true }, + errors: [{ + message: "Unexpected space after *.", + type: "Punctuator" + }] + }, + + // "after" + { + code: "function*foo(){}", + args: [2, "after"], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Missing space after *.", + type: "Punctuator" + }] + }, + { + code: "function *foo(arg1, arg2){}", + args: [2, "after"], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Unexpected space before *.", + type: "Punctuator" + }, { + message: "Missing space after *.", + type: "Punctuator" + }] + }, + { + code: "var foo = function *foo(){};", + args: [2, "after"], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Unexpected space before *.", + type: "Punctuator" + }, { + message: "Missing space after *.", + type: "Punctuator" + }] + }, + { + code: "var foo = function *(){};", + args: [2, "after"], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Unexpected space before *.", + type: "Punctuator" + }] + }, + { + code: "var foo = { *foo(){} };", + args: [2, "after"], + ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true }, + errors: [{ + message: "Missing space after *.", + type: "Punctuator" + }] + }, + { + code: "class Foo { *foo(){} }", + args: [2, "after"], + ecmaFeatures: { classes: true, generators: true }, + errors: [{ + message: "Missing space after *.", + type: "Punctuator" + }] + }, + { + code: "class Foo { static *foo(){} }", + args: [2, "after"], + ecmaFeatures: { classes: true, generators: true }, + errors: [{ + message: "Unexpected space before *.", + type: "Punctuator" + }, { + message: "Missing space after *.", + type: "Punctuator" + }] + }, + + // "both" + { + code: "function*foo(){}", + args: [2, "both"], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Missing space before *.", + type: "Punctuator" + }, { + message: "Missing space after *.", + type: "Punctuator" + }] + }, + { + code: "function*foo(arg1, arg2){}", + args: [2, "both"], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Missing space before *.", + type: "Punctuator" + }, { + message: "Missing space after *.", + type: "Punctuator" + }] + }, + { + code: "var foo = function*foo(){};", + args: [2, "both"], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Missing space before *.", + type: "Punctuator" + }, { + message: "Missing space after *.", + type: "Punctuator" + }] + }, + { + code: "var foo = function*(){};", + args: [2, "both"], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Missing space before *.", + type: "Punctuator" + }] + }, + { + code: "var foo = {*foo(){} };", + args: [2, "both"], + ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true }, + errors: [{ + message: "Missing space after *.", + type: "Punctuator" + }] + }, + { + code: "class Foo {*foo(){} }", + args: [2, "both"], + ecmaFeatures: { classes: true, generators: true }, + errors: [{ + message: "Missing space after *.", + type: "Punctuator" + }] + }, + { + code: "class Foo { static*foo(){} }", + args: [2, "both"], + ecmaFeatures: { classes: true, generators: true }, + errors: [{ + message: "Missing space before *.", + type: "Punctuator" + }, { + message: "Missing space after *.", + type: "Punctuator" + }] + }, + + // "neither" + { + code: "function * foo(){}", + args: [2, "neither"], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Unexpected space before *.", + type: "Punctuator" + }, { + message: "Unexpected space after *.", + type: "Punctuator" + }] + }, + { + code: "function * foo(arg1, arg2){}", + args: [2, "neither"], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Unexpected space before *.", + type: "Punctuator" + }, { + message: "Unexpected space after *.", + type: "Punctuator" + }] + }, + { + code: "var foo = function * foo(){};", + args: [2, "neither"], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Unexpected space before *.", + type: "Punctuator" + }, { + message: "Unexpected space after *.", + type: "Punctuator" + }] + }, + { + code: "var foo = function * (){};", + args: [2, "neither"], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Unexpected space before *.", + type: "Punctuator" + }] + }, + { + code: "var foo = { * foo(){} };", + args: [2, "neither"], + ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true }, + errors: [{ + message: "Unexpected space after *.", + type: "Punctuator" + }] + }, + { + code: "class Foo { * foo(){} }", + args: [2, "neither"], + ecmaFeatures: { classes: true, generators: true }, + errors: [{ + message: "Unexpected space after *.", + type: "Punctuator" + }] + }, + { + code: "class Foo { static * foo(){} }", + args: [2, "neither"], + ecmaFeatures: { classes: true, generators: true }, + errors: [{ + message: "Unexpected space before *.", + type: "Punctuator" + }, { + message: "Unexpected space after *.", + type: "Punctuator" + }] + } + + ] +}); \ No newline at end of file diff --git a/eslint/babel-eslint-plugin/tests/generator-star.js b/eslint/babel-eslint-plugin/tests/generator-star.js new file mode 100644 index 000000000000..131d41f9c667 --- /dev/null +++ b/eslint/babel-eslint-plugin/tests/generator-star.js @@ -0,0 +1,32 @@ +/* eslint-disable */ +var linter = require('eslint').linter + , ESLintTester = require('eslint-tester') + , eslintTester = new ESLintTester(linter); + +var features = { + generators: true +}; + +function ok(code, args){ + return { code: code, args: args, parser: 'babel-eslint', ecmaFeatures: features } +} + +function err(code, errors, args){ + var e = ok(code, args) + e.errors = errors + return e +} + + +eslintTester.addRuleTest('rules/generator-star', { + valid: [ + ok('async function test(){}'), + ok('async function *test(){}', [1, "end"]) , + ok('async function* test(){}', [1, "start"]), + ok('async function * test(){}', [1, "middle"]) + ], + invalid: [ + err('async function* test(){}', [ { message: 'Expected a space before *.' }]), + err('async function *test(){}', [ { message: 'Expected no space before *.' }], [1, 'start']) + ] +}); \ No newline at end of file diff --git a/eslint/babel-eslint-plugin/tests/object-shorthand.js b/eslint/babel-eslint-plugin/tests/object-shorthand.js new file mode 100644 index 000000000000..9a89b10cc65b --- /dev/null +++ b/eslint/babel-eslint-plugin/tests/object-shorthand.js @@ -0,0 +1,100 @@ +/* eslint-disable */ +var linter = require('eslint').linter + , ESLintTester = require('eslint-tester') + , eslintTester = new ESLintTester(linter); + +var features = { + objectLiteralShorthandMethods: true, + objectLiteralShorthandProperties: true, + arrowFunctions: true, + destructuring: true, + generators: true +}; + +function ok(code, args){ + return { code: code, parser: 'babel-eslint', ecmaFeatures: features} +} + + +eslintTester.addRuleTest('rules/object-shorthand', { + valid: [ + ok('let { ...spread } = obj'), + ok('let { ...spread } = obj', [2, 'never']), + + //original test cases + { code: "var x = {y() {}}", ecmaFeatures: features }, + { code: "var x = {y}", ecmaFeatures: features }, + { code: "var x = {a: b}", ecmaFeatures: features }, + { code: "var x = {a: 'a'}", ecmaFeatures: features }, + { code: "var x = {'a': 'a'}", ecmaFeatures: features }, + { code: "var x = {'a': b}", ecmaFeatures: features }, + { code: "var x = {y(x) {}}", ecmaFeatures: features }, + { code: "var {x,y,z} = x", ecmaFeatures: features }, + { code: "var {x: {y}} = z", ecmaFeatures: features }, + { code: "var x = {*x() {}}", ecmaFeatures: features }, + { code: "var x = {x: y}", ecmaFeatures: features }, + { code: "var x = {x: y, y: z}", ecmaFeatures: features}, + { code: "var x = {x: y, y: z, z: 'z'}", ecmaFeatures: features}, + { code: "var x = {x() {}, y: z, l(){}}", ecmaFeatures: features}, + { code: "var x = {x: y, y: z, a: b}", ecmaFeatures: features}, + { code: "var x = {x: y, y: z, 'a': b}", ecmaFeatures: features}, + { code: "var x = {x: y, y() {}, z: a}", ecmaFeatures: features}, + { code: "doSomething({x: y})", ecmaFeatures: features}, + { code: "doSomething({'x': y})", ecmaFeatures: features}, + { code: "doSomething({x: 'x'})", ecmaFeatures: features}, + { code: "doSomething({'x': 'x'})", ecmaFeatures: features}, + { code: "doSomething({y() {}})", ecmaFeatures: features}, + { code: "doSomething({x: y, y() {}})", ecmaFeatures: features}, + { code: "doSomething({y() {}, z: a})", ecmaFeatures: features}, + { code: "!{ a: function a(){} };", ecmaFeatures: features }, + + // arrows functions are still alright + { code: "var x = {y: (x)=>x}", ecmaFeatures: features }, + { code: "doSomething({y: (x)=>x})", ecmaFeatures: features }, + { code: "var x = {y: (x)=>x, y: a}", ecmaFeatures: features }, + { code: "doSomething({x, y: (x)=>x})", ecmaFeatures: features }, + + // getters and setters are ok + { code: "var x = {get y() {}}", ecmaFeatures: features }, + { code: "var x = {set y(z) {}}", ecmaFeatures: features }, + { code: "var x = {get y() {}, set y(z) {}}", ecmaFeatures: features }, + { code: "doSomething({get y() {}})", ecmaFeatures: features }, + { code: "doSomething({set y(z) {}})", ecmaFeatures: features }, + { code: "doSomething({get y() {}, set y(z) {}})", ecmaFeatures: features }, + + // options + { code: "var x = {y() {}}", ecmaFeatures: features, args: [2, "methods"] }, + { code: "var x = {x, y() {}, a:b}", ecmaFeatures: features, args: [2, "methods"] }, + { code: "var x = {y}", ecmaFeatures: features, args: [2, "properties"] }, + { code: "var x = {y: {b}}", ecmaFeatures: features, args: [2, "properties"] }, + { code: "var x = {a: n, c: d, f: g}", ecmaFeatures: features, args: [2, "never"] }, + { code: "var x = {a: function(){}, b: {c: d}}", ecmaFeatures: features, args: [2, "never"] } + ], + + invalid: [ + { code: "var x = {x: x}", ecmaFeatures: features, errors: [{ message: "Expected property shorthand.", type: "Property" }] }, + { code: "var x = {'x': x}", ecmaFeatures: features, errors: [{ message: "Expected property shorthand.", type: "Property" }] }, + { code: "var x = {y: y, x: x}", ecmaFeatures: features, errors: [{ message: "Expected property shorthand.", type: "Property" }, { message: "Expected property shorthand.", type: "Property" }] }, + { code: "var x = {y: z, x: x, a: b}", ecmaFeatures: features, errors: [{ message: "Expected property shorthand.", type: "Property" }] }, + { code: "var x = {y: function() {}}", ecmaFeatures: features, errors: [{ message: "Expected method shorthand.", type: "Property" }] }, + { code: "var x = {y: function*() {}}", ecmaFeatures: features, errors: [{ message: "Expected method shorthand.", type: "Property" }] }, + { code: "var x = {x: y, y: z, a: a}", ecmaFeatures: features, errors: [{ message: "Expected property shorthand.", type: "Property" }] }, + { code: "var x = {x: y, y: z, a: function(){}, b() {}}", ecmaFeatures: features, errors: [{ message: "Expected method shorthand.", type: "Property" }] }, + { code: "var x = {x: x, y: function() {}}", ecmaFeatures: features, errors: [{ message: "Expected property shorthand.", type: "Property" }, { message: "Expected method shorthand.", type: "Property" }]}, + { code: "doSomething({x: x})", ecmaFeatures: features, errors: [{ message: "Expected property shorthand.", type: "Property" }] }, + { code: "doSomething({'x': x})", ecmaFeatures: features, errors: [{ message: "Expected property shorthand.", type: "Property" }] }, + { code: "doSomething({a: 'a', 'x': x})", ecmaFeatures: features, errors: [{ message: "Expected property shorthand.", type: "Property" }] }, + { code: "doSomething({y: function() {}})", ecmaFeatures: features, errors: [{ message: "Expected method shorthand.", type: "Property" }] }, + + // options + { code: "var x = {y: function() {}}", ecmaFeatures: features, errors: [{ message: "Expected method shorthand.", type: "Property" }], args: [2, "methods"] }, + { code: "var x = {x, y() {}, z: function() {}}", ecmaFeatures: features, errors: [{ message: "Expected method shorthand.", type: "Property" }], args: [2, "methods"] }, + { code: "var x = {x: x}", ecmaFeatures: features, errors: [{ message: "Expected property shorthand.", type: "Property" }], args: [2, "properties"] }, + { code: "var x = {a, b, c(){}, x: x}", ecmaFeatures: features, errors: [{ message: "Expected property shorthand.", type: "Property" }], args: [2, "properties"] }, + { code: "var x = {y() {}}", ecmaFeatures: features, errors: [{ message: "Expected longform method syntax.", type: "Property" }], args: [2, "never"] }, + { code: "var x = {*y() {}}", ecmaFeatures: features, errors: [{ message: "Expected longform method syntax.", type: "Property" }], args: [2, "never"] }, + { code: "var x = {y}", ecmaFeatures: features, errors: [{ message: "Expected longform property syntax.", type: "Property" }], args: [2, "never"]}, + { code: "var x = {y, a: b, *x(){}}", ecmaFeatures: features, errors: [{ message: "Expected longform property syntax.", type: "Property" }, { message: "Expected longform method syntax.", type: "Property" }], args: [2, "never"]}, + { code: "var x = {y: {x}}", ecmaFeatures: features, errors: [{ message: "Expected longform property syntax.", type: "Property" }], args: [2, "never"]} + ] +}); \ No newline at end of file From cc35677cffcb2a8ff10c2ec9ba24030ca7c22f40 Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Fri, 19 Jun 2015 00:04:01 -0400 Subject: [PATCH 472/569] Update README.md --- eslint/babel-eslint-plugin/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md index 5de7ba997ef2..d2496f5679bc 100644 --- a/eslint/babel-eslint-plugin/README.md +++ b/eslint/babel-eslint-plugin/README.md @@ -1,6 +1,6 @@ # eslint-plugin-babel -An eslint plugin companion to babel-eslint. babel-eslint does a great job of adapting the eslint parser to valid babel code, it can't change built in rules to deal with the syntactic differences. eslint-plugin-babel reimplements problematic rules to not give false positives or negatives. +An eslint plugin companion to babel-eslint. babel-eslint does a great job of adapting eslint for use with Babel, but to it can't change the built in rules to support experimental features. eslint-plugin-babel reimplements problematic rules so they do not give false positives or negatives. ### Install From e9e6dee39a258f1fa273b125d17335e0546a0455 Mon Sep 17 00:00:00 2001 From: jquense Date: Fri, 19 Jun 2015 00:08:09 -0400 Subject: [PATCH 473/569] Typos and copy --- eslint/babel-eslint-plugin/index.js | 8 +++++++- eslint/babel-eslint-plugin/package.json | 11 +++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/eslint/babel-eslint-plugin/index.js b/eslint/babel-eslint-plugin/index.js index 86fbe85988ba..e2cc71b92365 100644 --- a/eslint/babel-eslint-plugin/index.js +++ b/eslint/babel-eslint-plugin/index.js @@ -3,6 +3,12 @@ module.exports = { rules: { 'object-shorthand': require('./rules/object-shorthand'), - 'generator-star': require('./rules/object-shorthand') + 'generator-star-spacing': require('./rules/generator-star-spacing'), + 'generator-star': require('./rules/generator-star') + }, + rulesConfig: { + 'generator-star-spacing': 0, + 'generator-star': 0, + 'object-shorthand': 0 } }; diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index 39201ad510a1..39305fd98c90 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -1,10 +1,10 @@ { "name": "eslint-plugin-babel", "version": "1.0.0", - "description": "eslint rule plugin companion to babel-eslint", + "description": "an eslint rule plugin companion to babel-eslint", "main": "index.js", "scripts": { - "test": "mocha -R spec ./tests/*.js" + "test": "mocha ./tests/*.js" }, "repository": { "type": "git", @@ -14,21 +14,24 @@ "babel", "eslint", "eslintplugin", + "eslint-plugin", "babel-eslint" ], - "author": "jquense @monasticpanic", + "author": "Jason Quense @monasticpanic", "license": "MIT", "bugs": { "url": "https://github.com/babel/eslint-plugin-babel/issues" }, "homepage": "https://github.com/babel/eslint-plugin-babel#readme", + "peerDependencies": { + "eslint": ">=0.8.0" + }, "devDependencies": { "babel-eslint": "^3.1.17", "eslint": "^0.23.0", "eslint-tester": "^0.8.0", "is-my-json-valid": "^2.12.0", "mocha": "^2.2.5", - "mocha-phantomjs": "^3.5.3", "phantomjs": "^1.9.17" }, "dependencies": { From 382c3f2bb9ee16f407a426936901cd3c95e50096 Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Wed, 1 Jul 2015 13:39:08 -0400 Subject: [PATCH 474/569] Merge pull request babel/eslint-plugin-babel#2 from mathieumg/newcap_decorators Added support for decorators in the new-cap rule. --- eslint/babel-eslint-plugin/README.md | 2 + eslint/babel-eslint-plugin/index.js | 6 +- eslint/babel-eslint-plugin/rules/new-cap.js | 234 ++++++++++++++++++++ eslint/babel-eslint-plugin/tests/new-cap.js | 122 ++++++++++ 4 files changed, 362 insertions(+), 2 deletions(-) create mode 100644 eslint/babel-eslint-plugin/rules/new-cap.js create mode 100644 eslint/babel-eslint-plugin/tests/new-cap.js diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md index d2496f5679bc..94db5b984d9e 100644 --- a/eslint/babel-eslint-plugin/README.md +++ b/eslint/babel-eslint-plugin/README.md @@ -26,6 +26,7 @@ Finally enable all the rules you like to use (remember to disable the originals "babel/object-shorthand": 1, "babel/generator-star": 1, "babel/generator-star-spacing": 1, + "babel/new-cap": 1, } } ``` @@ -36,3 +37,4 @@ Each rule cooresponds to a core eslint rule, and has the same options. - `babel/object-shorthand`: doesn't fail when using object spread (`...obj`) - `babel/generator-star`: Handles async/await functions correctly - `babel/generator-star-spacing`: Handles async/await functions correctly +- `babel/new-cap`: Ignores capitalized decorators (`@Decorator`) diff --git a/eslint/babel-eslint-plugin/index.js b/eslint/babel-eslint-plugin/index.js index e2cc71b92365..6c76dbe4cd55 100644 --- a/eslint/babel-eslint-plugin/index.js +++ b/eslint/babel-eslint-plugin/index.js @@ -4,11 +4,13 @@ module.exports = { rules: { 'object-shorthand': require('./rules/object-shorthand'), 'generator-star-spacing': require('./rules/generator-star-spacing'), - 'generator-star': require('./rules/generator-star') + 'generator-star': require('./rules/generator-star'), + 'new-cap': require('./rules/new-cap') }, rulesConfig: { 'generator-star-spacing': 0, 'generator-star': 0, - 'object-shorthand': 0 + 'object-shorthand': 0, + 'new-cap': 0 } }; diff --git a/eslint/babel-eslint-plugin/rules/new-cap.js b/eslint/babel-eslint-plugin/rules/new-cap.js new file mode 100644 index 000000000000..b1ab732d87fe --- /dev/null +++ b/eslint/babel-eslint-plugin/rules/new-cap.js @@ -0,0 +1,234 @@ +/** + * @fileoverview Rule to flag use of constructors without capital letters + * @author Nicholas C. Zakas + * @copyright 2014 Jordan Harband. All rights reserved. + * @copyright 2013-2014 Nicholas C. Zakas. All rights reserved. + * @copyright 2015 Mathieu M-Gosselin. All rights reserved. + */ + +"use strict"; + +var CAPS_ALLOWED = [ + "Array", + "Boolean", + "Date", + "Error", + "Function", + "Number", + "Object", + "RegExp", + "String", + "Symbol" +]; + +/** + * Ensure that if the key is provided, it must be an array. + * @param {Object} obj Object to check with `key`. + * @param {string} key Object key to check on `obj`. + * @param {*} fallback If obj[key] is not present, this will be returned. + * @returns {string[]} Returns obj[key] if it's an Array, otherwise `fallback` + */ +function checkArray(obj, key, fallback) { + if (Object.prototype.hasOwnProperty.call(obj, key) && !Array.isArray(obj[key])) { + throw new TypeError(key + ", if provided, must be an Array"); + } + return obj[key] || fallback; +} + +/** + * A reducer function to invert an array to an Object mapping the string form of the key, to `true`. + * @param {Object} map Accumulator object for the reduce. + * @param {string} key Object key to set to `true`. + * @returns {Object} Returns the updated Object for further reduction. + */ +function invert(map, key) { + map[key] = true; + return map; +} + +/** + * Creates an object with the cap is new exceptions as its keys and true as their values. + * @param {Object} config Rule configuration + * @returns {Object} Object with cap is new exceptions. + */ +function calculateCapIsNewExceptions(config) { + var capIsNewExceptions = checkArray(config, "capIsNewExceptions", CAPS_ALLOWED); + + if (capIsNewExceptions !== CAPS_ALLOWED) { + capIsNewExceptions = capIsNewExceptions.concat(CAPS_ALLOWED); + } + + return capIsNewExceptions.reduce(invert, {}); +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var config = context.options[0] || {}; + config.newIsCap = config.newIsCap !== false; + config.capIsNew = config.capIsNew !== false; + + var newIsCapExceptions = checkArray(config, "newIsCapExceptions", []).reduce(invert, {}); + + var capIsNewExceptions = calculateCapIsNewExceptions(config); + + var listeners = {}; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Get exact callee name from expression + * @param {ASTNode} node CallExpression or NewExpression node + * @returns {string} name + */ + function extractNameFromExpression(node) { + + var name = "", + property; + + if (node.callee.type === "MemberExpression") { + property = node.callee.property; + + if (property.type === "Literal" && (typeof property.value === "string")) { + name = property.value; + } else if (property.type === "Identifier" && !node.callee.computed) { + name = property.name; + } + } else { + name = node.callee.name; + } + return name; + } + + /** + * Returns the capitalization state of the string - + * Whether the first character is uppercase, lowercase, or non-alphabetic + * @param {string} str String + * @returns {string} capitalization state: "non-alpha", "lower", or "upper" + */ + function getCap(str) { + var firstChar = str.charAt(0); + + var firstCharLower = firstChar.toLowerCase(); + var firstCharUpper = firstChar.toUpperCase(); + + if (firstCharLower === firstCharUpper) { + // char has no uppercase variant, so it's non-alphabetic + return "non-alpha"; + } else if (firstChar === firstCharLower) { + return "lower"; + } else { + return "upper"; + } + } + + /** + * Returns whether a node is under a decorator or not. + * @param {ASTNode} node CallExpression node + * @returns {Boolean} Returns true if the node is under a decorator. + */ + function isDecorator(node) { + return node.parent.type === "Decorator"; + } + + /** + * Check if capitalization is allowed for a CallExpression + * @param {Object} allowedMap Object mapping calleeName to a Boolean + * @param {ASTNode} node CallExpression node + * @param {string} calleeName Capitalized callee name from a CallExpression + * @returns {Boolean} Returns true if the callee may be capitalized + */ + function isCapAllowed(allowedMap, node, calleeName) { + if (allowedMap[calleeName]) { + return true; + } + if (calleeName === "UTC" && node.callee.type === "MemberExpression") { + // allow if callee is Date.UTC + return node.callee.object.type === "Identifier" && + node.callee.object.name === "Date"; + } + return false; + } + + /** + * Reports the given message for the given node. The location will be the start of the property or the callee. + * @param {ASTNode} node CallExpression or NewExpression node. + * @param {string} message The message to report. + * @returns {void} + */ + function report(node, message) { + var callee = node.callee; + + if (callee.type === "MemberExpression") { + callee = callee.property; + } + + context.report(node, callee.loc.start, message); + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + if (config.newIsCap) { + listeners.NewExpression = function(node) { + + var constructorName = extractNameFromExpression(node); + if (constructorName) { + var capitalization = getCap(constructorName); + var isAllowed = capitalization !== "lower" || isCapAllowed(newIsCapExceptions, node, constructorName); + if (!isAllowed) { + report(node, "A constructor name should not start with a lowercase letter."); + } + } + }; + } + + if (config.capIsNew) { + listeners.CallExpression = function(node) { + + var calleeName = extractNameFromExpression(node); + if (calleeName) { + var capitalization = getCap(calleeName); + var isAllowed = capitalization !== "upper" || isDecorator(node) || isCapAllowed(capIsNewExceptions, node, calleeName); + if (!isAllowed) { + report(node, "A function with a name starting with an uppercase letter should only be used as a constructor."); + } + } + }; + } + + return listeners; +}; + +module.exports.schema = [ + { + "type": "object", + "properties": { + "newIsCap": { + "type": "boolean" + }, + "capIsNew": { + "type": "boolean" + }, + "newIsCapExceptions": { + "type": "array", + "items": { + "type": "string" + } + }, + "capIsNewExceptions": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } +]; diff --git a/eslint/babel-eslint-plugin/tests/new-cap.js b/eslint/babel-eslint-plugin/tests/new-cap.js new file mode 100644 index 000000000000..d25f5d2ad362 --- /dev/null +++ b/eslint/babel-eslint-plugin/tests/new-cap.js @@ -0,0 +1,122 @@ +/* eslint-disable */ + +/** + * @fileoverview Tests for new-cap rule. + * @author Nicholas C. Zakas + */ + +var linter = require('eslint').linter + , ESLintTester = require('eslint-tester') + , eslintTester = new ESLintTester(linter); + + +eslintTester.addRuleTest("rules/new-cap", { + valid: [ + // Original test cases. + "var x = new Constructor();", + "var x = new a.b.Constructor();", + "var x = new a.b['Constructor']();", + "var x = new a.b[Constructor]();", + "var x = new a.b[constructor]();", + "var x = new function(){};", + "var x = new _;", + "var x = new $;", + "var x = new Σ;", + "var x = new _x;", + "var x = new $x;", + "var x = new this;", + "var x = Array(42)", + "var x = Boolean(42)", + "var x = Date(42)", + "var x = Date.UTC(2000, 0)", + "var x = Error('error')", + "var x = Function('return 0')", + "var x = Number(42)", + "var x = Object(null)", + "var x = RegExp(42)", + "var x = String(42)", + "var x = Symbol('symbol')", + "var x = _();", + "var x = $();", + { code: "var x = Foo(42)", args: [1, {"capIsNew": false}] }, + { code: "var x = bar.Foo(42)", args: [1, {"capIsNew": false}] }, + "var x = bar[Foo](42)", + {code: "var x = bar['Foo'](42)", args: [1, {"capIsNew": false}] }, + "var x = Foo.bar(42)", + { code: "var x = new foo(42)", args: [1, {"newIsCap": false}] }, + "var o = { 1: function () {} }; o[1]();", + "var o = { 1: function () {} }; new o[1]();", + { code: "var x = Foo(42);", args: [1, { capIsNew: true, capIsNewExceptions: ["Foo"] }] }, + { code: "var x = new foo(42);", args: [1, { newIsCap: true, newIsCapExceptions: ["foo"] }] }, + { code: "var x = Object(42);", args: [1, { capIsNewExceptions: ["Foo"] }] }, + + // Babel-specific test cases. + { code: "@MyDecorator(123) class MyClass{}", parser: "babel-eslint" }, + ], + invalid: [ + { code: "var x = new c();", errors: [{ message: "A constructor name should not start with a lowercase letter.", type: "NewExpression"}] }, + { code: "var x = new φ;", errors: [{ message: "A constructor name should not start with a lowercase letter.", type: "NewExpression"}] }, + { code: "var x = new a.b.c;", errors: [{ message: "A constructor name should not start with a lowercase letter.", type: "NewExpression"}] }, + { code: "var x = new a.b['c'];", errors: [{ message: "A constructor name should not start with a lowercase letter.", type: "NewExpression"}] }, + { code: "var b = Foo();", errors: [{ message: "A function with a name starting with an uppercase letter should only be used as a constructor.", type: "CallExpression"}] }, + { code: "var b = a.Foo();", errors: [{ message: "A function with a name starting with an uppercase letter should only be used as a constructor.", type: "CallExpression"}] }, + { code: "var b = a['Foo']();", errors: [{ message: "A function with a name starting with an uppercase letter should only be used as a constructor.", type: "CallExpression"}] }, + { code: "var b = a.Date.UTC();", errors: [{ message: "A function with a name starting with an uppercase letter should only be used as a constructor.", type: "CallExpression"}] }, + { code: "var b = UTC();", errors: [{ message: "A function with a name starting with an uppercase letter should only be used as a constructor.", type: "CallExpression"}] }, + { + code: "var a = B.C();", + errors: [ + { + message: "A function with a name starting with an uppercase letter should only be used as a constructor.", + type: "CallExpression", + line: 1, + column: 10 + } + ] + }, + { + code: "var a = B\n.C();", + errors: [ + { + message: "A function with a name starting with an uppercase letter should only be used as a constructor.", + type: "CallExpression", + line: 2, + column: 1 + } + ] + }, + { + code: "var a = new B.c();", + errors: [ + { + message: "A constructor name should not start with a lowercase letter.", + type: "NewExpression", + line: 1, + column: 14 + } + ] + }, + { + code: "var a = new B.\nc();", + errors: [ + { + message: "A constructor name should not start with a lowercase letter.", + type: "NewExpression", + line: 2, + column: 0 + } + ] + }, + { + code: "var a = new c();", + errors: [ + { + message: "A constructor name should not start with a lowercase letter.", + type: "NewExpression", + line: 1, + column: 12 + } + ] + } + ] +}); From c2c993379746920063638b53c5966797e939ec3a Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Fri, 3 Jul 2015 23:14:57 -0400 Subject: [PATCH 475/569] Merge pull request babel/eslint-plugin-babel#1 from mathieumg/blockscopedvar_export Added support for experimental export types --- eslint/babel-eslint-plugin/README.md | 2 + eslint/babel-eslint-plugin/index.js | 2 + .../rules/block-scoped-var.js | 340 ++++++++++++++++++ .../tests/block-scoped-var.js | 105 ++++++ 4 files changed, 449 insertions(+) create mode 100644 eslint/babel-eslint-plugin/rules/block-scoped-var.js create mode 100644 eslint/babel-eslint-plugin/tests/block-scoped-var.js diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md index 94db5b984d9e..e29161738898 100644 --- a/eslint/babel-eslint-plugin/README.md +++ b/eslint/babel-eslint-plugin/README.md @@ -23,6 +23,7 @@ Finally enable all the rules you like to use (remember to disable the originals ```json { "rules": { + "babel/block-scoped-var": 1, "babel/object-shorthand": 1, "babel/generator-star": 1, "babel/generator-star-spacing": 1, @@ -34,6 +35,7 @@ Finally enable all the rules you like to use (remember to disable the originals Each rule cooresponds to a core eslint rule, and has the same options. +- `babel/block-scoped-var`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` - `babel/object-shorthand`: doesn't fail when using object spread (`...obj`) - `babel/generator-star`: Handles async/await functions correctly - `babel/generator-star-spacing`: Handles async/await functions correctly diff --git a/eslint/babel-eslint-plugin/index.js b/eslint/babel-eslint-plugin/index.js index 6c76dbe4cd55..8bfde48f91a3 100644 --- a/eslint/babel-eslint-plugin/index.js +++ b/eslint/babel-eslint-plugin/index.js @@ -2,12 +2,14 @@ module.exports = { rules: { + 'block-scoped-var': require('./rules/block-scoped-var'), 'object-shorthand': require('./rules/object-shorthand'), 'generator-star-spacing': require('./rules/generator-star-spacing'), 'generator-star': require('./rules/generator-star'), 'new-cap': require('./rules/new-cap') }, rulesConfig: { + 'block-scoped-var': 0, 'generator-star-spacing': 0, 'generator-star': 0, 'object-shorthand': 0, diff --git a/eslint/babel-eslint-plugin/rules/block-scoped-var.js b/eslint/babel-eslint-plugin/rules/block-scoped-var.js new file mode 100644 index 000000000000..71479e20d7be --- /dev/null +++ b/eslint/babel-eslint-plugin/rules/block-scoped-var.js @@ -0,0 +1,340 @@ +/** + * @fileoverview Rule to check for "block scoped" variables by binding context + * @author Matt DuVall + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + + var scopeStack = []; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Determines whether an identifier is in declaration position or is a non-declaration reference. + * @param {ASTNode} id The identifier. + * @param {ASTNode} parent The identifier's parent AST node. + * @returns {Boolean} true when the identifier is in declaration position. + */ + function isDeclaration(id, parent) { + switch (parent.type) { + case "FunctionDeclaration": + case "FunctionExpression": + return parent.params.indexOf(id) > -1 || id === parent.id; + + case "VariableDeclarator": + return id === parent.id; + + case "CatchClause": + return id === parent.param; + + default: + return false; + } + } + + /** + * Determines whether an identifier is in property position. + * @param {ASTNode} id The identifier. + * @param {ASTNode} parent The identifier's parent AST node. + * @returns {Boolean} true when the identifier is in property position. + */ + function isProperty(id, parent) { + switch (parent.type) { + case "MemberExpression": + return id === parent.property && !parent.computed; + + case "Property": + return id === parent.key; + + default: + return false; + } + } + + /** + * Pushes a new scope object on the scope stack. + * @returns {void} + */ + function pushScope() { + scopeStack.push([]); + } + + /** + * Removes the topmost scope object from the scope stack. + * @returns {void} + */ + function popScope() { + scopeStack.pop(); + } + + /** + * Declares the given names in the topmost scope object. + * @param {[String]} names A list of names to declare. + * @returns {void} + */ + function declare(names) { + [].push.apply(scopeStack[scopeStack.length - 1], names); + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + /** + * Declares all relevant identifiers for module imports. + * @param {ASTNode} node The AST node representing an import. + * @returns {void} + * @private + */ + function declareImports(node) { + declare([node.local.name]); + + if (node.imported && node.imported.name !== node.local.name) { + declare([node.imported.name]); + } + } + + /** + * Declares all relevant identifiers for module exports. + * @param {ASTNode} node The AST node representing an export. + * @returns {void} + * @private + */ + function declareExports(node) { + if (node.exported && node.exported.name) { + declare([node.exported.name]); + + if (node.local) { + declare([node.local.name]); + } + } + } + + /** + * Declares all relevant identifiers for classes. + * @param {ASTNode} node The AST node representing a class. + * @returns {void} + * @private + */ + function declareClass(node) { + + if (node.id) { + declare([node.id.name]); + } + + pushScope(); + } + + /** + * Declares all relevant identifiers for classes. + * @param {ASTNode} node The AST node representing a class. + * @returns {void} + * @private + */ + function declareClassMethod(node) { + pushScope(); + + declare([node.key.name]); + } + + /** + * Add declarations based on the type of node being passed. + * @param {ASTNode} node The node containing declarations. + * @returns {void} + * @private + */ + function declareByNodeType(node) { + + var declarations = []; + + switch (node.type) { + case "Identifier": + declarations.push(node.name); + break; + + case "ObjectPattern": + node.properties.forEach(function(property) { + declarations.push(property.key.name); + if (property.value) { + declarations.push(property.value.name); + } + }); + break; + + case "ArrayPattern": + node.elements.forEach(function(element) { + if (element) { + declarations.push(element.name); + } + }); + break; + + case "AssignmentPattern": + declareByNodeType(node.left); + break; + + case "RestElement": + declareByNodeType(node.argument); + break; + + // no default + } + + declare(declarations); + + } + + /** + * Adds declarations of the function parameters and pushes the scope + * @param {ASTNode} node The node containing declarations. + * @returns {void} + * @private + */ + function functionHandler(node) { + pushScope(); + + node.params.forEach(function(param) { + declareByNodeType(param); + }); + + declare(node.rest ? [node.rest.name] : []); + declare(["arguments"]); + } + + /** + * Adds declaration of the function name in its parent scope then process the function + * @param {ASTNode} node The node containing declarations. + * @returns {void} + * @private + */ + function functionDeclarationHandler(node) { + declare(node.id ? [node.id.name] : []); + functionHandler(node); + } + + /** + * Process function declarations and declares its name in its own scope + * @param {ASTNode} node The node containing declarations. + * @returns {void} + * @private + */ + function functionExpressionHandler(node) { + functionHandler(node); + declare(node.id ? [node.id.name] : []); + } + + function variableDeclarationHandler(node) { + node.declarations.forEach(function(declaration) { + declareByNodeType(declaration.id); + }); + + } + + return { + "Program": function() { + var scope = context.getScope(); + scopeStack = [scope.variables.map(function(v) { + return v.name; + })]; + + // global return creates another scope + if (context.ecmaFeatures.globalReturn) { + scope = scope.childScopes[0]; + scopeStack.push(scope.variables.map(function(v) { + return v.name; + })); + } + }, + + "ImportSpecifier": declareImports, + "ImportDefaultSpecifier": declareImports, + "ImportNamespaceSpecifier": declareImports, + + "ExportSpecifier": declareExports, + "ExportDefaultSpecifier": declareExports, + "ExportNamespaceSpecifier": declareExports, + + "BlockStatement": function(node) { + var statements = node.body; + pushScope(); + statements.forEach(function(stmt) { + if (stmt.type === "VariableDeclaration") { + variableDeclarationHandler(stmt); + } else if (stmt.type === "FunctionDeclaration") { + declare([stmt.id.name]); + } + }); + }, + + "VariableDeclaration": function (node) { + variableDeclarationHandler(node); + }, + + "BlockStatement:exit": popScope, + + "CatchClause": function(node) { + pushScope(); + declare([node.param.name]); + }, + "CatchClause:exit": popScope, + + "FunctionDeclaration": functionDeclarationHandler, + "FunctionDeclaration:exit": popScope, + + "ClassDeclaration": declareClass, + "ClassDeclaration:exit": popScope, + + "ClassExpression": declareClass, + "ClassExpression:exit": popScope, + + "MethodDefinition": declareClassMethod, + "MethodDefinition:exit": popScope, + + "FunctionExpression": functionExpressionHandler, + "FunctionExpression:exit": popScope, + + // Arrow functions cannot have names + "ArrowFunctionExpression": functionHandler, + "ArrowFunctionExpression:exit": popScope, + + "ForStatement": function() { + pushScope(); + }, + "ForStatement:exit": popScope, + + "ForInStatement": function() { + pushScope(); + }, + "ForInStatement:exit": popScope, + + "ForOfStatement": function() { + pushScope(); + }, + "ForOfStatement:exit": popScope, + + "Identifier": function(node) { + var ancestor = context.getAncestors().pop(); + if (isDeclaration(node, ancestor) || isProperty(node, ancestor) || ancestor.type === "LabeledStatement") { + return; + } + + for (var i = 0, l = scopeStack.length; i < l; i++) { + if (scopeStack[i].indexOf(node.name) > -1) { + return; + } + } + + context.report(node, "\"" + node.name + "\" used outside of binding context."); + } + }; + +}; + +module.exports.schema = []; diff --git a/eslint/babel-eslint-plugin/tests/block-scoped-var.js b/eslint/babel-eslint-plugin/tests/block-scoped-var.js new file mode 100644 index 000000000000..61297094ea21 --- /dev/null +++ b/eslint/babel-eslint-plugin/tests/block-scoped-var.js @@ -0,0 +1,105 @@ +/* eslint-disable */ + +/** + * @fileoverview Tests for block-scoped-var rule + * @author Matt DuVall + * @copyright 2015 Mathieu M-Gosselin. All rights reserved. + */ + +var eslint = require("eslint").linter, + ESLintTester = require("eslint-tester"), + eslintTester = new ESLintTester(eslint); + +eslintTester.addRuleTest("rules/block-scoped-var", { + valid: [ + //original test cases + { code: "function f() { } f(); var exports = { f: f };", ecmaFeatures: {modules: true} }, + { code: "var f = () => {}; f(); var exports = { f: f };", ecmaFeatures: {arrowFunctions: true, modules: true} }, + "!function f(){ f; }", + "function f() { } f(); var exports = { f: f };", + "function f() { var a, b; { a = true; } b = a; }", + "var a; function f() { var b = a; }", + "function f(a) { }", + "!function(a) { };", + "!function f(a) { };", + "function f(a) { var b = a; }", + "!function f(a) { var b = a; };", + "function f() { var g = f; }", + "function f() { } function g() { var f = g; }", + "function f() { var hasOwnProperty; { hasOwnProperty; } }", + "function f(){ a; b; var a, b; }", + "function f(){ g(); function g(){} }", + { code: "function myFunc(foo) { \"use strict\"; var { bar } = foo; bar.hello();}", ecmaFeatures: { destructuring: true } }, + { code: "function myFunc(foo) { \"use strict\"; var [ bar ] = foo; bar.hello();}", ecmaFeatures: { destructuring: true } }, + { code: "function myFunc(...foo) { return foo;}", ecmaFeatures: { restParams: true } }, + { code: "var f = () => { var g = f; }", ecmaFeatures: { arrowFunctions: true } }, + { code: "class Foo {}\nexport default Foo;", ecmaFeatures: { modules: true, classes: true } }, + { code: "new Date", globals: {Date: false} }, + { code: "new Date", globals: {} }, + { code: "var eslint = require('eslint');", globals: {require: false} }, + { code: "var fun = function({x}) {return x;};", ecmaFeatures: { destructuring: true } }, + { code: "var fun = function([,x]) {return x;};", ecmaFeatures: { destructuring: true } }, + "function f(a) { return a.b; }", + "var a = { \"foo\": 3 };", + "var a = { foo: 3 };", + "var a = { foo: 3, bar: 5 };", + "var a = { set foo(a){}, get bar(){} };", + "function f(a) { return arguments[0]; }", + "function f() { }; var a = f;", + "var a = f; function f() { };", + "function f(){ for(var i; i; i) i; }", + "function f(){ for(var a=0, b=1; a; b) a, b; }", + "function f(){ for(var a in {}) a; }", + "function f(){ switch(2) { case 1: var b = 2; b; break; default: b; break;} b; }", + "a:;", + { code: "const React = require(\"react/addons\");const cx = React.addons.classSet;", globals: { require: false }, ecmaFeatures: { globalReturn: true, modules: true, blockBindings: true }}, + { code: "var v = 1; function x() { return v; };", ecmaFeatures: { globalReturn: true }}, + { code: "import * as y from \"./other.js\"; y();", ecmaFeatures: { modules: true }}, + { code: "import y from \"./other.js\"; y();", ecmaFeatures: { modules: true }}, + { code: "import {x as y} from \"./other.js\"; y();", ecmaFeatures: { modules: true }}, + { code: "var x; export {x};", ecmaFeatures: { modules: true }}, + { code: "var x; export {x as v};", ecmaFeatures: { modules: true }}, + { code: "export {x} from \"./other.js\";", ecmaFeatures: { modules: true }}, + { code: "export {x as v} from \"./other.js\";", ecmaFeatures: { modules: true }}, + { code: "class Test { myFunction() { return true; }}", ecmaFeatures: { classes: true }}, + { code: "class Test { get flag() { return true; }}", ecmaFeatures: { classes: true }}, + { code: "var Test = class { myFunction() { return true; }}", ecmaFeatures: { classes: true }}, + { code: "var doStuff; let {x: y} = {x: 1}; doStuff(y);", ecmaFeatures: { blockBindings: true, destructuring: true }}, + { code: "function foo({x: y}) { return y; }", ecmaFeatures: { blockBindings: true, destructuring: true }}, + + // Babel-specific test-cases. + { code: "export x from \"./other.js\";", parser: "babel-eslint", ecmaFeatures: {modules: true} }, + { code: "export * as x from \"./other.js\";", parser: "babel-eslint", ecmaFeatures: {modules: true} }, + ], + invalid: [ + { code: "!function f(){}; f", errors: [{ message: "\"f\" used outside of binding context." }] }, + { code: "var f = function foo() { }; foo(); var exports = { f: foo };", errors: [{ message: "\"foo\" used outside of binding context." }, { message: "\"foo\" used outside of binding context."}] }, + { code: "var f = () => { x; }", ecmaFeatures: { arrowFunctions: true }, errors: [{ message: "\"x\" used outside of binding context.", type: "Identifier" }] }, + { code: "function f(){ x; }", errors: [{ message: "\"x\" used outside of binding context.", type: "Identifier" }] }, + { code: "function f(){ x; { var x; } }", errors: [{ message: "\"x\" used outside of binding context.", type: "Identifier" }] }, + { code: "function f(){ { var x; } x; }", errors: [{ message: "\"x\" used outside of binding context.", type: "Identifier" }] }, + { code: "function f() { var a; { var b = 0; } a = b; }", errors: [{ message: "\"b\" used outside of binding context.", type: "Identifier" }] }, + { code: "function f() { try { var a = 0; } catch (e) { var b = a; } }", errors: [{ message: "\"a\" used outside of binding context.", type: "Identifier" }] }, + { code: "var eslint = require('eslint');", globals: {}, errors: [{ message: "\"require\" used outside of binding context.", type: "Identifier" }] }, + { code: "function f(a) { return a[b]; }", errors: [{ message: "\"b\" used outside of binding context.", type: "Identifier" }] }, + { code: "function f() { return b.a; }", errors: [{ message: "\"b\" used outside of binding context.", type: "Identifier" }] }, + { code: "var a = { foo: bar };", errors: [{ message: "\"bar\" used outside of binding context.", type: "Identifier" }] }, + { code: "var a = { foo: foo };", errors: [{ message: "\"foo\" used outside of binding context.", type: "Identifier" }] }, + { code: "var a = { bar: 7, foo: bar };", errors: [{ message: "\"bar\" used outside of binding context.", type: "Identifier" }] }, + { code: "var a = arguments;", errors: [{ message: "\"arguments\" used outside of binding context.", type: "Identifier" }] }, + { code: "function x(){}; var a = arguments;", errors: [{ message: "\"arguments\" used outside of binding context.", type: "Identifier" }] }, + { code: "function z(b){}; var a = b;", errors: [{ message: "\"b\" used outside of binding context.", type: "Identifier" }] }, + { code: "function z(){var b;}; var a = b;", errors: [{ message: "\"b\" used outside of binding context.", type: "Identifier" }] }, + { code: "function f(){ try{}catch(e){} e }", errors: [{ message: "\"e\" used outside of binding context.", type: "Identifier" }] }, + { code: "a:b;", errors: [{ message: "\"b\" used outside of binding context.", type: "Identifier" }] }, + { + code: "function a() { for(var b in {}) { var c = b; } c; }", + errors: [{ message: "\"c\" used outside of binding context.", type: "Identifier" }] + }, + { + code: "function a() { for(var b of {}) { var c = b;} c; }", + ecmaFeatures: { forOf: true }, + errors: [{ message: "\"c\" used outside of binding context.", type: "Identifier" }] + } + ] +}); From fadd5b55cafd0076a1a9a3be7fc4bb4c606c5572 Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Fri, 3 Jul 2015 23:15:14 -0400 Subject: [PATCH 476/569] Merge pull request babel/eslint-plugin-babel#3 from mathieumg/spaceinbrackets_export Added support for experimental exports in the `space-in-brackets` rule. --- eslint/babel-eslint-plugin/README.md | 2 + eslint/babel-eslint-plugin/index.js | 6 +- .../rules/space-in-brackets.js | 309 +++++++ .../tests/space-in-brackets.js | 761 ++++++++++++++++++ 4 files changed, 1076 insertions(+), 2 deletions(-) create mode 100644 eslint/babel-eslint-plugin/rules/space-in-brackets.js create mode 100644 eslint/babel-eslint-plugin/tests/space-in-brackets.js diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md index e29161738898..997a6148aabf 100644 --- a/eslint/babel-eslint-plugin/README.md +++ b/eslint/babel-eslint-plugin/README.md @@ -28,6 +28,7 @@ Finally enable all the rules you like to use (remember to disable the originals "babel/generator-star": 1, "babel/generator-star-spacing": 1, "babel/new-cap": 1, + "babel/space-in-brackets": 1, } } ``` @@ -40,3 +41,4 @@ Each rule cooresponds to a core eslint rule, and has the same options. - `babel/generator-star`: Handles async/await functions correctly - `babel/generator-star-spacing`: Handles async/await functions correctly - `babel/new-cap`: Ignores capitalized decorators (`@Decorator`) +- `babel/space-in-brackets`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` diff --git a/eslint/babel-eslint-plugin/index.js b/eslint/babel-eslint-plugin/index.js index 8bfde48f91a3..a486a4c1205d 100644 --- a/eslint/babel-eslint-plugin/index.js +++ b/eslint/babel-eslint-plugin/index.js @@ -6,13 +6,15 @@ module.exports = { 'object-shorthand': require('./rules/object-shorthand'), 'generator-star-spacing': require('./rules/generator-star-spacing'), 'generator-star': require('./rules/generator-star'), - 'new-cap': require('./rules/new-cap') + 'new-cap': require('./rules/new-cap'), + 'space-in-brackets': require('./rules/space-in-brackets'), }, rulesConfig: { 'block-scoped-var': 0, 'generator-star-spacing': 0, 'generator-star': 0, 'object-shorthand': 0, - 'new-cap': 0 + 'new-cap': 0, + 'space-in-brackets': 0 } }; diff --git a/eslint/babel-eslint-plugin/rules/space-in-brackets.js b/eslint/babel-eslint-plugin/rules/space-in-brackets.js new file mode 100644 index 000000000000..566ac351e839 --- /dev/null +++ b/eslint/babel-eslint-plugin/rules/space-in-brackets.js @@ -0,0 +1,309 @@ +/** + * @fileoverview Disallows or enforces spaces inside of brackets. + * @author Ian Christian Myers + * @copyright 2015 Mathieu M-Gosselin. All rights reserved. + * @copyright 2014 Brandyn Bennett. All rights reserved. + * @copyright 2014 Michael Ficarra. No rights reserved. + * @copyright 2014 Vignesh Anand. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + var spaced = context.options[0] === "always"; + + /** + * Determines whether an option is set, relative to the spacing option. + * If spaced is "always", then check whether option is set to false. + * If spaced is "never", then check whether option is set to true. + * @param {Object} option - The option to exclude. + * @returns {boolean} Whether or not the property is excluded. + */ + function isOptionSet(option) { + return context.options[1] != null ? context.options[1][option] === !spaced : false; + } + + var options = { + spaced: spaced, + singleElementException: isOptionSet("singleValue"), + objectsInArraysException: isOptionSet("objectsInArrays"), + arraysInArraysException: isOptionSet("arraysInArrays"), + arraysInObjectsException: isOptionSet("arraysInObjects"), + objectsInObjectsException: isOptionSet("objectsInObjects"), + propertyNameException: isOptionSet("propertyName") + }; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Determines whether two adjacent tokens are have whitespace between them. + * @param {Object} left - The left token object. + * @param {Object} right - The right token object. + * @returns {boolean} Whether or not there is space between the tokens. + */ + function isSpaced(left, right) { + return left.range[1] < right.range[0]; + } + + /** + * Determines whether two adjacent tokens are on the same line. + * @param {Object} left - The left token object. + * @param {Object} right - The right token object. + * @returns {boolean} Whether or not the tokens are on the same line. + */ + function isSameLine(left, right) { + return left.loc.start.line === right.loc.start.line; + } + + /** + * Reports that there shouldn't be a space after the first token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ + function reportNoBeginningSpace(node, token) { + context.report(node, token.loc.start, + "There should be no space after '" + token.value + "'"); + } + + /** + * Reports that there shouldn't be a space before the last token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ + function reportNoEndingSpace(node, token) { + context.report(node, token.loc.start, + "There should be no space before '" + token.value + "'"); + } + + /** + * Reports that there should be a space after the first token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ + function reportRequiredBeginningSpace(node, token) { + context.report(node, token.loc.start, + "A space is required after '" + token.value + "'"); + } + + /** + * Reports that there should be a space before the last token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ + function reportRequiredEndingSpace(node, token) { + context.report(node, token.loc.start, + "A space is required before '" + token.value + "'"); + } + + + /** + * Determines if spacing in curly braces is valid. + * @param {ASTNode} node The AST node to check. + * @param {Token} first The first token to check (should be the opening brace) + * @param {Token} second The second token to check (should be first after the opening brace) + * @param {Token} penultimate The penultimate token to check (should be last before closing brace) + * @param {Token} last The last token to check (should be closing brace) + * @returns {void} + */ + function validateBraceSpacing(node, first, second, penultimate, last) { + var closingCurlyBraceMustBeSpaced = + options.arraysInObjectsException && penultimate.value === "]" || + options.objectsInObjectsException && penultimate.value === "}" + ? !options.spaced : options.spaced; + + if (isSameLine(first, second)) { + if (options.spaced && !isSpaced(first, second)) { + reportRequiredBeginningSpace(node, first); + } + if (!options.spaced && isSpaced(first, second)) { + reportNoBeginningSpace(node, first); + } + } + + if (isSameLine(penultimate, last)) { + if (closingCurlyBraceMustBeSpaced && !isSpaced(penultimate, last)) { + reportRequiredEndingSpace(node, last); + } + if (!closingCurlyBraceMustBeSpaced && isSpaced(penultimate, last)) { + reportNoEndingSpace(node, last); + } + } + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + + MemberExpression: function(node) { + if (!node.computed) { + return; + } + + var property = node.property, + before = context.getTokenBefore(property), + first = context.getFirstToken(property), + last = context.getLastToken(property), + after = context.getTokenAfter(property); + + var propertyNameMustBeSpaced = options.propertyNameException ? + !options.spaced : options.spaced; + + if (isSameLine(before, first)) { + if (propertyNameMustBeSpaced) { + if (!isSpaced(before, first) && isSameLine(before, first)) { + reportRequiredBeginningSpace(node, before); + } + } else { + if (isSpaced(before, first)) { + reportNoBeginningSpace(node, before); + } + } + } + + if (isSameLine(last, after)) { + if (propertyNameMustBeSpaced) { + if (!isSpaced(last, after) && isSameLine(last, after)) { + reportRequiredEndingSpace(node, after); + } + } else { + if (isSpaced(last, after)) { + reportNoEndingSpace(node, after); + } + } + } + }, + + ArrayExpression: function(node) { + if (node.elements.length === 0) { + return; + } + + var first = context.getFirstToken(node), + second = context.getFirstToken(node, 1), + penultimate = context.getLastToken(node, 1), + last = context.getLastToken(node); + + var openingBracketMustBeSpaced = + options.objectsInArraysException && second.value === "{" || + options.arraysInArraysException && second.value === "[" || + options.singleElementException && node.elements.length === 1 + ? !options.spaced : options.spaced; + + var closingBracketMustBeSpaced = + options.objectsInArraysException && penultimate.value === "}" || + options.arraysInArraysException && penultimate.value === "]" || + options.singleElementException && node.elements.length === 1 + ? !options.spaced : options.spaced; + + if (isSameLine(first, second)) { + if (openingBracketMustBeSpaced && !isSpaced(first, second)) { + reportRequiredBeginningSpace(node, first); + } + if (!openingBracketMustBeSpaced && isSpaced(first, second)) { + reportNoBeginningSpace(node, first); + } + } + + if (isSameLine(penultimate, last)) { + if (closingBracketMustBeSpaced && !isSpaced(penultimate, last)) { + reportRequiredEndingSpace(node, last); + } + if (!closingBracketMustBeSpaced && isSpaced(penultimate, last)) { + reportNoEndingSpace(node, last); + } + } + }, + + ImportDeclaration: function(node) { + + var firstSpecifier = node.specifiers[0], + lastSpecifier = node.specifiers[node.specifiers.length - 1]; + + // don't do anything for namespace or default imports + if (firstSpecifier && lastSpecifier && firstSpecifier.type === "ImportSpecifier" && lastSpecifier.type === "ImportSpecifier") { + var first = context.getTokenBefore(firstSpecifier), + second = context.getFirstToken(firstSpecifier), + penultimate = context.getLastToken(lastSpecifier), + last = context.getTokenAfter(lastSpecifier); + + validateBraceSpacing(node, first, second, penultimate, last); + } + + }, + + ExportNamedDeclaration: function(node) { + if (!node.specifiers.length) { + return; + } + + var firstSpecifier = node.specifiers[0], + lastSpecifier = node.specifiers[node.specifiers.length - 1], + first = context.getTokenBefore(firstSpecifier), + second = context.getFirstToken(firstSpecifier), + penultimate = context.getLastToken(lastSpecifier), + last = context.getTokenAfter(lastSpecifier); + + if (first.value === "export") { + return; + } + + validateBraceSpacing(node, first, second, penultimate, last); + }, + + ObjectExpression: function(node) { + if (node.properties.length === 0) { + return; + } + + var first = context.getFirstToken(node), + second = context.getFirstToken(node, 1), + penultimate = context.getLastToken(node, 1), + last = context.getLastToken(node); + + validateBraceSpacing(node, first, second, penultimate, last); + } + + }; + +}; + +module.exports.schema = [ + { + "enum": ["always", "never"] + }, + { + "type": "object", + "properties": { + "singleValue": { + "type": "boolean" + }, + "objectsInArrays": { + "type": "boolean" + }, + "arraysInArrays": { + "type": "boolean" + }, + "arraysInObjects": { + "type": "boolean" + }, + "objectsInObjects": { + "type": "boolean" + }, + "propertyName": { + "type": "boolean" + } + }, + "additionalProperties": false + } +]; diff --git a/eslint/babel-eslint-plugin/tests/space-in-brackets.js b/eslint/babel-eslint-plugin/tests/space-in-brackets.js new file mode 100644 index 000000000000..106120dd80b0 --- /dev/null +++ b/eslint/babel-eslint-plugin/tests/space-in-brackets.js @@ -0,0 +1,761 @@ +/* eslint-disable */ + +/** + * @fileoverview Disallows or enforces spaces inside of brackets. + * @author Ian Christian Myers + * @copyright 2014 Vignesh Anand. All rights reserved. + */ + +var linter = require('eslint').linter + , ESLintTester = require('eslint-tester') + , eslintTester = new ESLintTester(linter); + +eslintTester.addRuleTest("rules/space-in-brackets", { + + valid: [ + { code: "var foo = obj[ 1 ]", options: ["always"] }, + { code: "var foo = obj[ 'foo' ];", options: ["always"] }, + { code: "var foo = obj[ [ 1, 1 ] ];", options: ["always"] }, + + // always - singleValue + { code: "var foo = ['foo']", options: ["always", {singleValue: false}] }, + { code: "var foo = [2]", options: ["always", {singleValue: false}] }, + { code: "var foo = [[ 1, 1 ]]", options: ["always", {singleValue: false}] }, + { code: "var foo = [{ 'foo': 'bar' }]", options: ["always", {singleValue: false}] }, + { code: "var foo = [bar]", options: ["always", {singleValue: false}] }, + + // always - objectsInArrays + { code: "var foo = [{ 'bar': 'baz' }, 1, 5 ];", options: ["always", {objectsInArrays: false}] }, + { code: "var foo = [ 1, 5, { 'bar': 'baz' }];", options: ["always", {objectsInArrays: false}] }, + { code: "var foo = [{\n'bar': 'baz', \n'qux': [{ 'bar': 'baz' }], \n'quxx': 1 \n}]", options: ["always", {objectsInArrays: false}] }, + { code: "var foo = [{ 'bar': 'baz' }]", options: ["always", {objectsInArrays: false}] }, + { code: "var foo = [{ 'bar': 'baz' }, 1, { 'bar': 'baz' }];", options: ["always", {objectsInArrays: false}] }, + { code: "var foo = [ 1, { 'bar': 'baz' }, 5 ];", options: ["always", {objectsInArrays: false}] }, + { code: "var foo = [ 1, { 'bar': 'baz' }, [{ 'bar': 'baz' }] ];", options: ["always", {objectsInArrays: false}] }, + + // always - arraysInArrays + { code: "var arr = [[ 1, 2 ], 2, 3, 4 ];", options: ["always", {"arraysInArrays": false}] }, + { code: "var arr = [[ 1, 2 ], [[[ 1 ]]], 3, 4 ];", options: ["always", {"arraysInArrays": false}] }, + + // always - arraysInArrays, objectsInArrays + { code: "var arr = [[ 1, 2 ], 2, 3, { 'foo': 'bar' }];", options: ["always", {"arraysInArrays": false, objectsInArrays: false}] }, + + // always - arraysInArrays, objectsInArrays, singleValue + { code: "var arr = [[ 1, 2 ], [2], 3, { 'foo': 'bar' }];", options: ["always", {"arraysInArrays": false, objectsInArrays: false, singleValue: false}] }, + + // always - arraysInObjects + { code: "var obj = { 'foo': [ 1, 2 ]};", options: ["always", {"arraysInObjects": false}] }, + + // always - objectsInObjects + { code: "var obj = { 'foo': { 'bar': 1, 'baz': 2 }};", options: ["always", {"objectsInObjects": false}] }, + + // always - arraysInObjects, objectsInObjects + { code: "var obj = { 'qux': [ 1, 2 ], 'foo': { 'bar': 1, 'baz': 2 }};", options: ["always", {"arraysInObjects": false, "objectsInObjects": false}] }, + + // always - arraysInObjects, objectsInObjects (reverse) + { code: "var obj = { 'foo': { 'bar': 1, 'baz': 2 }, 'qux': [ 1, 2 ]};", options: ["always", {"arraysInObjects": false, "objectsInObjects": false}] }, + + // always + { code: "obj[ foo ]", options: ["always"] }, + { code: "obj[\nfoo\n]", options: ["always"] }, + { code: "obj[ 'foo' ]", options: ["always"] }, + { code: "obj[ 'foo' + 'bar' ]", options: ["always"] }, + { code: "obj[ obj2[ foo ] ]", options: ["always"] }, + { code: "obj.map(function (item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["always"] }, + { code: "obj[ 'map' ](function (item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["always"] }, + { code: "obj[ 'for' + 'Each' ](function (item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["always"] }, + + { code: "var arr = [ 1, 2, 3, 4 ];", options: ["always"] }, + { code: "var arr = [ [ 1, 2 ], 2, 3, 4 ];", options: ["always"] }, + { code: "var arr = [\n1, 2, 3, 4\n];", options: ["always"] }, + + { code: "var obj = { foo: bar, baz: qux };", options: ["always"] }, + { code: "var obj = { foo: { bar: quxx }, baz: qux };", options: ["always"] }, + { code: "var obj = {\nfoo: bar,\nbaz: qux\n};", options: ["always"] }, + + { code: "var foo = {};", options: ["always"] }, + { code: "var foo = [];", options: ["always"] }, + + { code: "this.db.mappings.insert([\n { alias: 'a', url: 'http://www.amazon.de' },\n { alias: 'g', url: 'http://www.google.de' }\n], function () {});", options: ["always", {singleValue: false, objectsInArrays: true, arraysInArrays: true}] }, + + // never + { code: "obj[foo]", options: ["never"] }, + { code: "obj['foo']", options: ["never"] }, + { code: "obj['foo' + 'bar']", options: ["never"] }, + { code: "obj['foo'+'bar']", options: ["never"] }, + { code: "obj[obj2[foo]]", options: ["never"] }, + { code: "obj.map(function (item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["never"] }, + { code: "obj['map'](function (item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["never"] }, + { code: "obj['for' + 'Each'](function (item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["never"] }, + { code: "obj[ obj2[ foo ] ]", options: ["never", {"propertyName": true}] }, + { code: "obj['for' + 'Each'](function (item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["never"] }, + + + { code: "obj[\nfoo]", options: ["never"] }, + { code: "obj[foo\n]", options: ["never"] }, + { code: "var obj = {foo: bar,\nbaz: qux\n};", options: ["never"] }, + { code: "var obj = {\nfoo: bar,\nbaz: qux};", options: ["never"] }, + { code: "var arr = [1,\n2,\n3,\n4\n];", options: ["never"] }, + { code: "var arr = [\n1,\n2,\n3,\n4];", options: ["never"] }, + + // never - singleValue + { code: "var foo = [ 'foo' ]", options: ["never", {singleValue: true}] }, + { code: "var foo = [ 2 ]", options: ["never", {singleValue: true}] }, + { code: "var foo = [ [1, 1] ]", options: ["never", {singleValue: true}] }, + { code: "var foo = [ {'foo': 'bar'} ]", options: ["never", {singleValue: true}] }, + { code: "var foo = [ bar ]", options: ["never", {singleValue: true}] }, + + // never - objectsInArrays + { code: "var foo = [ {'bar': 'baz'}, 1, 5];", options: ["never", {objectsInArrays: true}] }, + { code: "var foo = [1, 5, {'bar': 'baz'} ];", options: ["never", {objectsInArrays: true}] }, + { code: "var foo = [ {\n'bar': 'baz', \n'qux': [ {'bar': 'baz'} ], \n'quxx': 1 \n} ]", options: ["never", {objectsInArrays: true}] }, + { code: "var foo = [ {'bar': 'baz'} ]", options: ["never", {objectsInArrays: true}] }, + { code: "var foo = [ {'bar': 'baz'}, 1, {'bar': 'baz'} ];", options: ["never", {objectsInArrays: true}] }, + { code: "var foo = [1, {'bar': 'baz'} , 5];", options: ["never", {objectsInArrays: true}] }, + { code: "var foo = [1, {'bar': 'baz'}, [ {'bar': 'baz'} ]];", options: ["never", {objectsInArrays: true}] }, + + // never - arraysInArrays + { code: "var arr = [ [1, 2], 2, 3, 4];", options: ["never", {"arraysInArrays": true}] }, + + // never - arraysInArrays, singleValue + { code: "var arr = [ [1, 2], [ [ [ 1 ] ] ], 3, 4];", options: ["never", {"arraysInArrays": true, singleValue: true}] }, + + // never - arraysInArrays, objectsInArrays + { code: "var arr = [ [1, 2], 2, 3, {'foo': 'bar'} ];", options: ["never", {"arraysInArrays": true, objectsInArrays: true}] }, + + { code: "var arr = [1, 2, 3, 4];", options: ["never"] }, + { code: "var arr = [[1, 2], 2, 3, 4];", options: ["never"] }, + { code: "var arr = [\n1, 2, 3, 4\n];", options: ["never"] }, + + { code: "var obj = {foo: bar, baz: qux};", options: ["never"] }, + { code: "var obj = {foo: {bar: quxx}, baz: qux};", options: ["never"] }, + { code: "var obj = {\nfoo: bar,\nbaz: qux\n};", options: ["never"] }, + + { code: "var foo = {};", options: ["never"] }, + { code: "var foo = [];", options: ["never"] }, + + { code: "var foo = [{'bar':'baz'}, 1, {'bar': 'baz'}];", options: ["never"] }, + { code: "var foo = [{'bar': 'baz'}];", options: ["never"] }, + { code: "var foo = [{\n'bar': 'baz', \n'qux': [{'bar': 'baz'}], \n'quxx': 1 \n}]", options: ["never"] }, + { code: "var foo = [1, {'bar': 'baz'}, 5];", options: ["never"] }, + { code: "var foo = [{'bar': 'baz'}, 1, 5];", options: ["never"] }, + { code: "var foo = [1, 5, {'bar': 'baz'}];", options: ["never"] }, + { code: "var obj = {'foo': [1, 2]}", options: ["never"] }, + + // propertyName: false + { code: "var foo = obj[1]", options: ["always", {propertyName: false}] }, + { code: "var foo = obj['foo'];", options: ["always", {propertyName: false}] }, + { code: "var foo = obj[[ 1, 1 ]];", options: ["always", {propertyName: false}] }, + + { code: "var foo = obj[ 1 ]", options: ["never", {propertyName: true}] }, + { code: "var foo = obj[ 'foo' ];", options: ["never", {propertyName: true}] }, + { code: "var foo = obj[ [1, 1] ];", options: ["never", {propertyName: true}] }, + { code: "import 'test.js';", ecmaFeatures: { modules: true } }, + { code: "export const thing = {\n value: 1 \n};", ecmaFeatures: { modules: true, blockBindings: true } }, + { code: "export const thing = {};", ecmaFeatures: { modules: true, blockBindings: true } }, + { code: "export let thing = {};", ecmaFeatures: { modules: true, blockBindings: true } }, + { code: "export var thing = {};", ecmaFeatures: { modules: true } }, + + // Babel test cases. + { code: "export * as x from \"mod\";", parser: "babel-eslint", ecmaFeatures: { modules: true } }, + { code: "export x from \"mod\";", parser: "babel-eslint", ecmaFeatures: { modules: true } }, + ], + + invalid: [ + // objectsInArrays + { + code: "var foo = [ { 'bar': 'baz' }, 1, 5];", + options: ["always", {objectsInArrays: false}], + errors: [ + { + message: "There should be no space after '['", + type: "ArrayExpression" + }, + { + message: "A space is required before ']'", + type: "ArrayExpression" + } + ] + }, + { + code: "import {bar} from 'foo.js';", + options: ["always"], + ecmaFeatures: { + modules: true + }, + errors: [ + { + message: "A space is required after '{'", + type: "ImportDeclaration" + }, + { + message: "A space is required before '}'", + type: "ImportDeclaration" + } + ] + }, + { + code: "export {bar};", + options: ["always"], + ecmaFeatures: { + modules: true + }, + errors: [ + { + message: "A space is required after '{'", + type: "ExportNamedDeclaration" + }, + { + message: "A space is required before '}'", + type: "ExportNamedDeclaration" + } + ] + }, + { + code: "var foo = [1, 5, { 'bar': 'baz' } ];", + options: ["always", {objectsInArrays: false}], + errors: [ + { + message: "A space is required after '['", + type: "ArrayExpression" + }, + { + message: "There should be no space before ']'", + type: "ArrayExpression" + } + ] + }, + { + code: "var foo = [ { 'bar':'baz' }, 1, { 'bar': 'baz' } ];", + options: ["always", {objectsInArrays: false}], + errors: [ + { + message: "There should be no space after '['", + type: "ArrayExpression" + }, + { + message: "There should be no space before ']'", + type: "ArrayExpression" + } + ] + }, + + // singleValue + { + code: "var obj = [ 'foo' ];", + options: ["always", {singleValue: false}], + errors: [ + { + message: "There should be no space after '['", + type: "ArrayExpression" + }, + { + message: "There should be no space before ']'", + type: "ArrayExpression" + } + ] + }, + { + code: "var obj = ['foo' ];", + options: ["always", {singleValue: false}], + errors: [ + { + message: "There should be no space before ']'", + type: "ArrayExpression" + } + ] + }, + // singleValue + { + code: "var obj = ['foo'];", + options: ["never", {singleValue: true}], + errors: [ + { + message: "A space is required after '['", + type: "ArrayExpression" + }, + { + message: "A space is required before ']'", + type: "ArrayExpression" + } + ] + }, + { + code: "var foo = obj[ 1];", + options: ["always"], + errors: [ + { + message: "A space is required before ']'", + type: "MemberExpression" + } + ] + }, + { + code: "var foo = obj[1 ];", + options: ["always"], + errors: [ + { + message: "A space is required after '['", + type: "MemberExpression" + } + ] + }, + // propertyName + { + code: "var foo = obj[ 1];", + options: ["always", {propertyName: false}], + errors: [ + { + message: "There should be no space after '['", + type: "MemberExpression" + } + ] + }, + { + code: "var foo = obj[1 ];", + options: ["always", {propertyName: false}], + errors: [ + { + message: "There should be no space before ']'", + type: "MemberExpression" + } + ] + }, + { + code: "var foo = obj[ 1];", + options: ["never", {propertyName: true}], + errors: [ + { + message: "A space is required before ']'", + type: "MemberExpression" + } + ] + }, + { + code: "var foo = obj[1 ];", + options: ["never", {propertyName: true}], + errors: [ + { + message: "A space is required after '['", + type: "MemberExpression" + } + ] + }, + + // always - arraysInArrays + { + code: "var arr = [ [ 1, 2 ], 2, 3, 4 ];", + options: ["always", {"arraysInArrays": false}], + errors: [ + { + message: "There should be no space after '['", + type: "ArrayExpression" + } + ] + }, + { + code: "var arr = [ 1, 2, 2, [ 3, 4 ] ];", + options: ["always", {"arraysInArrays": false}], + errors: [ + { + message: "There should be no space before ']'", + type: "ArrayExpression" + } + ] + }, + { + code: "var arr = [[ 1, 2 ], 2, [ 3, 4 ] ];", + options: ["always", {"arraysInArrays": false}], + errors: [ + { + message: "There should be no space before ']'", + type: "ArrayExpression" + } + ] + }, + { + code: "var arr = [ [ 1, 2 ], 2, [ 3, 4 ]];", + options: ["always", {"arraysInArrays": false}], + errors: [ + { + message: "There should be no space after '['", + type: "ArrayExpression" + } + ] + }, + { + code: "var arr = [ [ 1, 2 ], 2, [ 3, 4 ] ];", + options: ["always", {"arraysInArrays": false}], + errors: [ + { + message: "There should be no space after '['", + type: "ArrayExpression" + }, + { + message: "There should be no space before ']'", + type: "ArrayExpression" + } + ] + }, + + // never - arraysInArrays + { + code: "var arr = [[1, 2], 2, [3, 4]];", + options: ["never", {"arraysInArrays": true}], + errors: [ + { + message: "A space is required after '['", + type: "ArrayExpression" + }, + { + message: "A space is required before ']'", + type: "ArrayExpression" + } + ] + }, + + // always - arraysInObjects + { + code: "var obj = { 'foo': [ 1, 2 ] };", + options: ["always", {"arraysInObjects": false}], + errors: [ + { + message: "There should be no space before '}'", + type: "ObjectExpression" + } + ] + }, + { + code: "var obj = { 'foo': [ 1, 2 ] , 'bar': [ 'baz', 'qux' ] };", + options: ["always", {"arraysInObjects": false}], + errors: [ + { + message: "There should be no space before '}'", + type: "ObjectExpression" + } + ] + }, + + // never - arraysInObjects + { + code: "var obj = {'foo': [1, 2]};", + options: ["never", {"arraysInObjects": true}], + errors: [ + { + message: "A space is required before '}'", + type: "ObjectExpression" + } + ] + }, + { + code: "var obj = {'foo': [1, 2] , 'bar': ['baz', 'qux']};", + options: ["never", {"arraysInObjects": true}], + errors: [ + { + message: "A space is required before '}'", + type: "ObjectExpression" + } + ] + }, + + // always-objectsInObjects + { + code: "var obj = { 'foo': { 'bar': 1, 'baz': 2 } };", + options: ["always", {"objectsInObjects": false}], + errors: [ + { + message: "There should be no space before '}'", + type: "ObjectExpression" + } + ] + }, + { + code: "var obj = { 'foo': [ 1, 2 ] , 'bar': { 'baz': 1, 'qux': 2 } };", + options: ["always", {"objectsInObjects": false}], + errors: [ + { + message: "There should be no space before '}'", + type: "ObjectExpression" + } + ] + }, + + // never-objectsInObjects + { + code: "var obj = {'foo': {'bar': 1, 'baz': 2}};", + options: ["never", {"objectsInObjects": true}], + errors: [ + { + message: "A space is required before '}'", + type: "ObjectExpression" + } + ] + }, + { + code: "var obj = {'foo': [1, 2] , 'bar': {'baz': 1, 'qux': 2}};", + options: ["never", {"objectsInObjects": true}], + errors: [ + { + message: "A space is required before '}'", + type: "ObjectExpression" + } + ] + }, + + // always & never + { + code: "var obj = {foo: bar, baz: qux};", + options: ["always"], + errors: [ + { + message: "A space is required after '{'", + type: "ObjectExpression" + }, + { + message: "A space is required before '}'", + type: "ObjectExpression" + } + ] + }, + { + code: "var obj = {foo: bar, baz: qux };", + options: ["always"], + errors: [ + { + message: "A space is required after '{'", + type: "ObjectExpression" + } + ] + }, + { + code: "var obj = { foo: bar, baz: qux};", + options: ["always"], + errors: [ + { + message: "A space is required before '}'", + type: "ObjectExpression" + } + ] + }, + { + code: "var obj = { foo: bar, baz: qux };", + options: ["never"], + errors: [ + { + message: "There should be no space after '{'", + type: "ObjectExpression" + }, + { + message: "There should be no space before '}'", + type: "ObjectExpression" + } + ] + }, + { + code: "var obj = {foo: bar, baz: qux };", + options: ["never"], + errors: [ + { + message: "There should be no space before '}'", + type: "ObjectExpression" + } + ] + }, + { + code: "var obj = { foo: bar, baz: qux};", + options: ["never"], + errors: [ + { + message: "There should be no space after '{'", + type: "ObjectExpression" + } + ] + }, + { + code: "var obj = { foo: { bar: quxx}, baz: qux};", + options: ["never"], + errors: [ + { + message: "There should be no space after '{'", + type: "ObjectExpression" + }, + { + message: "There should be no space after '{'", + type: "ObjectExpression" + } + ] + }, + { + code: "var obj = {foo: {bar: quxx }, baz: qux };", + options: ["never"], + errors: [ + { + message: "There should be no space before '}'", + type: "ObjectExpression" + }, + { + message: "There should be no space before '}'", + type: "ObjectExpression" + } + ] + }, + { + code: "var arr = [1, 2, 3, 4];", + options: ["always"], + errors: [ + { + message: "A space is required after '['", + type: "ArrayExpression" + }, + { + message: "A space is required before ']'", + type: "ArrayExpression" + } + ] + }, + { + code: "var arr = [1, 2, 3, 4 ];", + options: ["always"], + errors: [ + { + message: "A space is required after '['", + type: "ArrayExpression" + } + ] + }, + { + code: "var arr = [ 1, 2, 3, 4];", + options: ["always"], + errors: [ + { + message: "A space is required before ']'", + type: "ArrayExpression" + } + ] + }, + { + code: "var arr = [ 1, 2, 3, 4 ];", + options: ["never"], + errors: [ + { + message: "There should be no space after '['", + type: "ArrayExpression" + }, + { + message: "There should be no space before ']'", + type: "ArrayExpression" + } + ] + }, + { + code: "var arr = [1, 2, 3, 4 ];", + options: ["never"], + errors: [ + { + message: "There should be no space before ']'", + type: "ArrayExpression" + } + ] + }, + { + code: "var arr = [ 1, 2, 3, 4];", + options: ["never"], + errors: [ + { + message: "There should be no space after '['", + type: "ArrayExpression" + } + ] + }, + { + code: "var arr = [ [ 1], 2, 3, 4];", + options: ["never"], + errors: [ + { + message: "There should be no space after '['", + type: "ArrayExpression" + }, + { + message: "There should be no space after '['", + type: "ArrayExpression" + } + ] + }, + { + code: "var arr = [[1 ], 2, 3, 4 ];", + options: ["never"], + errors: [ + { + message: "There should be no space before ']'", + type: "ArrayExpression" + }, + { + message: "There should be no space before ']'", + type: "ArrayExpression" + } + ] + }, + { + code: "obj[ foo ]", + options: ["never"], + errors: [ + { + message: "There should be no space after '['", + type: "MemberExpression" + }, + { + message: "There should be no space before ']'", + type: "MemberExpression" + } + ] + }, + { + code: "obj[foo ]", + options: ["never"], + errors: [ + { + message: "There should be no space before ']'", + type: "MemberExpression" + } + ] + }, + { + code: "obj[ foo]", + options: ["never"], + errors: [ + { + message: "There should be no space after '['", + type: "MemberExpression" + } + ] + }, + { + code: "var foo = obj[1]", + options: ["always"], + errors: [ + { + message: "A space is required after '['", + type: "MemberExpression" + }, + { + message: "A space is required before ']'", + type: "MemberExpression" + } + ] + }, + { + code: "export const thing = {value: 1 };", + ecmaFeatures: { + modules: true, + blockBindings: true + }, + options: ["always"], + errors: [ + { + message: "A space is required after '{'", + type: "ObjectExpression" + } + ] + } + ] +}); From 1bfe4aa02f0ec3e4f88981f5a5c4b89c9666ee8d Mon Sep 17 00:00:00 2001 From: jquense Date: Tue, 7 Jul 2015 19:40:03 -0400 Subject: [PATCH 477/569] v1.1.0 --- eslint/babel-eslint-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index 39305fd98c90..333e3871e4ea 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-babel", - "version": "1.0.0", + "version": "1.1.0", "description": "an eslint rule plugin companion to babel-eslint", "main": "index.js", "scripts": { From 51d6ba733f5169ad1aaf72987201972461e21b66 Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Thu, 16 Jul 2015 09:17:20 -0400 Subject: [PATCH 478/569] Merge pull request babel/eslint-plugin-babel#4 from mathieumg/objectcurlyspacing_export Added support for experimental exports in the `object-curly-spacing` rule --- eslint/babel-eslint-plugin/README.md | 2 + eslint/babel-eslint-plugin/index.js | 1 + .../rules/object-curly-spacing.js | 236 +++++++++ .../tests/object-curly-spacing.js | 500 ++++++++++++++++++ 4 files changed, 739 insertions(+) create mode 100644 eslint/babel-eslint-plugin/rules/object-curly-spacing.js create mode 100644 eslint/babel-eslint-plugin/tests/object-curly-spacing.js diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md index 997a6148aabf..d6507bf78222 100644 --- a/eslint/babel-eslint-plugin/README.md +++ b/eslint/babel-eslint-plugin/README.md @@ -28,6 +28,7 @@ Finally enable all the rules you like to use (remember to disable the originals "babel/generator-star": 1, "babel/generator-star-spacing": 1, "babel/new-cap": 1, + "babel/object-curly-spacing": 1, "babel/space-in-brackets": 1, } } @@ -41,4 +42,5 @@ Each rule cooresponds to a core eslint rule, and has the same options. - `babel/generator-star`: Handles async/await functions correctly - `babel/generator-star-spacing`: Handles async/await functions correctly - `babel/new-cap`: Ignores capitalized decorators (`@Decorator`) +- `babel/object-curly-spacing`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` - `babel/space-in-brackets`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` diff --git a/eslint/babel-eslint-plugin/index.js b/eslint/babel-eslint-plugin/index.js index a486a4c1205d..8ff696b7a70e 100644 --- a/eslint/babel-eslint-plugin/index.js +++ b/eslint/babel-eslint-plugin/index.js @@ -7,6 +7,7 @@ module.exports = { 'generator-star-spacing': require('./rules/generator-star-spacing'), 'generator-star': require('./rules/generator-star'), 'new-cap': require('./rules/new-cap'), + 'object-curly-spacing': require('./rules/object-curly-spacing'), 'space-in-brackets': require('./rules/space-in-brackets'), }, rulesConfig: { diff --git a/eslint/babel-eslint-plugin/rules/object-curly-spacing.js b/eslint/babel-eslint-plugin/rules/object-curly-spacing.js new file mode 100644 index 000000000000..d498211a998b --- /dev/null +++ b/eslint/babel-eslint-plugin/rules/object-curly-spacing.js @@ -0,0 +1,236 @@ +/** + * @fileoverview Disallows or enforces spaces inside of object literals. + * @author Jamund Ferguson + * @copyright 2014 Brandyn Bennett. All rights reserved. + * @copyright 2014 Michael Ficarra. No rights reserved. + * @copyright 2014 Vignesh Anand. All rights reserved. + * @copyright 2015 Jamund Ferguson. All rights reserved. + * @copyright 2015 Mathieu M-Gosselin. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + var spaced = context.options[0] === "always"; + + /** + * Determines whether an option is set, relative to the spacing option. + * If spaced is "always", then check whether option is set to false. + * If spaced is "never", then check whether option is set to true. + * @param {Object} option - The option to exclude. + * @returns {boolean} Whether or not the property is excluded. + */ + function isOptionSet(option) { + return context.options[1] != null ? context.options[1][option] === !spaced : false; + } + + var options = { + spaced: spaced, + arraysInObjectsException: isOptionSet("arraysInObjects"), + objectsInObjectsException: isOptionSet("objectsInObjects") + }; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Determines whether two adjacent tokens are have whitespace between them. + * @param {Object} left - The left token object. + * @param {Object} right - The right token object. + * @returns {boolean} Whether or not there is space between the tokens. + */ + function isSpaced(left, right) { + return left.range[1] < right.range[0]; + } + + /** + * Determines whether two adjacent tokens are on the same line. + * @param {Object} left - The left token object. + * @param {Object} right - The right token object. + * @returns {boolean} Whether or not the tokens are on the same line. + */ + function isSameLine(left, right) { + return left.loc.start.line === right.loc.start.line; + } + + /** + * Reports that there shouldn't be a space after the first token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ + function reportNoBeginningSpace(node, token) { + context.report(node, token.loc.start, + "There should be no space after '" + token.value + "'"); + } + + /** + * Reports that there shouldn't be a space before the last token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ + function reportNoEndingSpace(node, token) { + context.report(node, token.loc.start, + "There should be no space before '" + token.value + "'"); + } + + /** + * Reports that there should be a space after the first token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ + function reportRequiredBeginningSpace(node, token) { + context.report(node, token.loc.start, + "A space is required after '" + token.value + "'"); + } + + /** + * Reports that there should be a space before the last token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ + function reportRequiredEndingSpace(node, token) { + context.report(node, token.loc.start, + "A space is required before '" + token.value + "'"); + } + + /** + * Determines if spacing in curly braces is valid. + * @param {ASTNode} node The AST node to check. + * @param {Token} first The first token to check (should be the opening brace) + * @param {Token} second The second token to check (should be first after the opening brace) + * @param {Token} penultimate The penultimate token to check (should be last before closing brace) + * @param {Token} last The last token to check (should be closing brace) + * @returns {void} + */ + function validateBraceSpacing(node, first, second, penultimate, last) { + var closingCurlyBraceMustBeSpaced = + options.arraysInObjectsException && penultimate.value === "]" || + options.objectsInObjectsException && penultimate.value === "}" + ? !options.spaced : options.spaced; + + if (isSameLine(first, second)) { + if (options.spaced && !isSpaced(first, second)) { + reportRequiredBeginningSpace(node, first); + } + if (!options.spaced && isSpaced(first, second)) { + reportNoBeginningSpace(node, first); + } + } + + if (isSameLine(penultimate, last)) { + if (closingCurlyBraceMustBeSpaced && !isSpaced(penultimate, last)) { + reportRequiredEndingSpace(node, last); + } + if (!closingCurlyBraceMustBeSpaced && isSpaced(penultimate, last)) { + reportNoEndingSpace(node, last); + } + } + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + + // var {x} = y; + ObjectPattern: function(node) { + var firstSpecifier = node.properties[0], + lastSpecifier = node.properties[node.properties.length - 1]; + + var first = context.getTokenBefore(firstSpecifier), + second = context.getFirstToken(firstSpecifier), + penultimate = context.getLastToken(lastSpecifier), + last = context.getTokenAfter(lastSpecifier); + + // support trailing commas + if (last.value === ",") { + penultimate = last; + last = context.getTokenAfter(last); + } + + validateBraceSpacing(node, first, second, penultimate, last); + }, + + // import {y} from 'x'; + ImportDeclaration: function(node) { + + var firstSpecifier = node.specifiers[0], + lastSpecifier = node.specifiers[node.specifiers.length - 1]; + + // don't do anything for namespace or default imports + if (firstSpecifier && lastSpecifier && firstSpecifier.type === "ImportSpecifier" && lastSpecifier.type === "ImportSpecifier") { + var first = context.getTokenBefore(firstSpecifier), + second = context.getFirstToken(firstSpecifier), + penultimate = context.getLastToken(lastSpecifier), + last = context.getTokenAfter(lastSpecifier); + + validateBraceSpacing(node, first, second, penultimate, last); + } + + }, + + // export {name} from 'yo'; + ExportNamedDeclaration: function(node) { + if (!node.specifiers.length) { + return; + } + + var firstSpecifier = node.specifiers[0], + lastSpecifier = node.specifiers[node.specifiers.length - 1], + first = context.getTokenBefore(firstSpecifier), + second = context.getFirstToken(firstSpecifier), + penultimate = context.getLastToken(lastSpecifier), + last = context.getTokenAfter(lastSpecifier); + + if (first.value === "export") { + return; + } + + validateBraceSpacing(node, first, second, penultimate, last); + + }, + + // var y = {x: 'y'} + ObjectExpression: function(node) { + if (node.properties.length === 0) { + return; + } + + var first = context.getFirstToken(node), + second = context.getFirstToken(node, 1), + penultimate = context.getLastToken(node, 1), + last = context.getLastToken(node); + + validateBraceSpacing(node, first, second, penultimate, last); + } + + }; + +}; + +module.exports.schema = [ + { + "enum": ["always", "never"] + }, + { + "type": "object", + "properties": { + "arraysInObjects": { + "type": "boolean" + }, + "objectsInObjects": { + "type": "boolean" + } + }, + "additionalProperties": false + } +]; diff --git a/eslint/babel-eslint-plugin/tests/object-curly-spacing.js b/eslint/babel-eslint-plugin/tests/object-curly-spacing.js new file mode 100644 index 000000000000..fb97a70130bb --- /dev/null +++ b/eslint/babel-eslint-plugin/tests/object-curly-spacing.js @@ -0,0 +1,500 @@ +/* eslint-disable */ + +/** + * @fileoverview Disallows or enforces spaces inside of object literals. + * @author Jamund Ferguson + * @copyright 2014 Vignesh Anand. All rights reserved. + * @copyright 2015 Jamund Ferguson. All rights reserved. + * @copyright 2015 Mathieu M-Gosselin. All rights reserved. + */ + +var linter = require('eslint').linter + , ESLintTester = require('eslint-tester') + , eslintTester = new ESLintTester(linter); + +eslintTester.addRuleTest("rules/object-curly-spacing", { + + valid: [ + + // always - object literals + { code: "var obj = { foo: bar, baz: qux };", options: ["always"] }, + { code: "var obj = { foo: { bar: quxx }, baz: qux };", options: ["always"] }, + { code: "var obj = {\nfoo: bar,\nbaz: qux\n};", options: ["always"] }, + + // always - destructuring + { code: "var { x } = y", options: ["always"], ecmaFeatures: { destructuring: true } }, + { code: "var { x, y } = y", options: ["always"], ecmaFeatures: { destructuring: true } }, + { code: "var { x,y } = y", options: ["always"], ecmaFeatures: { destructuring: true } }, + { code: "var {\nx,y } = y", options: ["always"], ecmaFeatures: { destructuring: true } }, + { code: "var {\nx,y\n} = z", options: ["always"], ecmaFeatures: { destructuring: true } }, + { code: "var { x = 10, y } = y", options: ["always"], ecmaFeatures: { destructuring: true } }, + { code: "var { x: { z }, y } = y", options: ["always"], ecmaFeatures: { destructuring: true } }, + { code: "var {\ny,\n} = x", options: ["always"], ecmaFeatures: { destructuring: true } }, + { code: "var { y, } = x", options: ["always"], ecmaFeatures: { destructuring: true } }, + + // always - import / export + { code: "import { door } from 'room'", options: ["always"], ecmaFeatures: { modules: true } }, + { code: "import {\ndoor } from 'room'", options: ["always"], ecmaFeatures: { modules: true } }, + { code: "export { door } from 'room'", options: ["always"], ecmaFeatures: { modules: true } }, + { code: "import { house, mouse } from 'caravan'", options: ["always"], ecmaFeatures: { modules: true } }, + { code: "export { door }", options: ["always"], ecmaFeatures: { modules: true } }, + { code: "import 'room'", options: ["always"], ecmaFeatures: { modules: true } }, + + // always - empty object + { code: "var foo = {};", options: ["always"] }, + + // always - objectsInObjects + { code: "var obj = { 'foo': { 'bar': 1, 'baz': 2 }};", options: ["always", {"objectsInObjects": false}] }, + + // always - arraysInObjects + { code: "var obj = { 'foo': [ 1, 2 ]};", options: ["always", {"arraysInObjects": false}] }, + + // always - arraysInObjects, objectsInObjects + { code: "var obj = { 'qux': [ 1, 2 ], 'foo': { 'bar': 1, 'baz': 2 }};", options: ["always", {"arraysInObjects": false, "objectsInObjects": false}] }, + + // always - arraysInObjects, objectsInObjects (reverse) + { code: "var obj = { 'foo': { 'bar': 1, 'baz': 2 }, 'qux': [ 1, 2 ]};", options: ["always", {"arraysInObjects": false, "objectsInObjects": false}] }, + + // never + { code: "var obj = {foo: bar,\nbaz: qux\n};", options: ["never"] }, + { code: "var obj = {\nfoo: bar,\nbaz: qux};", options: ["never"] }, + + // never - object literals + { code: "var obj = {foo: bar, baz: qux};", options: ["never"] }, + { code: "var obj = {foo: {bar: quxx}, baz: qux};", options: ["never"] }, + { code: "var obj = {foo: {\nbar: quxx}, baz: qux\n};", options: ["never"] }, + { code: "var obj = {foo: {\nbar: quxx\n}, baz: qux};", options: ["never"] }, + { code: "var obj = {\nfoo: bar,\nbaz: qux\n};", options: ["never"] }, + + // never - destructuring + { code: "var {x} = y", options: ["never"], ecmaFeatures: { destructuring: true } }, + { code: "var {x, y} = y", options: ["never"], ecmaFeatures: { destructuring: true } }, + { code: "var {x,y} = y", options: ["never"], ecmaFeatures: { destructuring: true } }, + { code: "var {\nx,y\n} = y", options: ["never"], ecmaFeatures: { destructuring: true } }, + { code: "var {x = 10} = y", options: ["never"], ecmaFeatures: { destructuring: true } }, + { code: "var {x = 10, y} = y", options: ["never"], ecmaFeatures: { destructuring: true } }, + { code: "var {x: {z}, y} = y", options: ["never"], ecmaFeatures: { destructuring: true } }, + { code: "var {\nx: {z\n}, y} = y", options: ["never"], ecmaFeatures: { destructuring: true } }, + { code: "var {\ny,\n} = x", options: ["never"], ecmaFeatures: { destructuring: true } }, + { code: "var {y,} = x", options: ["never"], ecmaFeatures: { destructuring: true } }, + + // never - import / export + { code: "import {door} from 'room'", options: ["never"], ecmaFeatures: { modules: true } }, + { code: "export {door} from 'room'", options: ["never"], ecmaFeatures: { modules: true } }, + { code: "import {\ndoor} from 'room'", options: ["never"], ecmaFeatures: { modules: true } }, + { code: "export {\ndoor\n} from 'room'", options: ["never"], ecmaFeatures: { modules: true } }, + { code: "import {house,mouse} from 'caravan'", options: ["never"], ecmaFeatures: { modules: true } }, + { code: "import {house, mouse} from 'caravan'", options: ["never"], ecmaFeatures: { modules: true } }, + { code: "export {door}", options: ["never"], ecmaFeatures: { modules: true } }, + { code: "import 'room'", options: ["never"], ecmaFeatures: { modules: true } }, + + // never - empty object + { code: "var foo = {};", options: ["never"] }, + + // never - objectsInObjects + { code: "var obj = {'foo': {'bar': 1, 'baz': 2} };", options: ["never", {"objectsInObjects": true}]}, + + // Babel test cases. + { code: "export * as x from \"mod\";", parser: "babel-eslint", ecmaFeatures: { modules: true } }, + { code: "export x from \"mod\";", parser: "babel-eslint", ecmaFeatures: { modules: true } }, + ], + + invalid: [ + { + code: "import {bar} from 'foo.js';", + options: ["always"], + ecmaFeatures: { + modules: true + }, + errors: [ + { + message: "A space is required after '{'", + type: "ImportDeclaration", + line: 1, + column: 7 + }, + { + message: "A space is required before '}'", + type: "ImportDeclaration", + line: 1, + column: 11 + } + ] + }, + { + code: "export {bar};", + options: ["always"], + ecmaFeatures: { + modules: true + }, + errors: [ + { + message: "A space is required after '{'", + type: "ExportNamedDeclaration", + line: 1, + column: 7 + }, + { + message: "A space is required before '}'", + type: "ExportNamedDeclaration", + line: 1, + column: 11 + } + ] + }, + + // always - arraysInObjects + { + code: "var obj = { 'foo': [ 1, 2 ] };", + options: ["always", {"arraysInObjects": false}], + errors: [ + { + message: "There should be no space before '}'", + type: "ObjectExpression" + } + ] + }, + { + code: "var obj = { 'foo': [ 1, 2 ] , 'bar': [ 'baz', 'qux' ] };", + options: ["always", {"arraysInObjects": false}], + errors: [ + { + message: "There should be no space before '}'", + type: "ObjectExpression" + } + ] + }, + + // always-objectsInObjects + { + code: "var obj = { 'foo': { 'bar': 1, 'baz': 2 } };", + options: ["always", {"objectsInObjects": false}], + errors: [ + { + message: "There should be no space before '}'", + type: "ObjectExpression", + line: 1, + column: 42 + } + ] + }, + { + code: "var obj = { 'foo': [ 1, 2 ] , 'bar': { 'baz': 1, 'qux': 2 } };", + options: ["always", {"objectsInObjects": false}], + errors: [ + { + message: "There should be no space before '}'", + type: "ObjectExpression", + line: 1, + column: 60 + } + ] + }, + + // always-destructuring trailing comma + { + code: "var { a,} = x;", + options: ["always"], + ecmaFeatures: { destructuring: true }, + errors: [ + { + message: "A space is required before '}'", + type: "ObjectPattern", + line: 1, + column: 8 + } + ] + }, + { + code: "var {a, } = x;", + options: ["never"], + ecmaFeatures: { destructuring: true }, + errors: [ + { + message: "There should be no space before '}'", + type: "ObjectPattern", + line: 1, + column: 8 + } + ] + }, + + // never-objectsInObjects + { + code: "var obj = {'foo': {'bar': 1, 'baz': 2}};", + options: ["never", {"objectsInObjects": true}], + errors: [ + { + message: "A space is required before '}'", + type: "ObjectExpression", + line: 1, + column: 38 + } + ] + }, + { + code: "var obj = {'foo': [1, 2] , 'bar': {'baz': 1, 'qux': 2}};", + options: ["never", {"objectsInObjects": true}], + errors: [ + { + message: "A space is required before '}'", + type: "ObjectExpression", + line: 1, + column: 54 + } + ] + }, + + // always & never + { + code: "var obj = {foo: bar, baz: qux};", + options: ["always"], + errors: [ + { + message: "A space is required after '{'", + type: "ObjectExpression", + line: 1, + column: 10 + }, + { + message: "A space is required before '}'", + type: "ObjectExpression", + line: 1, + column: 29 + } + ] + }, + { + code: "var obj = {foo: bar, baz: qux };", + options: ["always"], + errors: [ + { + message: "A space is required after '{'", + type: "ObjectExpression", + line: 1, + column: 10 + } + ] + }, + { + code: "var obj = { foo: bar, baz: qux};", + options: ["always"], + errors: [ + { + message: "A space is required before '}'", + type: "ObjectExpression", + line: 1, + column: 30 + } + ] + }, + { + code: "var obj = { foo: bar, baz: qux };", + options: ["never"], + errors: [ + { + message: "There should be no space after '{'", + type: "ObjectExpression", + line: 1, + column: 10 + }, + { + message: "There should be no space before '}'", + type: "ObjectExpression", + line: 1, + column: 31 + } + ] + }, + { + code: "var obj = {foo: bar, baz: qux };", + options: ["never"], + errors: [ + { + message: "There should be no space before '}'", + type: "ObjectExpression", + line: 1, + column: 30 + } + ] + }, + { + code: "var obj = { foo: bar, baz: qux};", + options: ["never"], + errors: [ + { + message: "There should be no space after '{'", + type: "ObjectExpression", + line: 1, + column: 10 + } + ] + }, + { + code: "var obj = { foo: { bar: quxx}, baz: qux};", + options: ["never"], + errors: [ + { + message: "There should be no space after '{'", + type: "ObjectExpression", + line: 1, + column: 10 + }, + { + message: "There should be no space after '{'", + type: "ObjectExpression", + line: 1, + column: 17 + } + ] + }, + { + code: "var obj = {foo: {bar: quxx }, baz: qux };", + options: ["never"], + errors: [ + { + message: "There should be no space before '}'", + type: "ObjectExpression", + line: 1, + column: 27 + }, + { + message: "There should be no space before '}'", + type: "ObjectExpression", + line: 1, + column: 39 + } + ] + }, + { + code: "export const thing = {value: 1 };", + ecmaFeatures: { + modules: true, + blockBindings: true + }, + options: ["always"], + errors: [ + { + message: "A space is required after '{'", + type: "ObjectExpression", + line: 1, + column: 21 + } + ] + }, + + // destructuring + { + code: "var {x, y} = y", + ecmaFeatures: {destructuring: true}, + options: ["always"], + errors: [ + { + message: "A space is required after '{'", + type: "ObjectPattern", + line: 1, + column: 4 + }, + { + message: "A space is required before '}'", + type: "ObjectPattern", + line: 1, + column: 9 + } + ] + }, + { + code: "var { x, y} = y", + ecmaFeatures: {destructuring: true}, + options: ["always"], + errors: [ + { + message: "A space is required before '}'", + type: "ObjectPattern", + line: 1, + column: 10 + } + ] + }, + { + code: "var { x, y } = y", + ecmaFeatures: {destructuring: true}, + options: ["never"], + errors: [ + { + message: "There should be no space after '{'", + type: "ObjectPattern", + line: 1, + column: 4 + }, + { + message: "There should be no space before '}'", + type: "ObjectPattern", + line: 1, + column: 11 + } + ] + }, + { + code: "var {x, y } = y", + ecmaFeatures: {destructuring: true}, + options: ["never"], + errors: [ + { + message: "There should be no space before '}'", + type: "ObjectPattern", + line: 1, + column: 10 + } + ] + }, + { + code: "var { x=10} = y", + ecmaFeatures: {destructuring: true}, + options: ["always"], + errors: [ + { + message: "A space is required before '}'", + type: "ObjectPattern", + line: 1, + column: 10 + } + ] + }, + { + code: "var {x=10 } = y", + ecmaFeatures: {destructuring: true}, + options: ["always"], + errors: [ + { + message: "A space is required after '{'", + type: "ObjectPattern", + line: 1, + column: 4 + } + ] + }, + + // never - arraysInObjects + { + code: "var obj = {'foo': [1, 2]};", + options: ["never", {"arraysInObjects": true}], + errors: [ + { + message: "A space is required before '}'", + type: "ObjectExpression" + } + ] + }, + { + code: "var obj = {'foo': [1, 2] , 'bar': ['baz', 'qux']};", + options: ["never", {"arraysInObjects": true}], + errors: [ + { + message: "A space is required before '}'", + type: "ObjectExpression" + } + ] + } + ] +}); From f0a2fb6b7bcec680b09fb9c36bfe973cfa479f90 Mon Sep 17 00:00:00 2001 From: jquense Date: Mon, 20 Jul 2015 14:55:25 -0400 Subject: [PATCH 479/569] v1.2.0 --- eslint/babel-eslint-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index 333e3871e4ea..39f8ad4876bc 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-babel", - "version": "1.1.0", + "version": "1.2.0", "description": "an eslint rule plugin companion to babel-eslint", "main": "index.js", "scripts": { From 89011d92fc949be3b1d222fc04b9b7ba795c57c0 Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Fri, 24 Jul 2015 14:14:14 -0400 Subject: [PATCH 480/569] Merge pull request babel/eslint-plugin-babel#5 from deepsweet/eslint-1.0-rc support eslint@>=1.0.0-rc-1 --- eslint/babel-eslint-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index 39f8ad4876bc..c955b1115156 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -24,7 +24,7 @@ }, "homepage": "https://github.com/babel/eslint-plugin-babel#readme", "peerDependencies": { - "eslint": ">=0.8.0" + "eslint": ">=0.8.0 || >=1.0.0-rc-1" }, "devDependencies": { "babel-eslint": "^3.1.17", From 3eeaa4aa36bbf0829518594a48cac4b9ece91d6b Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Tue, 4 Aug 2015 23:30:13 -0400 Subject: [PATCH 481/569] Merge pull request babel/eslint-plugin-babel#7 from mathieumg/eslint1.0 Updated for ESLint 1.0 --- eslint/babel-eslint-plugin/README.md | 10 +- eslint/babel-eslint-plugin/index.js | 11 +- eslint/babel-eslint-plugin/package.json | 7 +- .../rules/block-scoped-var.js | 340 -------- .../rules/generator-star-spacing.js | 33 +- .../rules/generator-star.js | 84 -- eslint/babel-eslint-plugin/rules/new-cap.js | 3 +- .../rules/object-shorthand.js | 3 +- .../rules/space-in-brackets.js | 309 ------- .../tests/block-scoped-var.js | 105 --- .../tests/generator-star-spacing.js | 724 ++++++++++++++--- .../tests/generator-star.js | 32 - eslint/babel-eslint-plugin/tests/new-cap.js | 53 +- .../tests/object-curly-spacing.js | 70 +- .../tests/object-shorthand.js | 54 +- .../tests/space-in-brackets.js | 761 ------------------ 16 files changed, 747 insertions(+), 1852 deletions(-) delete mode 100644 eslint/babel-eslint-plugin/rules/block-scoped-var.js delete mode 100644 eslint/babel-eslint-plugin/rules/generator-star.js delete mode 100644 eslint/babel-eslint-plugin/rules/space-in-brackets.js delete mode 100644 eslint/babel-eslint-plugin/tests/block-scoped-var.js delete mode 100644 eslint/babel-eslint-plugin/tests/generator-star.js delete mode 100644 eslint/babel-eslint-plugin/tests/space-in-brackets.js diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md index d6507bf78222..c76c666ca32d 100644 --- a/eslint/babel-eslint-plugin/README.md +++ b/eslint/babel-eslint-plugin/README.md @@ -23,13 +23,10 @@ Finally enable all the rules you like to use (remember to disable the originals ```json { "rules": { - "babel/block-scoped-var": 1, - "babel/object-shorthand": 1, - "babel/generator-star": 1, "babel/generator-star-spacing": 1, "babel/new-cap": 1, "babel/object-curly-spacing": 1, - "babel/space-in-brackets": 1, + "babel/object-shorthand": 1, } } ``` @@ -37,10 +34,7 @@ Finally enable all the rules you like to use (remember to disable the originals Each rule cooresponds to a core eslint rule, and has the same options. -- `babel/block-scoped-var`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` -- `babel/object-shorthand`: doesn't fail when using object spread (`...obj`) -- `babel/generator-star`: Handles async/await functions correctly - `babel/generator-star-spacing`: Handles async/await functions correctly - `babel/new-cap`: Ignores capitalized decorators (`@Decorator`) - `babel/object-curly-spacing`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` -- `babel/space-in-brackets`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` +- `babel/object-shorthand`: doesn't fail when using object spread (`...obj`) diff --git a/eslint/babel-eslint-plugin/index.js b/eslint/babel-eslint-plugin/index.js index 8ff696b7a70e..369b9c11b6f8 100644 --- a/eslint/babel-eslint-plugin/index.js +++ b/eslint/babel-eslint-plugin/index.js @@ -2,20 +2,15 @@ module.exports = { rules: { - 'block-scoped-var': require('./rules/block-scoped-var'), - 'object-shorthand': require('./rules/object-shorthand'), 'generator-star-spacing': require('./rules/generator-star-spacing'), - 'generator-star': require('./rules/generator-star'), 'new-cap': require('./rules/new-cap'), 'object-curly-spacing': require('./rules/object-curly-spacing'), - 'space-in-brackets': require('./rules/space-in-brackets'), + 'object-shorthand': require('./rules/object-shorthand'), }, rulesConfig: { - 'block-scoped-var': 0, 'generator-star-spacing': 0, - 'generator-star': 0, - 'object-shorthand': 0, 'new-cap': 0, - 'space-in-brackets': 0 + 'object-curly-spacing': 0, + 'object-shorthand': 0, } }; diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index c955b1115156..cfce981c1fc8 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -24,12 +24,11 @@ }, "homepage": "https://github.com/babel/eslint-plugin-babel#readme", "peerDependencies": { - "eslint": ">=0.8.0 || >=1.0.0-rc-1" + "eslint": ">=1.0.0" }, "devDependencies": { - "babel-eslint": "^3.1.17", - "eslint": "^0.23.0", - "eslint-tester": "^0.8.0", + "babel-eslint": "^4.0.5", + "eslint": "^1.0.0", "is-my-json-valid": "^2.12.0", "mocha": "^2.2.5", "phantomjs": "^1.9.17" diff --git a/eslint/babel-eslint-plugin/rules/block-scoped-var.js b/eslint/babel-eslint-plugin/rules/block-scoped-var.js deleted file mode 100644 index 71479e20d7be..000000000000 --- a/eslint/babel-eslint-plugin/rules/block-scoped-var.js +++ /dev/null @@ -1,340 +0,0 @@ -/** - * @fileoverview Rule to check for "block scoped" variables by binding context - * @author Matt DuVall - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -module.exports = function(context) { - - var scopeStack = []; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Determines whether an identifier is in declaration position or is a non-declaration reference. - * @param {ASTNode} id The identifier. - * @param {ASTNode} parent The identifier's parent AST node. - * @returns {Boolean} true when the identifier is in declaration position. - */ - function isDeclaration(id, parent) { - switch (parent.type) { - case "FunctionDeclaration": - case "FunctionExpression": - return parent.params.indexOf(id) > -1 || id === parent.id; - - case "VariableDeclarator": - return id === parent.id; - - case "CatchClause": - return id === parent.param; - - default: - return false; - } - } - - /** - * Determines whether an identifier is in property position. - * @param {ASTNode} id The identifier. - * @param {ASTNode} parent The identifier's parent AST node. - * @returns {Boolean} true when the identifier is in property position. - */ - function isProperty(id, parent) { - switch (parent.type) { - case "MemberExpression": - return id === parent.property && !parent.computed; - - case "Property": - return id === parent.key; - - default: - return false; - } - } - - /** - * Pushes a new scope object on the scope stack. - * @returns {void} - */ - function pushScope() { - scopeStack.push([]); - } - - /** - * Removes the topmost scope object from the scope stack. - * @returns {void} - */ - function popScope() { - scopeStack.pop(); - } - - /** - * Declares the given names in the topmost scope object. - * @param {[String]} names A list of names to declare. - * @returns {void} - */ - function declare(names) { - [].push.apply(scopeStack[scopeStack.length - 1], names); - } - - //-------------------------------------------------------------------------- - // Public API - //-------------------------------------------------------------------------- - - /** - * Declares all relevant identifiers for module imports. - * @param {ASTNode} node The AST node representing an import. - * @returns {void} - * @private - */ - function declareImports(node) { - declare([node.local.name]); - - if (node.imported && node.imported.name !== node.local.name) { - declare([node.imported.name]); - } - } - - /** - * Declares all relevant identifiers for module exports. - * @param {ASTNode} node The AST node representing an export. - * @returns {void} - * @private - */ - function declareExports(node) { - if (node.exported && node.exported.name) { - declare([node.exported.name]); - - if (node.local) { - declare([node.local.name]); - } - } - } - - /** - * Declares all relevant identifiers for classes. - * @param {ASTNode} node The AST node representing a class. - * @returns {void} - * @private - */ - function declareClass(node) { - - if (node.id) { - declare([node.id.name]); - } - - pushScope(); - } - - /** - * Declares all relevant identifiers for classes. - * @param {ASTNode} node The AST node representing a class. - * @returns {void} - * @private - */ - function declareClassMethod(node) { - pushScope(); - - declare([node.key.name]); - } - - /** - * Add declarations based on the type of node being passed. - * @param {ASTNode} node The node containing declarations. - * @returns {void} - * @private - */ - function declareByNodeType(node) { - - var declarations = []; - - switch (node.type) { - case "Identifier": - declarations.push(node.name); - break; - - case "ObjectPattern": - node.properties.forEach(function(property) { - declarations.push(property.key.name); - if (property.value) { - declarations.push(property.value.name); - } - }); - break; - - case "ArrayPattern": - node.elements.forEach(function(element) { - if (element) { - declarations.push(element.name); - } - }); - break; - - case "AssignmentPattern": - declareByNodeType(node.left); - break; - - case "RestElement": - declareByNodeType(node.argument); - break; - - // no default - } - - declare(declarations); - - } - - /** - * Adds declarations of the function parameters and pushes the scope - * @param {ASTNode} node The node containing declarations. - * @returns {void} - * @private - */ - function functionHandler(node) { - pushScope(); - - node.params.forEach(function(param) { - declareByNodeType(param); - }); - - declare(node.rest ? [node.rest.name] : []); - declare(["arguments"]); - } - - /** - * Adds declaration of the function name in its parent scope then process the function - * @param {ASTNode} node The node containing declarations. - * @returns {void} - * @private - */ - function functionDeclarationHandler(node) { - declare(node.id ? [node.id.name] : []); - functionHandler(node); - } - - /** - * Process function declarations and declares its name in its own scope - * @param {ASTNode} node The node containing declarations. - * @returns {void} - * @private - */ - function functionExpressionHandler(node) { - functionHandler(node); - declare(node.id ? [node.id.name] : []); - } - - function variableDeclarationHandler(node) { - node.declarations.forEach(function(declaration) { - declareByNodeType(declaration.id); - }); - - } - - return { - "Program": function() { - var scope = context.getScope(); - scopeStack = [scope.variables.map(function(v) { - return v.name; - })]; - - // global return creates another scope - if (context.ecmaFeatures.globalReturn) { - scope = scope.childScopes[0]; - scopeStack.push(scope.variables.map(function(v) { - return v.name; - })); - } - }, - - "ImportSpecifier": declareImports, - "ImportDefaultSpecifier": declareImports, - "ImportNamespaceSpecifier": declareImports, - - "ExportSpecifier": declareExports, - "ExportDefaultSpecifier": declareExports, - "ExportNamespaceSpecifier": declareExports, - - "BlockStatement": function(node) { - var statements = node.body; - pushScope(); - statements.forEach(function(stmt) { - if (stmt.type === "VariableDeclaration") { - variableDeclarationHandler(stmt); - } else if (stmt.type === "FunctionDeclaration") { - declare([stmt.id.name]); - } - }); - }, - - "VariableDeclaration": function (node) { - variableDeclarationHandler(node); - }, - - "BlockStatement:exit": popScope, - - "CatchClause": function(node) { - pushScope(); - declare([node.param.name]); - }, - "CatchClause:exit": popScope, - - "FunctionDeclaration": functionDeclarationHandler, - "FunctionDeclaration:exit": popScope, - - "ClassDeclaration": declareClass, - "ClassDeclaration:exit": popScope, - - "ClassExpression": declareClass, - "ClassExpression:exit": popScope, - - "MethodDefinition": declareClassMethod, - "MethodDefinition:exit": popScope, - - "FunctionExpression": functionExpressionHandler, - "FunctionExpression:exit": popScope, - - // Arrow functions cannot have names - "ArrowFunctionExpression": functionHandler, - "ArrowFunctionExpression:exit": popScope, - - "ForStatement": function() { - pushScope(); - }, - "ForStatement:exit": popScope, - - "ForInStatement": function() { - pushScope(); - }, - "ForInStatement:exit": popScope, - - "ForOfStatement": function() { - pushScope(); - }, - "ForOfStatement:exit": popScope, - - "Identifier": function(node) { - var ancestor = context.getAncestors().pop(); - if (isDeclaration(node, ancestor) || isProperty(node, ancestor) || ancestor.type === "LabeledStatement") { - return; - } - - for (var i = 0, l = scopeStack.length; i < l; i++) { - if (scopeStack[i].indexOf(node.name) > -1) { - return; - } - } - - context.report(node, "\"" + node.name + "\" used outside of binding context."); - } - }; - -}; - -module.exports.schema = []; diff --git a/eslint/babel-eslint-plugin/rules/generator-star-spacing.js b/eslint/babel-eslint-plugin/rules/generator-star-spacing.js index b122ed19c8b1..416efff8e2e1 100644 --- a/eslint/babel-eslint-plugin/rules/generator-star-spacing.js +++ b/eslint/babel-eslint-plugin/rules/generator-star-spacing.js @@ -9,12 +9,17 @@ module.exports = function(context) { - var mode = { - before: { before: true, after: false }, - after: { before: false, after: true }, - both: { before: true, after: true }, - neither: { before: false, after: false } - }[context.options[0] || "before"]; + var mode = (function(option) { + if (option == null || typeof option === "string") { + return { + before: { before: true, after: false }, + after: { before: false, after: true }, + both: { before: true, after: true }, + neither: { before: false, after: false } + }[option || "before"]; + } + return option; + }(context.options[0])); function isAsyncGenerator(node){ return context.getFirstToken(node, 2).value === '*' @@ -87,6 +92,18 @@ module.exports = function(context) { module.exports.schema = [ { - "enum": ["before", "after", "both", "neither"] + "oneOf": [ + { + "enum": ["before", "after", "both", "neither"] + }, + { + "type": "object", + "properties": { + "before": {"type": "boolean"}, + "after": {"type": "boolean"} + }, + "additionalProperties": false + } + ] } -]; \ No newline at end of file +]; diff --git a/eslint/babel-eslint-plugin/rules/generator-star.js b/eslint/babel-eslint-plugin/rules/generator-star.js deleted file mode 100644 index b5247f4f6880..000000000000 --- a/eslint/babel-eslint-plugin/rules/generator-star.js +++ /dev/null @@ -1,84 +0,0 @@ -/** - * @fileoverview Rule to check for the position of the * in your generator functions - * @author Jamund Ferguson - * @copyright 2014 Jamund Ferguson. All rights reserved. - */ - -"use strict"; - -var parse = require('../helpers').parse - -module.exports = function(context) { - - var position = context.options[0] || "end"; - - function isAsyncGenerator(node){ - return context.getFirstToken(node, 2).value === '*' - } - - /** - * Check the position of the star compared to the expected position. - * @param {ASTNode} node - the entire function node - * @returns {void} - */ - function checkStarPosition(node) { - - var first = context.getFirstToken(node) - , isAsync = first.value === 'async' - , starToken; - - - if (!node.generator || (isAsync && !isAsyncGenerator(node))) { - return; - } - - // Blocked, pending decision to fix or work around in eslint/espree#36 - if (context.getAncestors().pop().method) { - return; - } - - starToken = context.getFirstToken(node, isAsync ? 2 : 1); - - //console.log(declaration, starToken) - - // check for function *name() {} - if (position === "end") { - if (starToken.range[1] !== context.getTokenAfter(starToken).range[0]) { - // * starts where the next identifier begins - context.report(node, "Expected a space before *."); - } - } - - // check for function* name() {} - if (position === "start") { - - // * begins where the previous identifier ends - if (starToken.range[0] !== context.getTokenBefore(starToken).range[1]) { - context.report(node, "Expected no space before *."); - } - } - - // check for function * name() {} - if (position === "middle") { - - // must be a space before and afer the * - if (starToken.range[0] <= context.getTokenBefore(starToken).range[1] || - starToken.range[1] >= context.getTokenAfter(starToken).range[0]) { - context.report(node, "Expected spaces around *."); - } - } - - } - - return { - "FunctionDeclaration": checkStarPosition, - "FunctionExpression": checkStarPosition - }; - -}; - -module.exports.schema = [ - { - "enum": ["start", "middle", "end"] - } -]; \ No newline at end of file diff --git a/eslint/babel-eslint-plugin/rules/new-cap.js b/eslint/babel-eslint-plugin/rules/new-cap.js index b1ab732d87fe..a1d4575c2a80 100644 --- a/eslint/babel-eslint-plugin/rules/new-cap.js +++ b/eslint/babel-eslint-plugin/rules/new-cap.js @@ -29,6 +29,7 @@ var CAPS_ALLOWED = [ * @returns {string[]} Returns obj[key] if it's an Array, otherwise `fallback` */ function checkArray(obj, key, fallback) { + /* istanbul ignore if */ if (Object.prototype.hasOwnProperty.call(obj, key) && !Array.isArray(obj[key])) { throw new TypeError(key + ", if provided, must be an Array"); } @@ -144,7 +145,7 @@ module.exports = function(context) { * @returns {Boolean} Returns true if the callee may be capitalized */ function isCapAllowed(allowedMap, node, calleeName) { - if (allowedMap[calleeName]) { + if (allowedMap[calleeName] || allowedMap[context.getSource(node.callee)]) { return true; } if (calleeName === "UTC" && node.callee.type === "MemberExpression") { diff --git a/eslint/babel-eslint-plugin/rules/object-shorthand.js b/eslint/babel-eslint-plugin/rules/object-shorthand.js index e584bfb684c9..4bed9e832164 100644 --- a/eslint/babel-eslint-plugin/rules/object-shorthand.js +++ b/eslint/babel-eslint-plugin/rules/object-shorthand.js @@ -42,7 +42,8 @@ module.exports = function(context) { return; } - if (node.kind === 'get' || node.kind === 'set') { + // getters, setters and computed properties are ignored + if (node.kind === "get" || node.kind === "set" || node.computed) { return; } diff --git a/eslint/babel-eslint-plugin/rules/space-in-brackets.js b/eslint/babel-eslint-plugin/rules/space-in-brackets.js deleted file mode 100644 index 566ac351e839..000000000000 --- a/eslint/babel-eslint-plugin/rules/space-in-brackets.js +++ /dev/null @@ -1,309 +0,0 @@ -/** - * @fileoverview Disallows or enforces spaces inside of brackets. - * @author Ian Christian Myers - * @copyright 2015 Mathieu M-Gosselin. All rights reserved. - * @copyright 2014 Brandyn Bennett. All rights reserved. - * @copyright 2014 Michael Ficarra. No rights reserved. - * @copyright 2014 Vignesh Anand. All rights reserved. - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -module.exports = function(context) { - var spaced = context.options[0] === "always"; - - /** - * Determines whether an option is set, relative to the spacing option. - * If spaced is "always", then check whether option is set to false. - * If spaced is "never", then check whether option is set to true. - * @param {Object} option - The option to exclude. - * @returns {boolean} Whether or not the property is excluded. - */ - function isOptionSet(option) { - return context.options[1] != null ? context.options[1][option] === !spaced : false; - } - - var options = { - spaced: spaced, - singleElementException: isOptionSet("singleValue"), - objectsInArraysException: isOptionSet("objectsInArrays"), - arraysInArraysException: isOptionSet("arraysInArrays"), - arraysInObjectsException: isOptionSet("arraysInObjects"), - objectsInObjectsException: isOptionSet("objectsInObjects"), - propertyNameException: isOptionSet("propertyName") - }; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Determines whether two adjacent tokens are have whitespace between them. - * @param {Object} left - The left token object. - * @param {Object} right - The right token object. - * @returns {boolean} Whether or not there is space between the tokens. - */ - function isSpaced(left, right) { - return left.range[1] < right.range[0]; - } - - /** - * Determines whether two adjacent tokens are on the same line. - * @param {Object} left - The left token object. - * @param {Object} right - The right token object. - * @returns {boolean} Whether or not the tokens are on the same line. - */ - function isSameLine(left, right) { - return left.loc.start.line === right.loc.start.line; - } - - /** - * Reports that there shouldn't be a space after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @returns {void} - */ - function reportNoBeginningSpace(node, token) { - context.report(node, token.loc.start, - "There should be no space after '" + token.value + "'"); - } - - /** - * Reports that there shouldn't be a space before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @returns {void} - */ - function reportNoEndingSpace(node, token) { - context.report(node, token.loc.start, - "There should be no space before '" + token.value + "'"); - } - - /** - * Reports that there should be a space after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @returns {void} - */ - function reportRequiredBeginningSpace(node, token) { - context.report(node, token.loc.start, - "A space is required after '" + token.value + "'"); - } - - /** - * Reports that there should be a space before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @returns {void} - */ - function reportRequiredEndingSpace(node, token) { - context.report(node, token.loc.start, - "A space is required before '" + token.value + "'"); - } - - - /** - * Determines if spacing in curly braces is valid. - * @param {ASTNode} node The AST node to check. - * @param {Token} first The first token to check (should be the opening brace) - * @param {Token} second The second token to check (should be first after the opening brace) - * @param {Token} penultimate The penultimate token to check (should be last before closing brace) - * @param {Token} last The last token to check (should be closing brace) - * @returns {void} - */ - function validateBraceSpacing(node, first, second, penultimate, last) { - var closingCurlyBraceMustBeSpaced = - options.arraysInObjectsException && penultimate.value === "]" || - options.objectsInObjectsException && penultimate.value === "}" - ? !options.spaced : options.spaced; - - if (isSameLine(first, second)) { - if (options.spaced && !isSpaced(first, second)) { - reportRequiredBeginningSpace(node, first); - } - if (!options.spaced && isSpaced(first, second)) { - reportNoBeginningSpace(node, first); - } - } - - if (isSameLine(penultimate, last)) { - if (closingCurlyBraceMustBeSpaced && !isSpaced(penultimate, last)) { - reportRequiredEndingSpace(node, last); - } - if (!closingCurlyBraceMustBeSpaced && isSpaced(penultimate, last)) { - reportNoEndingSpace(node, last); - } - } - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - - MemberExpression: function(node) { - if (!node.computed) { - return; - } - - var property = node.property, - before = context.getTokenBefore(property), - first = context.getFirstToken(property), - last = context.getLastToken(property), - after = context.getTokenAfter(property); - - var propertyNameMustBeSpaced = options.propertyNameException ? - !options.spaced : options.spaced; - - if (isSameLine(before, first)) { - if (propertyNameMustBeSpaced) { - if (!isSpaced(before, first) && isSameLine(before, first)) { - reportRequiredBeginningSpace(node, before); - } - } else { - if (isSpaced(before, first)) { - reportNoBeginningSpace(node, before); - } - } - } - - if (isSameLine(last, after)) { - if (propertyNameMustBeSpaced) { - if (!isSpaced(last, after) && isSameLine(last, after)) { - reportRequiredEndingSpace(node, after); - } - } else { - if (isSpaced(last, after)) { - reportNoEndingSpace(node, after); - } - } - } - }, - - ArrayExpression: function(node) { - if (node.elements.length === 0) { - return; - } - - var first = context.getFirstToken(node), - second = context.getFirstToken(node, 1), - penultimate = context.getLastToken(node, 1), - last = context.getLastToken(node); - - var openingBracketMustBeSpaced = - options.objectsInArraysException && second.value === "{" || - options.arraysInArraysException && second.value === "[" || - options.singleElementException && node.elements.length === 1 - ? !options.spaced : options.spaced; - - var closingBracketMustBeSpaced = - options.objectsInArraysException && penultimate.value === "}" || - options.arraysInArraysException && penultimate.value === "]" || - options.singleElementException && node.elements.length === 1 - ? !options.spaced : options.spaced; - - if (isSameLine(first, second)) { - if (openingBracketMustBeSpaced && !isSpaced(first, second)) { - reportRequiredBeginningSpace(node, first); - } - if (!openingBracketMustBeSpaced && isSpaced(first, second)) { - reportNoBeginningSpace(node, first); - } - } - - if (isSameLine(penultimate, last)) { - if (closingBracketMustBeSpaced && !isSpaced(penultimate, last)) { - reportRequiredEndingSpace(node, last); - } - if (!closingBracketMustBeSpaced && isSpaced(penultimate, last)) { - reportNoEndingSpace(node, last); - } - } - }, - - ImportDeclaration: function(node) { - - var firstSpecifier = node.specifiers[0], - lastSpecifier = node.specifiers[node.specifiers.length - 1]; - - // don't do anything for namespace or default imports - if (firstSpecifier && lastSpecifier && firstSpecifier.type === "ImportSpecifier" && lastSpecifier.type === "ImportSpecifier") { - var first = context.getTokenBefore(firstSpecifier), - second = context.getFirstToken(firstSpecifier), - penultimate = context.getLastToken(lastSpecifier), - last = context.getTokenAfter(lastSpecifier); - - validateBraceSpacing(node, first, second, penultimate, last); - } - - }, - - ExportNamedDeclaration: function(node) { - if (!node.specifiers.length) { - return; - } - - var firstSpecifier = node.specifiers[0], - lastSpecifier = node.specifiers[node.specifiers.length - 1], - first = context.getTokenBefore(firstSpecifier), - second = context.getFirstToken(firstSpecifier), - penultimate = context.getLastToken(lastSpecifier), - last = context.getTokenAfter(lastSpecifier); - - if (first.value === "export") { - return; - } - - validateBraceSpacing(node, first, second, penultimate, last); - }, - - ObjectExpression: function(node) { - if (node.properties.length === 0) { - return; - } - - var first = context.getFirstToken(node), - second = context.getFirstToken(node, 1), - penultimate = context.getLastToken(node, 1), - last = context.getLastToken(node); - - validateBraceSpacing(node, first, second, penultimate, last); - } - - }; - -}; - -module.exports.schema = [ - { - "enum": ["always", "never"] - }, - { - "type": "object", - "properties": { - "singleValue": { - "type": "boolean" - }, - "objectsInArrays": { - "type": "boolean" - }, - "arraysInArrays": { - "type": "boolean" - }, - "arraysInObjects": { - "type": "boolean" - }, - "objectsInObjects": { - "type": "boolean" - }, - "propertyName": { - "type": "boolean" - } - }, - "additionalProperties": false - } -]; diff --git a/eslint/babel-eslint-plugin/tests/block-scoped-var.js b/eslint/babel-eslint-plugin/tests/block-scoped-var.js deleted file mode 100644 index 61297094ea21..000000000000 --- a/eslint/babel-eslint-plugin/tests/block-scoped-var.js +++ /dev/null @@ -1,105 +0,0 @@ -/* eslint-disable */ - -/** - * @fileoverview Tests for block-scoped-var rule - * @author Matt DuVall - * @copyright 2015 Mathieu M-Gosselin. All rights reserved. - */ - -var eslint = require("eslint").linter, - ESLintTester = require("eslint-tester"), - eslintTester = new ESLintTester(eslint); - -eslintTester.addRuleTest("rules/block-scoped-var", { - valid: [ - //original test cases - { code: "function f() { } f(); var exports = { f: f };", ecmaFeatures: {modules: true} }, - { code: "var f = () => {}; f(); var exports = { f: f };", ecmaFeatures: {arrowFunctions: true, modules: true} }, - "!function f(){ f; }", - "function f() { } f(); var exports = { f: f };", - "function f() { var a, b; { a = true; } b = a; }", - "var a; function f() { var b = a; }", - "function f(a) { }", - "!function(a) { };", - "!function f(a) { };", - "function f(a) { var b = a; }", - "!function f(a) { var b = a; };", - "function f() { var g = f; }", - "function f() { } function g() { var f = g; }", - "function f() { var hasOwnProperty; { hasOwnProperty; } }", - "function f(){ a; b; var a, b; }", - "function f(){ g(); function g(){} }", - { code: "function myFunc(foo) { \"use strict\"; var { bar } = foo; bar.hello();}", ecmaFeatures: { destructuring: true } }, - { code: "function myFunc(foo) { \"use strict\"; var [ bar ] = foo; bar.hello();}", ecmaFeatures: { destructuring: true } }, - { code: "function myFunc(...foo) { return foo;}", ecmaFeatures: { restParams: true } }, - { code: "var f = () => { var g = f; }", ecmaFeatures: { arrowFunctions: true } }, - { code: "class Foo {}\nexport default Foo;", ecmaFeatures: { modules: true, classes: true } }, - { code: "new Date", globals: {Date: false} }, - { code: "new Date", globals: {} }, - { code: "var eslint = require('eslint');", globals: {require: false} }, - { code: "var fun = function({x}) {return x;};", ecmaFeatures: { destructuring: true } }, - { code: "var fun = function([,x]) {return x;};", ecmaFeatures: { destructuring: true } }, - "function f(a) { return a.b; }", - "var a = { \"foo\": 3 };", - "var a = { foo: 3 };", - "var a = { foo: 3, bar: 5 };", - "var a = { set foo(a){}, get bar(){} };", - "function f(a) { return arguments[0]; }", - "function f() { }; var a = f;", - "var a = f; function f() { };", - "function f(){ for(var i; i; i) i; }", - "function f(){ for(var a=0, b=1; a; b) a, b; }", - "function f(){ for(var a in {}) a; }", - "function f(){ switch(2) { case 1: var b = 2; b; break; default: b; break;} b; }", - "a:;", - { code: "const React = require(\"react/addons\");const cx = React.addons.classSet;", globals: { require: false }, ecmaFeatures: { globalReturn: true, modules: true, blockBindings: true }}, - { code: "var v = 1; function x() { return v; };", ecmaFeatures: { globalReturn: true }}, - { code: "import * as y from \"./other.js\"; y();", ecmaFeatures: { modules: true }}, - { code: "import y from \"./other.js\"; y();", ecmaFeatures: { modules: true }}, - { code: "import {x as y} from \"./other.js\"; y();", ecmaFeatures: { modules: true }}, - { code: "var x; export {x};", ecmaFeatures: { modules: true }}, - { code: "var x; export {x as v};", ecmaFeatures: { modules: true }}, - { code: "export {x} from \"./other.js\";", ecmaFeatures: { modules: true }}, - { code: "export {x as v} from \"./other.js\";", ecmaFeatures: { modules: true }}, - { code: "class Test { myFunction() { return true; }}", ecmaFeatures: { classes: true }}, - { code: "class Test { get flag() { return true; }}", ecmaFeatures: { classes: true }}, - { code: "var Test = class { myFunction() { return true; }}", ecmaFeatures: { classes: true }}, - { code: "var doStuff; let {x: y} = {x: 1}; doStuff(y);", ecmaFeatures: { blockBindings: true, destructuring: true }}, - { code: "function foo({x: y}) { return y; }", ecmaFeatures: { blockBindings: true, destructuring: true }}, - - // Babel-specific test-cases. - { code: "export x from \"./other.js\";", parser: "babel-eslint", ecmaFeatures: {modules: true} }, - { code: "export * as x from \"./other.js\";", parser: "babel-eslint", ecmaFeatures: {modules: true} }, - ], - invalid: [ - { code: "!function f(){}; f", errors: [{ message: "\"f\" used outside of binding context." }] }, - { code: "var f = function foo() { }; foo(); var exports = { f: foo };", errors: [{ message: "\"foo\" used outside of binding context." }, { message: "\"foo\" used outside of binding context."}] }, - { code: "var f = () => { x; }", ecmaFeatures: { arrowFunctions: true }, errors: [{ message: "\"x\" used outside of binding context.", type: "Identifier" }] }, - { code: "function f(){ x; }", errors: [{ message: "\"x\" used outside of binding context.", type: "Identifier" }] }, - { code: "function f(){ x; { var x; } }", errors: [{ message: "\"x\" used outside of binding context.", type: "Identifier" }] }, - { code: "function f(){ { var x; } x; }", errors: [{ message: "\"x\" used outside of binding context.", type: "Identifier" }] }, - { code: "function f() { var a; { var b = 0; } a = b; }", errors: [{ message: "\"b\" used outside of binding context.", type: "Identifier" }] }, - { code: "function f() { try { var a = 0; } catch (e) { var b = a; } }", errors: [{ message: "\"a\" used outside of binding context.", type: "Identifier" }] }, - { code: "var eslint = require('eslint');", globals: {}, errors: [{ message: "\"require\" used outside of binding context.", type: "Identifier" }] }, - { code: "function f(a) { return a[b]; }", errors: [{ message: "\"b\" used outside of binding context.", type: "Identifier" }] }, - { code: "function f() { return b.a; }", errors: [{ message: "\"b\" used outside of binding context.", type: "Identifier" }] }, - { code: "var a = { foo: bar };", errors: [{ message: "\"bar\" used outside of binding context.", type: "Identifier" }] }, - { code: "var a = { foo: foo };", errors: [{ message: "\"foo\" used outside of binding context.", type: "Identifier" }] }, - { code: "var a = { bar: 7, foo: bar };", errors: [{ message: "\"bar\" used outside of binding context.", type: "Identifier" }] }, - { code: "var a = arguments;", errors: [{ message: "\"arguments\" used outside of binding context.", type: "Identifier" }] }, - { code: "function x(){}; var a = arguments;", errors: [{ message: "\"arguments\" used outside of binding context.", type: "Identifier" }] }, - { code: "function z(b){}; var a = b;", errors: [{ message: "\"b\" used outside of binding context.", type: "Identifier" }] }, - { code: "function z(){var b;}; var a = b;", errors: [{ message: "\"b\" used outside of binding context.", type: "Identifier" }] }, - { code: "function f(){ try{}catch(e){} e }", errors: [{ message: "\"e\" used outside of binding context.", type: "Identifier" }] }, - { code: "a:b;", errors: [{ message: "\"b\" used outside of binding context.", type: "Identifier" }] }, - { - code: "function a() { for(var b in {}) { var c = b; } c; }", - errors: [{ message: "\"c\" used outside of binding context.", type: "Identifier" }] - }, - { - code: "function a() { for(var b of {}) { var c = b;} c; }", - ecmaFeatures: { forOf: true }, - errors: [{ message: "\"c\" used outside of binding context.", type: "Identifier" }] - } - ] -}); diff --git a/eslint/babel-eslint-plugin/tests/generator-star-spacing.js b/eslint/babel-eslint-plugin/tests/generator-star-spacing.js index 4de1141b1023..cf93add7c9e0 100644 --- a/eslint/babel-eslint-plugin/tests/generator-star-spacing.js +++ b/eslint/babel-eslint-plugin/tests/generator-star-spacing.js @@ -1,14 +1,13 @@ /* eslint-disable */ -var linter = require('eslint').linter - , ESLintTester = require('eslint-tester') - , eslintTester = new ESLintTester(linter); +var rule = require('../rules/generator-star-spacing'), + RuleTester = require('eslint').RuleTester; var features = { generators: true }; function ok(code, args){ - return { code: code, args: args, parser: 'babel-eslint', ecmaFeatures: features } + return { code: code, options: args, parser: 'babel-eslint', ecmaFeatures: features } } function err(code, errors, args){ @@ -17,30 +16,10 @@ function err(code, errors, args){ return e } -var features = { - generators: true -}; - -function ok(code, args){ - return { code: code, args: args, parser: 'babel-eslint', ecmaFeatures: features } -} - -function err(code, errors, args){ - var e = ok(code, args) - e.errors = errors - return e -} - - -eslintTester.addRuleTest('rules/generator-star-spacing', { +var ruleTester = new RuleTester(); +ruleTester.run('babel/generator-star-spacing', rule, { valid: [ - ok('var test = async function(){}'), - ok('async function test(){}'), - ok('var test = async function *(){}'), - ok('async function *test(){}', [1, "before"]) , - ok('async function* test(){}', [1, "after"]), - ok('async function * test(){}', [1, "both"]), - ok('async function*test(){}', [1, "neither"]), + // Default ("before") { code: "function foo(){}" }, @@ -88,244 +67,462 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { // "before" { code: "function foo(){}", - args: [2, "before"] + options: ["before"] }, { code: "function *foo(){}", - args: [2, "before"], + options: ["before"], ecmaFeatures: { generators: true } }, { code: "function *foo(arg1, arg2){}", - args: [2, "before"], + options: ["before"], ecmaFeatures: { generators: true } }, { code: "var foo = function *foo(){};", - args: [2, "before"], + options: ["before"], ecmaFeatures: { generators: true } }, { code: "var foo = function *(){};", - args: [2, "before"], + options: ["before"], ecmaFeatures: { generators: true } }, { code: "var foo = function * (){};", - args: [2, "before"], + options: ["before"], ecmaFeatures: { generators: true } }, { code: "var foo = { *foo(){} };", - args: [2, "before"], + options: ["before"], ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } }, { code: "var foo = {*foo(){} };", - args: [2, "before"], + options: ["before"], ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } }, { code: "class Foo { *foo(){} }", - args: [2, "before"], + options: ["before"], ecmaFeatures: { classes: true, generators: true } }, { code: "class Foo {*foo(){} }", - args: [2, "before"], + options: ["before"], ecmaFeatures: { classes: true, generators: true } }, { code: "class Foo { static *foo(){} }", - args: [2, "before"], + options: ["before"], ecmaFeatures: { classes: true, generators: true } }, // "after" { code: "function foo(){}", - args: [2, "after"] + options: ["after"] }, { code: "function* foo(){}", - args: [2, "after"], + options: ["after"], ecmaFeatures: { generators: true } }, { code: "function* foo(arg1, arg2){}", - args: [2, "after"], + options: ["after"], ecmaFeatures: { generators: true } }, { code: "var foo = function* foo(){};", - args: [2, "after"], + options: ["after"], ecmaFeatures: { generators: true } }, { code: "var foo = function* (){};", - args: [2, "after"], + options: ["after"], ecmaFeatures: { generators: true } }, { code: "var foo = function*(){};", - args: [2, "after"], + options: ["after"], ecmaFeatures: { generators: true } }, { code: "var foo = {* foo(){} };", - args: [2, "after"], + options: ["after"], ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } }, { code: "var foo = { * foo(){} };", - args: [2, "after"], + options: ["after"], ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } }, { code: "class Foo {* foo(){} }", - args: [2, "after"], + options: ["after"], ecmaFeatures: { classes: true, generators: true } }, { code: "class Foo { * foo(){} }", - args: [2, "after"], + options: ["after"], ecmaFeatures: { classes: true, generators: true } }, { code: "class Foo { static* foo(){} }", - args: [2, "after"], + options: ["after"], ecmaFeatures: { classes: true, generators: true } }, // "both" { code: "function foo(){}", - args: [2, "both"] + options: ["both"] }, { code: "function * foo(){}", - args: [2, "both"], + options: ["both"], ecmaFeatures: { generators: true } }, { code: "function * foo(arg1, arg2){}", - args: [2, "both"], + options: ["both"], ecmaFeatures: { generators: true } }, { code: "var foo = function * foo(){};", - args: [2, "both"], + options: ["both"], ecmaFeatures: { generators: true } }, { code: "var foo = function * (){};", - args: [2, "both"], + options: ["both"], ecmaFeatures: { generators: true } }, { code: "var foo = function *(){};", - args: [2, "both"], + options: ["both"], ecmaFeatures: { generators: true } }, { code: "var foo = { * foo(){} };", - args: [2, "both"], + options: ["both"], ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } }, { code: "var foo = {* foo(){} };", - args: [2, "both"], + options: ["both"], ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } }, { code: "class Foo { * foo(){} }", - args: [2, "both"], + options: ["both"], ecmaFeatures: { classes: true, generators: true } }, { code: "class Foo {* foo(){} }", - args: [2, "both"], + options: ["both"], ecmaFeatures: { classes: true, generators: true } }, { code: "class Foo { static * foo(){} }", - args: [2, "both"], + options: ["both"], ecmaFeatures: { classes: true, generators: true } }, // "neither" { code: "function foo(){}", - args: [2, "neither"] + options: ["neither"] + }, + { + code: "function*foo(){}", + options: ["neither"], + ecmaFeatures: { generators: true } + }, + { + code: "function*foo(arg1, arg2){}", + options: ["neither"], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = function*foo(){};", + options: ["neither"], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = function*(){};", + options: ["neither"], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = function* (){};", + options: ["neither"], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = {*foo(){} };", + options: ["neither"], + ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } + }, + { + code: "var foo = { *foo(){} };", + options: ["neither"], + ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } + }, + { + code: "class Foo {*foo(){} }", + options: ["neither"], + ecmaFeatures: { classes: true, generators: true } + }, + { + code: "class Foo { *foo(){} }", + options: ["neither"], + ecmaFeatures: { classes: true, generators: true } + }, + { + code: "class Foo { static*foo(){} }", + options: ["neither"], + ecmaFeatures: { classes: true, generators: true } + }, + + // {"before": true, "after": false} + { + code: "function foo(){}", + options: [{"before": true, "after": false}] + }, + { + code: "function *foo(){}", + options: [{"before": true, "after": false}], + ecmaFeatures: { generators: true } + }, + { + code: "function *foo(arg1, arg2){}", + options: [{"before": true, "after": false}], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = function *foo(){};", + options: [{"before": true, "after": false}], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = function *(){};", + options: [{"before": true, "after": false}], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = function * (){};", + options: [{"before": true, "after": false}], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = { *foo(){} };", + options: [{"before": true, "after": false}], + ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } + }, + { + code: "var foo = {*foo(){} };", + options: [{"before": true, "after": false}], + ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } + }, + { + code: "class Foo { *foo(){} }", + options: [{"before": true, "after": false}], + ecmaFeatures: { classes: true, generators: true } + }, + { + code: "class Foo {*foo(){} }", + options: [{"before": true, "after": false}], + ecmaFeatures: { classes: true, generators: true } + }, + { + code: "class Foo { static *foo(){} }", + options: [{"before": true, "after": false}], + ecmaFeatures: { classes: true, generators: true } + }, + + // {"before": false, "after": true} + { + code: "function foo(){}", + options: [{"before": false, "after": true}] + }, + { + code: "function* foo(){}", + options: [{"before": false, "after": true}], + ecmaFeatures: { generators: true } + }, + { + code: "function* foo(arg1, arg2){}", + options: [{"before": false, "after": true}], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = function* foo(){};", + options: [{"before": false, "after": true}], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = function* (){};", + options: [{"before": false, "after": true}], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = function*(){};", + options: [{"before": false, "after": true}], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = {* foo(){} };", + options: [{"before": false, "after": true}], + ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } + }, + { + code: "var foo = { * foo(){} };", + options: [{"before": false, "after": true}], + ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } + }, + { + code: "class Foo {* foo(){} }", + options: [{"before": false, "after": true}], + ecmaFeatures: { classes: true, generators: true } + }, + { + code: "class Foo { * foo(){} }", + options: [{"before": false, "after": true}], + ecmaFeatures: { classes: true, generators: true } + }, + { + code: "class Foo { static* foo(){} }", + options: [{"before": false, "after": true}], + ecmaFeatures: { classes: true, generators: true } + }, + + // {"before": true, "after": true} + { + code: "function foo(){}", + options: [{"before": true, "after": true}] + }, + { + code: "function * foo(){}", + options: [{"before": true, "after": true}], + ecmaFeatures: { generators: true } + }, + { + code: "function * foo(arg1, arg2){}", + options: [{"before": true, "after": true}], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = function * foo(){};", + options: [{"before": true, "after": true}], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = function * (){};", + options: [{"before": true, "after": true}], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = function *(){};", + options: [{"before": true, "after": true}], + ecmaFeatures: { generators: true } + }, + { + code: "var foo = { * foo(){} };", + options: [{"before": true, "after": true}], + ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } + }, + { + code: "var foo = {* foo(){} };", + options: [{"before": true, "after": true}], + ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } + }, + { + code: "class Foo { * foo(){} }", + options: [{"before": true, "after": true}], + ecmaFeatures: { classes: true, generators: true } + }, + { + code: "class Foo {* foo(){} }", + options: [{"before": true, "after": true}], + ecmaFeatures: { classes: true, generators: true } + }, + { + code: "class Foo { static * foo(){} }", + options: [{"before": true, "after": true}], + ecmaFeatures: { classes: true, generators: true } + }, + + // {"before": false, "after": false} + { + code: "function foo(){}", + options: [{"before": false, "after": false}] }, { code: "function*foo(){}", - args: [2, "neither"], + options: [{"before": false, "after": false}], ecmaFeatures: { generators: true } }, { code: "function*foo(arg1, arg2){}", - args: [2, "neither"], + options: [{"before": false, "after": false}], ecmaFeatures: { generators: true } }, { code: "var foo = function*foo(){};", - args: [2, "neither"], + options: [{"before": false, "after": false}], ecmaFeatures: { generators: true } }, { code: "var foo = function*(){};", - args: [2, "neither"], + options: [{"before": false, "after": false}], ecmaFeatures: { generators: true } }, { code: "var foo = function* (){};", - args: [2, "neither"], + options: [{"before": false, "after": false}], ecmaFeatures: { generators: true } }, { code: "var foo = {*foo(){} };", - args: [2, "neither"], + options: [{"before": false, "after": false}], ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } }, { code: "var foo = { *foo(){} };", - args: [2, "neither"], + options: [{"before": false, "after": false}], ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } }, { code: "class Foo {*foo(){} }", - args: [2, "neither"], + options: [{"before": false, "after": false}], ecmaFeatures: { classes: true, generators: true } }, { code: "class Foo { *foo(){} }", - args: [2, "neither"], + options: [{"before": false, "after": false}], ecmaFeatures: { classes: true, generators: true } }, { code: "class Foo { static*foo(){} }", - args: [2, "neither"], + options: [{"before": false, "after": false}], ecmaFeatures: { classes: true, generators: true } - } + }, + ok('var test = async function(){}'), + ok('async function test(){}'), + ok('var test = async function *(){}'), + ok('async function *test(){}', ["before"]) , + ok('async function* test(){}', ["after"]), + ok('async function * test(){}', ["both"]), + ok('async function*test(){}', ["neither"]), ], invalid: [ // Default ("before") - err('async function*test(){}', [ - { message: 'Missing space before *.' }, - ]), - err('async function* test(){}', [ - { - message: "Missing space before *.", - type: "Punctuator" - }, { - message: "Unexpected space after *.", - type: "Punctuator" - } - ]), - { code: "function*foo(){}", ecmaFeatures: { generators: true }, @@ -392,7 +589,7 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { // "before" { code: "function*foo(){}", - args: [2, "before"], + options: ["before"], ecmaFeatures: { generators: true }, errors: [{ message: "Missing space before *.", @@ -401,7 +598,7 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { }, { code: "function* foo(arg1, arg2){}", - args: [2, "before"], + options: ["before"], ecmaFeatures: { generators: true }, errors: [{ message: "Missing space before *.", @@ -413,7 +610,7 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { }, { code: "var foo = function*foo(){};", - args: [2, "before"], + options: ["before"], ecmaFeatures: { generators: true }, errors: [{ message: "Missing space before *.", @@ -422,7 +619,7 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { }, { code: "var foo = function* (){};", - args: [2, "before"], + options: ["before"], ecmaFeatures: { generators: true }, errors: [{ message: "Missing space before *.", @@ -431,7 +628,7 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { }, { code: "var foo = {* foo(){} };", - args: [2, "before"], + options: ["before"], ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true }, errors: [{ message: "Unexpected space after *.", @@ -440,7 +637,7 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { }, { code: "class Foo {* foo(){} }", - args: [2, "before"], + options: ["before"], ecmaFeatures: { classes: true, generators: true }, errors: [{ message: "Unexpected space after *.", @@ -451,7 +648,7 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { // "after" { code: "function*foo(){}", - args: [2, "after"], + options: ["after"], ecmaFeatures: { generators: true }, errors: [{ message: "Missing space after *.", @@ -460,7 +657,7 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { }, { code: "function *foo(arg1, arg2){}", - args: [2, "after"], + options: ["after"], ecmaFeatures: { generators: true }, errors: [{ message: "Unexpected space before *.", @@ -472,7 +669,7 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { }, { code: "var foo = function *foo(){};", - args: [2, "after"], + options: ["after"], ecmaFeatures: { generators: true }, errors: [{ message: "Unexpected space before *.", @@ -484,7 +681,7 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { }, { code: "var foo = function *(){};", - args: [2, "after"], + options: ["after"], ecmaFeatures: { generators: true }, errors: [{ message: "Unexpected space before *.", @@ -493,7 +690,7 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { }, { code: "var foo = { *foo(){} };", - args: [2, "after"], + options: ["after"], ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true }, errors: [{ message: "Missing space after *.", @@ -502,7 +699,7 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { }, { code: "class Foo { *foo(){} }", - args: [2, "after"], + options: ["after"], ecmaFeatures: { classes: true, generators: true }, errors: [{ message: "Missing space after *.", @@ -511,7 +708,7 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { }, { code: "class Foo { static *foo(){} }", - args: [2, "after"], + options: ["after"], ecmaFeatures: { classes: true, generators: true }, errors: [{ message: "Unexpected space before *.", @@ -525,7 +722,7 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { // "both" { code: "function*foo(){}", - args: [2, "both"], + options: ["both"], ecmaFeatures: { generators: true }, errors: [{ message: "Missing space before *.", @@ -537,7 +734,7 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { }, { code: "function*foo(arg1, arg2){}", - args: [2, "both"], + options: ["both"], ecmaFeatures: { generators: true }, errors: [{ message: "Missing space before *.", @@ -549,7 +746,7 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { }, { code: "var foo = function*foo(){};", - args: [2, "both"], + options: ["both"], ecmaFeatures: { generators: true }, errors: [{ message: "Missing space before *.", @@ -561,7 +758,7 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { }, { code: "var foo = function*(){};", - args: [2, "both"], + options: ["both"], ecmaFeatures: { generators: true }, errors: [{ message: "Missing space before *.", @@ -570,7 +767,7 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { }, { code: "var foo = {*foo(){} };", - args: [2, "both"], + options: ["both"], ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true }, errors: [{ message: "Missing space after *.", @@ -579,7 +776,7 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { }, { code: "class Foo {*foo(){} }", - args: [2, "both"], + options: ["both"], ecmaFeatures: { classes: true, generators: true }, errors: [{ message: "Missing space after *.", @@ -588,7 +785,7 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { }, { code: "class Foo { static*foo(){} }", - args: [2, "both"], + options: ["both"], ecmaFeatures: { classes: true, generators: true }, errors: [{ message: "Missing space before *.", @@ -602,7 +799,7 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { // "neither" { code: "function * foo(){}", - args: [2, "neither"], + options: ["neither"], ecmaFeatures: { generators: true }, errors: [{ message: "Unexpected space before *.", @@ -614,7 +811,7 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { }, { code: "function * foo(arg1, arg2){}", - args: [2, "neither"], + options: ["neither"], ecmaFeatures: { generators: true }, errors: [{ message: "Unexpected space before *.", @@ -626,7 +823,7 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { }, { code: "var foo = function * foo(){};", - args: [2, "neither"], + options: ["neither"], ecmaFeatures: { generators: true }, errors: [{ message: "Unexpected space before *.", @@ -638,7 +835,7 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { }, { code: "var foo = function * (){};", - args: [2, "neither"], + options: ["neither"], ecmaFeatures: { generators: true }, errors: [{ message: "Unexpected space before *.", @@ -647,7 +844,7 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { }, { code: "var foo = { * foo(){} };", - args: [2, "neither"], + options: ["neither"], ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true }, errors: [{ message: "Unexpected space after *.", @@ -656,7 +853,7 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { }, { code: "class Foo { * foo(){} }", - args: [2, "neither"], + options: ["neither"], ecmaFeatures: { classes: true, generators: true }, errors: [{ message: "Unexpected space after *.", @@ -665,7 +862,7 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { }, { code: "class Foo { static * foo(){} }", - args: [2, "neither"], + options: ["neither"], ecmaFeatures: { classes: true, generators: true }, errors: [{ message: "Unexpected space before *.", @@ -674,7 +871,306 @@ eslintTester.addRuleTest('rules/generator-star-spacing', { message: "Unexpected space after *.", type: "Punctuator" }] - } + }, + + // {"before": true, "after": false} + { + code: "function*foo(){}", + options: [{"before": true, "after": false}], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Missing space before *.", + type: "Punctuator" + }] + }, + { + code: "function* foo(arg1, arg2){}", + options: [{"before": true, "after": false}], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Missing space before *.", + type: "Punctuator" + }, { + message: "Unexpected space after *.", + type: "Punctuator" + }] + }, + { + code: "var foo = function*foo(){};", + options: [{"before": true, "after": false}], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Missing space before *.", + type: "Punctuator" + }] + }, + { + code: "var foo = function* (){};", + options: [{"before": true, "after": false}], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Missing space before *.", + type: "Punctuator" + }] + }, + { + code: "var foo = {* foo(){} };", + options: [{"before": true, "after": false}], + ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true }, + errors: [{ + message: "Unexpected space after *.", + type: "Punctuator" + }] + }, + { + code: "class Foo {* foo(){} }", + options: [{"before": true, "after": false}], + ecmaFeatures: { classes: true, generators: true }, + errors: [{ + message: "Unexpected space after *.", + type: "Punctuator" + }] + }, + + // {"before": false, "after": true} + { + code: "function*foo(){}", + options: [{"before": false, "after": true}], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Missing space after *.", + type: "Punctuator" + }] + }, + { + code: "function *foo(arg1, arg2){}", + options: [{"before": false, "after": true}], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Unexpected space before *.", + type: "Punctuator" + }, { + message: "Missing space after *.", + type: "Punctuator" + }] + }, + { + code: "var foo = function *foo(){};", + options: [{"before": false, "after": true}], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Unexpected space before *.", + type: "Punctuator" + }, { + message: "Missing space after *.", + type: "Punctuator" + }] + }, + { + code: "var foo = function *(){};", + options: [{"before": false, "after": true}], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Unexpected space before *.", + type: "Punctuator" + }] + }, + { + code: "var foo = { *foo(){} };", + options: [{"before": false, "after": true}], + ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true }, + errors: [{ + message: "Missing space after *.", + type: "Punctuator" + }] + }, + { + code: "class Foo { *foo(){} }", + options: [{"before": false, "after": true}], + ecmaFeatures: { classes: true, generators: true }, + errors: [{ + message: "Missing space after *.", + type: "Punctuator" + }] + }, + { + code: "class Foo { static *foo(){} }", + options: [{"before": false, "after": true}], + ecmaFeatures: { classes: true, generators: true }, + errors: [{ + message: "Unexpected space before *.", + type: "Punctuator" + }, { + message: "Missing space after *.", + type: "Punctuator" + }] + }, + + // {"before": true, "after": true} + { + code: "function*foo(){}", + options: [{"before": true, "after": true}], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Missing space before *.", + type: "Punctuator" + }, { + message: "Missing space after *.", + type: "Punctuator" + }] + }, + { + code: "function*foo(arg1, arg2){}", + options: [{"before": true, "after": true}], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Missing space before *.", + type: "Punctuator" + }, { + message: "Missing space after *.", + type: "Punctuator" + }] + }, + { + code: "var foo = function*foo(){};", + options: [{"before": true, "after": true}], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Missing space before *.", + type: "Punctuator" + }, { + message: "Missing space after *.", + type: "Punctuator" + }] + }, + { + code: "var foo = function*(){};", + options: [{"before": true, "after": true}], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Missing space before *.", + type: "Punctuator" + }] + }, + { + code: "var foo = {*foo(){} };", + options: [{"before": true, "after": true}], + ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true }, + errors: [{ + message: "Missing space after *.", + type: "Punctuator" + }] + }, + { + code: "class Foo {*foo(){} }", + options: [{"before": true, "after": true}], + ecmaFeatures: { classes: true, generators: true }, + errors: [{ + message: "Missing space after *.", + type: "Punctuator" + }] + }, + { + code: "class Foo { static*foo(){} }", + options: [{"before": true, "after": true}], + ecmaFeatures: { classes: true, generators: true }, + errors: [{ + message: "Missing space before *.", + type: "Punctuator" + }, { + message: "Missing space after *.", + type: "Punctuator" + }] + }, + + // {"before": false, "after": false} + { + code: "function * foo(){}", + options: [{"before": false, "after": false}], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Unexpected space before *.", + type: "Punctuator" + }, { + message: "Unexpected space after *.", + type: "Punctuator" + }] + }, + { + code: "function * foo(arg1, arg2){}", + options: [{"before": false, "after": false}], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Unexpected space before *.", + type: "Punctuator" + }, { + message: "Unexpected space after *.", + type: "Punctuator" + }] + }, + { + code: "var foo = function * foo(){};", + options: [{"before": false, "after": false}], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Unexpected space before *.", + type: "Punctuator" + }, { + message: "Unexpected space after *.", + type: "Punctuator" + }] + }, + { + code: "var foo = function * (){};", + options: [{"before": false, "after": false}], + ecmaFeatures: { generators: true }, + errors: [{ + message: "Unexpected space before *.", + type: "Punctuator" + }] + }, + { + code: "var foo = { * foo(){} };", + options: [{"before": false, "after": false}], + ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true }, + errors: [{ + message: "Unexpected space after *.", + type: "Punctuator" + }] + }, + { + code: "class Foo { * foo(){} }", + options: [{"before": false, "after": false}], + ecmaFeatures: { classes: true, generators: true }, + errors: [{ + message: "Unexpected space after *.", + type: "Punctuator" + }] + }, + { + code: "class Foo { static * foo(){} }", + options: [{"before": false, "after": false}], + ecmaFeatures: { classes: true, generators: true }, + errors: [{ + message: "Unexpected space before *.", + type: "Punctuator" + }, { + message: "Unexpected space after *.", + type: "Punctuator" + }] + }, + err('async function*test(){}', [ + { message: 'Missing space before *.' }, + ]), + err('async function* test(){}', [ + { + message: "Missing space before *.", + type: "Punctuator" + }, { + message: "Unexpected space after *.", + type: "Punctuator" + } + ]), ] -}); \ No newline at end of file +}); diff --git a/eslint/babel-eslint-plugin/tests/generator-star.js b/eslint/babel-eslint-plugin/tests/generator-star.js deleted file mode 100644 index 131d41f9c667..000000000000 --- a/eslint/babel-eslint-plugin/tests/generator-star.js +++ /dev/null @@ -1,32 +0,0 @@ -/* eslint-disable */ -var linter = require('eslint').linter - , ESLintTester = require('eslint-tester') - , eslintTester = new ESLintTester(linter); - -var features = { - generators: true -}; - -function ok(code, args){ - return { code: code, args: args, parser: 'babel-eslint', ecmaFeatures: features } -} - -function err(code, errors, args){ - var e = ok(code, args) - e.errors = errors - return e -} - - -eslintTester.addRuleTest('rules/generator-star', { - valid: [ - ok('async function test(){}'), - ok('async function *test(){}', [1, "end"]) , - ok('async function* test(){}', [1, "start"]), - ok('async function * test(){}', [1, "middle"]) - ], - invalid: [ - err('async function* test(){}', [ { message: 'Expected a space before *.' }]), - err('async function *test(){}', [ { message: 'Expected no space before *.' }], [1, 'start']) - ] -}); \ No newline at end of file diff --git a/eslint/babel-eslint-plugin/tests/new-cap.js b/eslint/babel-eslint-plugin/tests/new-cap.js index d25f5d2ad362..b7a9da45a0e1 100644 --- a/eslint/babel-eslint-plugin/tests/new-cap.js +++ b/eslint/babel-eslint-plugin/tests/new-cap.js @@ -5,12 +5,11 @@ * @author Nicholas C. Zakas */ -var linter = require('eslint').linter - , ESLintTester = require('eslint-tester') - , eslintTester = new ESLintTester(linter); +var rule = require('../rules/new-cap'), + RuleTester = require('eslint').RuleTester; - -eslintTester.addRuleTest("rules/new-cap", { +var ruleTester = new RuleTester(); +ruleTester.run('babel/new-cap', rule, { valid: [ // Original test cases. "var x = new Constructor();", @@ -38,17 +37,22 @@ eslintTester.addRuleTest("rules/new-cap", { "var x = Symbol('symbol')", "var x = _();", "var x = $();", - { code: "var x = Foo(42)", args: [1, {"capIsNew": false}] }, - { code: "var x = bar.Foo(42)", args: [1, {"capIsNew": false}] }, + { code: "var x = Foo(42)", options: [{"capIsNew": false}] }, + { code: "var x = bar.Foo(42)", options: [{"capIsNew": false}] }, "var x = bar[Foo](42)", - {code: "var x = bar['Foo'](42)", args: [1, {"capIsNew": false}] }, + {code: "var x = bar['Foo'](42)", options: [{"capIsNew": false}] }, "var x = Foo.bar(42)", - { code: "var x = new foo(42)", args: [1, {"newIsCap": false}] }, - "var o = { 1: function () {} }; o[1]();", - "var o = { 1: function () {} }; new o[1]();", - { code: "var x = Foo(42);", args: [1, { capIsNew: true, capIsNewExceptions: ["Foo"] }] }, - { code: "var x = new foo(42);", args: [1, { newIsCap: true, newIsCapExceptions: ["foo"] }] }, - { code: "var x = Object(42);", args: [1, { capIsNewExceptions: ["Foo"] }] }, + { code: "var x = new foo(42)", options: [{"newIsCap": false}] }, + "var o = { 1: function() {} }; o[1]();", + "var o = { 1: function() {} }; new o[1]();", + { code: "var x = Foo(42);", options: [{ capIsNew: true, capIsNewExceptions: ["Foo"] }] }, + { code: "var x = new foo(42);", options: [{ newIsCap: true, newIsCapExceptions: ["foo"] }] }, + { code: "var x = Object(42);", options: [{ capIsNewExceptions: ["Foo"] }] }, + + { code: "var x = Foo.Bar(42);", options: [{ capIsNewExceptions: ["Bar"] }] }, + { code: "var x = Foo.Bar(42);", options: [{ capIsNewExceptions: ["Foo.Bar"] }] }, + { code: "var x = new foo.bar(42);", options: [{ newIsCapExceptions: ["bar"] }] }, + { code: "var x = new foo.bar(42);", options: [{ newIsCapExceptions: ["foo.bar"] }] }, // Babel-specific test cases. { code: "@MyDecorator(123) class MyClass{}", parser: "babel-eslint" }, @@ -70,7 +74,7 @@ eslintTester.addRuleTest("rules/new-cap", { message: "A function with a name starting with an uppercase letter should only be used as a constructor.", type: "CallExpression", line: 1, - column: 10 + column: 11 } ] }, @@ -81,7 +85,7 @@ eslintTester.addRuleTest("rules/new-cap", { message: "A function with a name starting with an uppercase letter should only be used as a constructor.", type: "CallExpression", line: 2, - column: 1 + column: 2 } ] }, @@ -92,7 +96,7 @@ eslintTester.addRuleTest("rules/new-cap", { message: "A constructor name should not start with a lowercase letter.", type: "NewExpression", line: 1, - column: 14 + column: 15 } ] }, @@ -103,7 +107,7 @@ eslintTester.addRuleTest("rules/new-cap", { message: "A constructor name should not start with a lowercase letter.", type: "NewExpression", line: 2, - column: 0 + column: 1 } ] }, @@ -114,9 +118,20 @@ eslintTester.addRuleTest("rules/new-cap", { message: "A constructor name should not start with a lowercase letter.", type: "NewExpression", line: 1, - column: 12 + column: 13 } ] + }, + + { + code: "var x = Foo.Bar(42);", + options: [{capIsNewExceptions: ["Foo"]}], + errors: [{type: "CallExpression", message: "A function with a name starting with an uppercase letter should only be used as a constructor."}] + }, + { + code: "var x = new foo.bar(42);", + options: [{newIsCapExceptions: ["foo"]}], + errors: [{type: "NewExpression", message: "A constructor name should not start with a lowercase letter."}] } ] }); diff --git a/eslint/babel-eslint-plugin/tests/object-curly-spacing.js b/eslint/babel-eslint-plugin/tests/object-curly-spacing.js index fb97a70130bb..4b13e9d43d91 100644 --- a/eslint/babel-eslint-plugin/tests/object-curly-spacing.js +++ b/eslint/babel-eslint-plugin/tests/object-curly-spacing.js @@ -8,11 +8,11 @@ * @copyright 2015 Mathieu M-Gosselin. All rights reserved. */ -var linter = require('eslint').linter - , ESLintTester = require('eslint-tester') - , eslintTester = new ESLintTester(linter); +var rule = require('../rules/object-curly-spacing'), + RuleTester = require('eslint').RuleTester; -eslintTester.addRuleTest("rules/object-curly-spacing", { +var ruleTester = new RuleTester(); +ruleTester.run('babel/object-curly-spacing', rule, { valid: [ @@ -111,13 +111,13 @@ eslintTester.addRuleTest("rules/object-curly-spacing", { message: "A space is required after '{'", type: "ImportDeclaration", line: 1, - column: 7 + column: 8 }, { message: "A space is required before '}'", type: "ImportDeclaration", line: 1, - column: 11 + column: 12 } ] }, @@ -132,13 +132,13 @@ eslintTester.addRuleTest("rules/object-curly-spacing", { message: "A space is required after '{'", type: "ExportNamedDeclaration", line: 1, - column: 7 + column: 8 }, { message: "A space is required before '}'", type: "ExportNamedDeclaration", line: 1, - column: 11 + column: 12 } ] }, @@ -174,7 +174,7 @@ eslintTester.addRuleTest("rules/object-curly-spacing", { message: "There should be no space before '}'", type: "ObjectExpression", line: 1, - column: 42 + column: 43 } ] }, @@ -186,7 +186,7 @@ eslintTester.addRuleTest("rules/object-curly-spacing", { message: "There should be no space before '}'", type: "ObjectExpression", line: 1, - column: 60 + column: 61 } ] }, @@ -201,7 +201,7 @@ eslintTester.addRuleTest("rules/object-curly-spacing", { message: "A space is required before '}'", type: "ObjectPattern", line: 1, - column: 8 + column: 9 } ] }, @@ -214,7 +214,7 @@ eslintTester.addRuleTest("rules/object-curly-spacing", { message: "There should be no space before '}'", type: "ObjectPattern", line: 1, - column: 8 + column: 9 } ] }, @@ -228,7 +228,7 @@ eslintTester.addRuleTest("rules/object-curly-spacing", { message: "A space is required before '}'", type: "ObjectExpression", line: 1, - column: 38 + column: 39 } ] }, @@ -240,7 +240,7 @@ eslintTester.addRuleTest("rules/object-curly-spacing", { message: "A space is required before '}'", type: "ObjectExpression", line: 1, - column: 54 + column: 55 } ] }, @@ -254,13 +254,13 @@ eslintTester.addRuleTest("rules/object-curly-spacing", { message: "A space is required after '{'", type: "ObjectExpression", line: 1, - column: 10 + column: 11 }, { message: "A space is required before '}'", type: "ObjectExpression", line: 1, - column: 29 + column: 30 } ] }, @@ -272,7 +272,7 @@ eslintTester.addRuleTest("rules/object-curly-spacing", { message: "A space is required after '{'", type: "ObjectExpression", line: 1, - column: 10 + column: 11 } ] }, @@ -284,7 +284,7 @@ eslintTester.addRuleTest("rules/object-curly-spacing", { message: "A space is required before '}'", type: "ObjectExpression", line: 1, - column: 30 + column: 31 } ] }, @@ -296,13 +296,13 @@ eslintTester.addRuleTest("rules/object-curly-spacing", { message: "There should be no space after '{'", type: "ObjectExpression", line: 1, - column: 10 + column: 11 }, { message: "There should be no space before '}'", type: "ObjectExpression", line: 1, - column: 31 + column: 32 } ] }, @@ -314,7 +314,7 @@ eslintTester.addRuleTest("rules/object-curly-spacing", { message: "There should be no space before '}'", type: "ObjectExpression", line: 1, - column: 30 + column: 31 } ] }, @@ -326,7 +326,7 @@ eslintTester.addRuleTest("rules/object-curly-spacing", { message: "There should be no space after '{'", type: "ObjectExpression", line: 1, - column: 10 + column: 11 } ] }, @@ -338,13 +338,13 @@ eslintTester.addRuleTest("rules/object-curly-spacing", { message: "There should be no space after '{'", type: "ObjectExpression", line: 1, - column: 10 + column: 11 }, { message: "There should be no space after '{'", type: "ObjectExpression", line: 1, - column: 17 + column: 18 } ] }, @@ -356,13 +356,13 @@ eslintTester.addRuleTest("rules/object-curly-spacing", { message: "There should be no space before '}'", type: "ObjectExpression", line: 1, - column: 27 + column: 28 }, { message: "There should be no space before '}'", type: "ObjectExpression", line: 1, - column: 39 + column: 40 } ] }, @@ -378,7 +378,7 @@ eslintTester.addRuleTest("rules/object-curly-spacing", { message: "A space is required after '{'", type: "ObjectExpression", line: 1, - column: 21 + column: 22 } ] }, @@ -393,13 +393,13 @@ eslintTester.addRuleTest("rules/object-curly-spacing", { message: "A space is required after '{'", type: "ObjectPattern", line: 1, - column: 4 + column: 5 }, { message: "A space is required before '}'", type: "ObjectPattern", line: 1, - column: 9 + column: 10 } ] }, @@ -412,7 +412,7 @@ eslintTester.addRuleTest("rules/object-curly-spacing", { message: "A space is required before '}'", type: "ObjectPattern", line: 1, - column: 10 + column: 11 } ] }, @@ -425,13 +425,13 @@ eslintTester.addRuleTest("rules/object-curly-spacing", { message: "There should be no space after '{'", type: "ObjectPattern", line: 1, - column: 4 + column: 5 }, { message: "There should be no space before '}'", type: "ObjectPattern", line: 1, - column: 11 + column: 12 } ] }, @@ -444,7 +444,7 @@ eslintTester.addRuleTest("rules/object-curly-spacing", { message: "There should be no space before '}'", type: "ObjectPattern", line: 1, - column: 10 + column: 11 } ] }, @@ -457,7 +457,7 @@ eslintTester.addRuleTest("rules/object-curly-spacing", { message: "A space is required before '}'", type: "ObjectPattern", line: 1, - column: 10 + column: 11 } ] }, @@ -470,7 +470,7 @@ eslintTester.addRuleTest("rules/object-curly-spacing", { message: "A space is required after '{'", type: "ObjectPattern", line: 1, - column: 4 + column: 5 } ] }, diff --git a/eslint/babel-eslint-plugin/tests/object-shorthand.js b/eslint/babel-eslint-plugin/tests/object-shorthand.js index 9a89b10cc65b..0dfe5fb51c39 100644 --- a/eslint/babel-eslint-plugin/tests/object-shorthand.js +++ b/eslint/babel-eslint-plugin/tests/object-shorthand.js @@ -1,10 +1,10 @@ /* eslint-disable */ -var linter = require('eslint').linter - , ESLintTester = require('eslint-tester') - , eslintTester = new ESLintTester(linter); +var rule = require('../rules/object-shorthand'), + RuleTester = require('eslint').RuleTester; var features = { objectLiteralShorthandMethods: true, + objectLiteralComputedProperties: true, objectLiteralShorthandProperties: true, arrowFunctions: true, destructuring: true, @@ -16,11 +16,9 @@ function ok(code, args){ } -eslintTester.addRuleTest('rules/object-shorthand', { +var ruleTester = new RuleTester(); +ruleTester.run('babel/object-shorthand', rule, { valid: [ - ok('let { ...spread } = obj'), - ok('let { ...spread } = obj', [2, 'never']), - //original test cases { code: "var x = {y() {}}", ecmaFeatures: features }, { code: "var x = {y}", ecmaFeatures: features }, @@ -62,13 +60,22 @@ eslintTester.addRuleTest('rules/object-shorthand', { { code: "doSomething({set y(z) {}})", ecmaFeatures: features }, { code: "doSomething({get y() {}, set y(z) {}})", ecmaFeatures: features }, + // object literal computed properties + { code: "var x = {[y]: y}", ecmaFeatures: features, options: ["properties"] }, + { code: "var x = {['y']: 'y'}", ecmaFeatures: features, options: ["properties"] }, + { code: "var x = {['y']: y}", ecmaFeatures: features, options: ["properties"] }, + // options - { code: "var x = {y() {}}", ecmaFeatures: features, args: [2, "methods"] }, - { code: "var x = {x, y() {}, a:b}", ecmaFeatures: features, args: [2, "methods"] }, - { code: "var x = {y}", ecmaFeatures: features, args: [2, "properties"] }, - { code: "var x = {y: {b}}", ecmaFeatures: features, args: [2, "properties"] }, - { code: "var x = {a: n, c: d, f: g}", ecmaFeatures: features, args: [2, "never"] }, - { code: "var x = {a: function(){}, b: {c: d}}", ecmaFeatures: features, args: [2, "never"] } + { code: "var x = {y() {}}", ecmaFeatures: features, options: ["methods"] }, + { code: "var x = {x, y() {}, a:b}", ecmaFeatures: features, options: ["methods"] }, + { code: "var x = {y}", ecmaFeatures: features, options: ["properties"] }, + { code: "var x = {y: {b}}", ecmaFeatures: features, options: ["properties"] }, + { code: "var x = {a: n, c: d, f: g}", ecmaFeatures: features, options: ["never"] }, + { code: "var x = {a: function(){}, b: {c: d}}", ecmaFeatures: features, options: ["never"] }, + + // Babel test cases. + ok('let { ...spread } = obj'), + ok('let { ...spread } = obj', [2, 'never']), ], invalid: [ @@ -87,14 +94,15 @@ eslintTester.addRuleTest('rules/object-shorthand', { { code: "doSomething({y: function() {}})", ecmaFeatures: features, errors: [{ message: "Expected method shorthand.", type: "Property" }] }, // options - { code: "var x = {y: function() {}}", ecmaFeatures: features, errors: [{ message: "Expected method shorthand.", type: "Property" }], args: [2, "methods"] }, - { code: "var x = {x, y() {}, z: function() {}}", ecmaFeatures: features, errors: [{ message: "Expected method shorthand.", type: "Property" }], args: [2, "methods"] }, - { code: "var x = {x: x}", ecmaFeatures: features, errors: [{ message: "Expected property shorthand.", type: "Property" }], args: [2, "properties"] }, - { code: "var x = {a, b, c(){}, x: x}", ecmaFeatures: features, errors: [{ message: "Expected property shorthand.", type: "Property" }], args: [2, "properties"] }, - { code: "var x = {y() {}}", ecmaFeatures: features, errors: [{ message: "Expected longform method syntax.", type: "Property" }], args: [2, "never"] }, - { code: "var x = {*y() {}}", ecmaFeatures: features, errors: [{ message: "Expected longform method syntax.", type: "Property" }], args: [2, "never"] }, - { code: "var x = {y}", ecmaFeatures: features, errors: [{ message: "Expected longform property syntax.", type: "Property" }], args: [2, "never"]}, - { code: "var x = {y, a: b, *x(){}}", ecmaFeatures: features, errors: [{ message: "Expected longform property syntax.", type: "Property" }, { message: "Expected longform method syntax.", type: "Property" }], args: [2, "never"]}, - { code: "var x = {y: {x}}", ecmaFeatures: features, errors: [{ message: "Expected longform property syntax.", type: "Property" }], args: [2, "never"]} + { code: "var x = {y: function() {}}", ecmaFeatures: features, errors: [{ message: "Expected method shorthand.", type: "Property" }], options: ["methods"] }, + { code: "var x = {x, y() {}, z: function() {}}", ecmaFeatures: features, errors: [{ message: "Expected method shorthand.", type: "Property" }], options: ["methods"] }, + { code: "var x = {x: x}", ecmaFeatures: features, errors: [{ message: "Expected property shorthand.", type: "Property" }], options: ["properties"] }, + { code: "var x = {a, b, c(){}, x: x}", ecmaFeatures: features, errors: [{ message: "Expected property shorthand.", type: "Property" }], options: ["properties"] }, + { code: "var x = {y() {}}", ecmaFeatures: features, errors: [{ message: "Expected longform method syntax.", type: "Property" }], options: ["never"] }, + { code: "var x = {*y() {}}", ecmaFeatures: features, errors: [{ message: "Expected longform method syntax.", type: "Property" }], options: ["never"] }, + { code: "var x = {y}", ecmaFeatures: features, errors: [{ message: "Expected longform property syntax.", type: "Property" }], options: ["never"]}, + { code: "var x = {y, a: b, *x(){}}", ecmaFeatures: features, errors: [{ message: "Expected longform property syntax.", type: "Property" }, { message: "Expected longform method syntax.", type: "Property" }], options: ["never"]}, + { code: "var x = {y: {x}}", ecmaFeatures: features, errors: [{ message: "Expected longform property syntax.", type: "Property" }], options: ["never"]} + ] -}); \ No newline at end of file +}); diff --git a/eslint/babel-eslint-plugin/tests/space-in-brackets.js b/eslint/babel-eslint-plugin/tests/space-in-brackets.js deleted file mode 100644 index 106120dd80b0..000000000000 --- a/eslint/babel-eslint-plugin/tests/space-in-brackets.js +++ /dev/null @@ -1,761 +0,0 @@ -/* eslint-disable */ - -/** - * @fileoverview Disallows or enforces spaces inside of brackets. - * @author Ian Christian Myers - * @copyright 2014 Vignesh Anand. All rights reserved. - */ - -var linter = require('eslint').linter - , ESLintTester = require('eslint-tester') - , eslintTester = new ESLintTester(linter); - -eslintTester.addRuleTest("rules/space-in-brackets", { - - valid: [ - { code: "var foo = obj[ 1 ]", options: ["always"] }, - { code: "var foo = obj[ 'foo' ];", options: ["always"] }, - { code: "var foo = obj[ [ 1, 1 ] ];", options: ["always"] }, - - // always - singleValue - { code: "var foo = ['foo']", options: ["always", {singleValue: false}] }, - { code: "var foo = [2]", options: ["always", {singleValue: false}] }, - { code: "var foo = [[ 1, 1 ]]", options: ["always", {singleValue: false}] }, - { code: "var foo = [{ 'foo': 'bar' }]", options: ["always", {singleValue: false}] }, - { code: "var foo = [bar]", options: ["always", {singleValue: false}] }, - - // always - objectsInArrays - { code: "var foo = [{ 'bar': 'baz' }, 1, 5 ];", options: ["always", {objectsInArrays: false}] }, - { code: "var foo = [ 1, 5, { 'bar': 'baz' }];", options: ["always", {objectsInArrays: false}] }, - { code: "var foo = [{\n'bar': 'baz', \n'qux': [{ 'bar': 'baz' }], \n'quxx': 1 \n}]", options: ["always", {objectsInArrays: false}] }, - { code: "var foo = [{ 'bar': 'baz' }]", options: ["always", {objectsInArrays: false}] }, - { code: "var foo = [{ 'bar': 'baz' }, 1, { 'bar': 'baz' }];", options: ["always", {objectsInArrays: false}] }, - { code: "var foo = [ 1, { 'bar': 'baz' }, 5 ];", options: ["always", {objectsInArrays: false}] }, - { code: "var foo = [ 1, { 'bar': 'baz' }, [{ 'bar': 'baz' }] ];", options: ["always", {objectsInArrays: false}] }, - - // always - arraysInArrays - { code: "var arr = [[ 1, 2 ], 2, 3, 4 ];", options: ["always", {"arraysInArrays": false}] }, - { code: "var arr = [[ 1, 2 ], [[[ 1 ]]], 3, 4 ];", options: ["always", {"arraysInArrays": false}] }, - - // always - arraysInArrays, objectsInArrays - { code: "var arr = [[ 1, 2 ], 2, 3, { 'foo': 'bar' }];", options: ["always", {"arraysInArrays": false, objectsInArrays: false}] }, - - // always - arraysInArrays, objectsInArrays, singleValue - { code: "var arr = [[ 1, 2 ], [2], 3, { 'foo': 'bar' }];", options: ["always", {"arraysInArrays": false, objectsInArrays: false, singleValue: false}] }, - - // always - arraysInObjects - { code: "var obj = { 'foo': [ 1, 2 ]};", options: ["always", {"arraysInObjects": false}] }, - - // always - objectsInObjects - { code: "var obj = { 'foo': { 'bar': 1, 'baz': 2 }};", options: ["always", {"objectsInObjects": false}] }, - - // always - arraysInObjects, objectsInObjects - { code: "var obj = { 'qux': [ 1, 2 ], 'foo': { 'bar': 1, 'baz': 2 }};", options: ["always", {"arraysInObjects": false, "objectsInObjects": false}] }, - - // always - arraysInObjects, objectsInObjects (reverse) - { code: "var obj = { 'foo': { 'bar': 1, 'baz': 2 }, 'qux': [ 1, 2 ]};", options: ["always", {"arraysInObjects": false, "objectsInObjects": false}] }, - - // always - { code: "obj[ foo ]", options: ["always"] }, - { code: "obj[\nfoo\n]", options: ["always"] }, - { code: "obj[ 'foo' ]", options: ["always"] }, - { code: "obj[ 'foo' + 'bar' ]", options: ["always"] }, - { code: "obj[ obj2[ foo ] ]", options: ["always"] }, - { code: "obj.map(function (item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["always"] }, - { code: "obj[ 'map' ](function (item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["always"] }, - { code: "obj[ 'for' + 'Each' ](function (item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["always"] }, - - { code: "var arr = [ 1, 2, 3, 4 ];", options: ["always"] }, - { code: "var arr = [ [ 1, 2 ], 2, 3, 4 ];", options: ["always"] }, - { code: "var arr = [\n1, 2, 3, 4\n];", options: ["always"] }, - - { code: "var obj = { foo: bar, baz: qux };", options: ["always"] }, - { code: "var obj = { foo: { bar: quxx }, baz: qux };", options: ["always"] }, - { code: "var obj = {\nfoo: bar,\nbaz: qux\n};", options: ["always"] }, - - { code: "var foo = {};", options: ["always"] }, - { code: "var foo = [];", options: ["always"] }, - - { code: "this.db.mappings.insert([\n { alias: 'a', url: 'http://www.amazon.de' },\n { alias: 'g', url: 'http://www.google.de' }\n], function () {});", options: ["always", {singleValue: false, objectsInArrays: true, arraysInArrays: true}] }, - - // never - { code: "obj[foo]", options: ["never"] }, - { code: "obj['foo']", options: ["never"] }, - { code: "obj['foo' + 'bar']", options: ["never"] }, - { code: "obj['foo'+'bar']", options: ["never"] }, - { code: "obj[obj2[foo]]", options: ["never"] }, - { code: "obj.map(function (item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["never"] }, - { code: "obj['map'](function (item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["never"] }, - { code: "obj['for' + 'Each'](function (item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["never"] }, - { code: "obj[ obj2[ foo ] ]", options: ["never", {"propertyName": true}] }, - { code: "obj['for' + 'Each'](function (item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["never"] }, - - - { code: "obj[\nfoo]", options: ["never"] }, - { code: "obj[foo\n]", options: ["never"] }, - { code: "var obj = {foo: bar,\nbaz: qux\n};", options: ["never"] }, - { code: "var obj = {\nfoo: bar,\nbaz: qux};", options: ["never"] }, - { code: "var arr = [1,\n2,\n3,\n4\n];", options: ["never"] }, - { code: "var arr = [\n1,\n2,\n3,\n4];", options: ["never"] }, - - // never - singleValue - { code: "var foo = [ 'foo' ]", options: ["never", {singleValue: true}] }, - { code: "var foo = [ 2 ]", options: ["never", {singleValue: true}] }, - { code: "var foo = [ [1, 1] ]", options: ["never", {singleValue: true}] }, - { code: "var foo = [ {'foo': 'bar'} ]", options: ["never", {singleValue: true}] }, - { code: "var foo = [ bar ]", options: ["never", {singleValue: true}] }, - - // never - objectsInArrays - { code: "var foo = [ {'bar': 'baz'}, 1, 5];", options: ["never", {objectsInArrays: true}] }, - { code: "var foo = [1, 5, {'bar': 'baz'} ];", options: ["never", {objectsInArrays: true}] }, - { code: "var foo = [ {\n'bar': 'baz', \n'qux': [ {'bar': 'baz'} ], \n'quxx': 1 \n} ]", options: ["never", {objectsInArrays: true}] }, - { code: "var foo = [ {'bar': 'baz'} ]", options: ["never", {objectsInArrays: true}] }, - { code: "var foo = [ {'bar': 'baz'}, 1, {'bar': 'baz'} ];", options: ["never", {objectsInArrays: true}] }, - { code: "var foo = [1, {'bar': 'baz'} , 5];", options: ["never", {objectsInArrays: true}] }, - { code: "var foo = [1, {'bar': 'baz'}, [ {'bar': 'baz'} ]];", options: ["never", {objectsInArrays: true}] }, - - // never - arraysInArrays - { code: "var arr = [ [1, 2], 2, 3, 4];", options: ["never", {"arraysInArrays": true}] }, - - // never - arraysInArrays, singleValue - { code: "var arr = [ [1, 2], [ [ [ 1 ] ] ], 3, 4];", options: ["never", {"arraysInArrays": true, singleValue: true}] }, - - // never - arraysInArrays, objectsInArrays - { code: "var arr = [ [1, 2], 2, 3, {'foo': 'bar'} ];", options: ["never", {"arraysInArrays": true, objectsInArrays: true}] }, - - { code: "var arr = [1, 2, 3, 4];", options: ["never"] }, - { code: "var arr = [[1, 2], 2, 3, 4];", options: ["never"] }, - { code: "var arr = [\n1, 2, 3, 4\n];", options: ["never"] }, - - { code: "var obj = {foo: bar, baz: qux};", options: ["never"] }, - { code: "var obj = {foo: {bar: quxx}, baz: qux};", options: ["never"] }, - { code: "var obj = {\nfoo: bar,\nbaz: qux\n};", options: ["never"] }, - - { code: "var foo = {};", options: ["never"] }, - { code: "var foo = [];", options: ["never"] }, - - { code: "var foo = [{'bar':'baz'}, 1, {'bar': 'baz'}];", options: ["never"] }, - { code: "var foo = [{'bar': 'baz'}];", options: ["never"] }, - { code: "var foo = [{\n'bar': 'baz', \n'qux': [{'bar': 'baz'}], \n'quxx': 1 \n}]", options: ["never"] }, - { code: "var foo = [1, {'bar': 'baz'}, 5];", options: ["never"] }, - { code: "var foo = [{'bar': 'baz'}, 1, 5];", options: ["never"] }, - { code: "var foo = [1, 5, {'bar': 'baz'}];", options: ["never"] }, - { code: "var obj = {'foo': [1, 2]}", options: ["never"] }, - - // propertyName: false - { code: "var foo = obj[1]", options: ["always", {propertyName: false}] }, - { code: "var foo = obj['foo'];", options: ["always", {propertyName: false}] }, - { code: "var foo = obj[[ 1, 1 ]];", options: ["always", {propertyName: false}] }, - - { code: "var foo = obj[ 1 ]", options: ["never", {propertyName: true}] }, - { code: "var foo = obj[ 'foo' ];", options: ["never", {propertyName: true}] }, - { code: "var foo = obj[ [1, 1] ];", options: ["never", {propertyName: true}] }, - { code: "import 'test.js';", ecmaFeatures: { modules: true } }, - { code: "export const thing = {\n value: 1 \n};", ecmaFeatures: { modules: true, blockBindings: true } }, - { code: "export const thing = {};", ecmaFeatures: { modules: true, blockBindings: true } }, - { code: "export let thing = {};", ecmaFeatures: { modules: true, blockBindings: true } }, - { code: "export var thing = {};", ecmaFeatures: { modules: true } }, - - // Babel test cases. - { code: "export * as x from \"mod\";", parser: "babel-eslint", ecmaFeatures: { modules: true } }, - { code: "export x from \"mod\";", parser: "babel-eslint", ecmaFeatures: { modules: true } }, - ], - - invalid: [ - // objectsInArrays - { - code: "var foo = [ { 'bar': 'baz' }, 1, 5];", - options: ["always", {objectsInArrays: false}], - errors: [ - { - message: "There should be no space after '['", - type: "ArrayExpression" - }, - { - message: "A space is required before ']'", - type: "ArrayExpression" - } - ] - }, - { - code: "import {bar} from 'foo.js';", - options: ["always"], - ecmaFeatures: { - modules: true - }, - errors: [ - { - message: "A space is required after '{'", - type: "ImportDeclaration" - }, - { - message: "A space is required before '}'", - type: "ImportDeclaration" - } - ] - }, - { - code: "export {bar};", - options: ["always"], - ecmaFeatures: { - modules: true - }, - errors: [ - { - message: "A space is required after '{'", - type: "ExportNamedDeclaration" - }, - { - message: "A space is required before '}'", - type: "ExportNamedDeclaration" - } - ] - }, - { - code: "var foo = [1, 5, { 'bar': 'baz' } ];", - options: ["always", {objectsInArrays: false}], - errors: [ - { - message: "A space is required after '['", - type: "ArrayExpression" - }, - { - message: "There should be no space before ']'", - type: "ArrayExpression" - } - ] - }, - { - code: "var foo = [ { 'bar':'baz' }, 1, { 'bar': 'baz' } ];", - options: ["always", {objectsInArrays: false}], - errors: [ - { - message: "There should be no space after '['", - type: "ArrayExpression" - }, - { - message: "There should be no space before ']'", - type: "ArrayExpression" - } - ] - }, - - // singleValue - { - code: "var obj = [ 'foo' ];", - options: ["always", {singleValue: false}], - errors: [ - { - message: "There should be no space after '['", - type: "ArrayExpression" - }, - { - message: "There should be no space before ']'", - type: "ArrayExpression" - } - ] - }, - { - code: "var obj = ['foo' ];", - options: ["always", {singleValue: false}], - errors: [ - { - message: "There should be no space before ']'", - type: "ArrayExpression" - } - ] - }, - // singleValue - { - code: "var obj = ['foo'];", - options: ["never", {singleValue: true}], - errors: [ - { - message: "A space is required after '['", - type: "ArrayExpression" - }, - { - message: "A space is required before ']'", - type: "ArrayExpression" - } - ] - }, - { - code: "var foo = obj[ 1];", - options: ["always"], - errors: [ - { - message: "A space is required before ']'", - type: "MemberExpression" - } - ] - }, - { - code: "var foo = obj[1 ];", - options: ["always"], - errors: [ - { - message: "A space is required after '['", - type: "MemberExpression" - } - ] - }, - // propertyName - { - code: "var foo = obj[ 1];", - options: ["always", {propertyName: false}], - errors: [ - { - message: "There should be no space after '['", - type: "MemberExpression" - } - ] - }, - { - code: "var foo = obj[1 ];", - options: ["always", {propertyName: false}], - errors: [ - { - message: "There should be no space before ']'", - type: "MemberExpression" - } - ] - }, - { - code: "var foo = obj[ 1];", - options: ["never", {propertyName: true}], - errors: [ - { - message: "A space is required before ']'", - type: "MemberExpression" - } - ] - }, - { - code: "var foo = obj[1 ];", - options: ["never", {propertyName: true}], - errors: [ - { - message: "A space is required after '['", - type: "MemberExpression" - } - ] - }, - - // always - arraysInArrays - { - code: "var arr = [ [ 1, 2 ], 2, 3, 4 ];", - options: ["always", {"arraysInArrays": false}], - errors: [ - { - message: "There should be no space after '['", - type: "ArrayExpression" - } - ] - }, - { - code: "var arr = [ 1, 2, 2, [ 3, 4 ] ];", - options: ["always", {"arraysInArrays": false}], - errors: [ - { - message: "There should be no space before ']'", - type: "ArrayExpression" - } - ] - }, - { - code: "var arr = [[ 1, 2 ], 2, [ 3, 4 ] ];", - options: ["always", {"arraysInArrays": false}], - errors: [ - { - message: "There should be no space before ']'", - type: "ArrayExpression" - } - ] - }, - { - code: "var arr = [ [ 1, 2 ], 2, [ 3, 4 ]];", - options: ["always", {"arraysInArrays": false}], - errors: [ - { - message: "There should be no space after '['", - type: "ArrayExpression" - } - ] - }, - { - code: "var arr = [ [ 1, 2 ], 2, [ 3, 4 ] ];", - options: ["always", {"arraysInArrays": false}], - errors: [ - { - message: "There should be no space after '['", - type: "ArrayExpression" - }, - { - message: "There should be no space before ']'", - type: "ArrayExpression" - } - ] - }, - - // never - arraysInArrays - { - code: "var arr = [[1, 2], 2, [3, 4]];", - options: ["never", {"arraysInArrays": true}], - errors: [ - { - message: "A space is required after '['", - type: "ArrayExpression" - }, - { - message: "A space is required before ']'", - type: "ArrayExpression" - } - ] - }, - - // always - arraysInObjects - { - code: "var obj = { 'foo': [ 1, 2 ] };", - options: ["always", {"arraysInObjects": false}], - errors: [ - { - message: "There should be no space before '}'", - type: "ObjectExpression" - } - ] - }, - { - code: "var obj = { 'foo': [ 1, 2 ] , 'bar': [ 'baz', 'qux' ] };", - options: ["always", {"arraysInObjects": false}], - errors: [ - { - message: "There should be no space before '}'", - type: "ObjectExpression" - } - ] - }, - - // never - arraysInObjects - { - code: "var obj = {'foo': [1, 2]};", - options: ["never", {"arraysInObjects": true}], - errors: [ - { - message: "A space is required before '}'", - type: "ObjectExpression" - } - ] - }, - { - code: "var obj = {'foo': [1, 2] , 'bar': ['baz', 'qux']};", - options: ["never", {"arraysInObjects": true}], - errors: [ - { - message: "A space is required before '}'", - type: "ObjectExpression" - } - ] - }, - - // always-objectsInObjects - { - code: "var obj = { 'foo': { 'bar': 1, 'baz': 2 } };", - options: ["always", {"objectsInObjects": false}], - errors: [ - { - message: "There should be no space before '}'", - type: "ObjectExpression" - } - ] - }, - { - code: "var obj = { 'foo': [ 1, 2 ] , 'bar': { 'baz': 1, 'qux': 2 } };", - options: ["always", {"objectsInObjects": false}], - errors: [ - { - message: "There should be no space before '}'", - type: "ObjectExpression" - } - ] - }, - - // never-objectsInObjects - { - code: "var obj = {'foo': {'bar': 1, 'baz': 2}};", - options: ["never", {"objectsInObjects": true}], - errors: [ - { - message: "A space is required before '}'", - type: "ObjectExpression" - } - ] - }, - { - code: "var obj = {'foo': [1, 2] , 'bar': {'baz': 1, 'qux': 2}};", - options: ["never", {"objectsInObjects": true}], - errors: [ - { - message: "A space is required before '}'", - type: "ObjectExpression" - } - ] - }, - - // always & never - { - code: "var obj = {foo: bar, baz: qux};", - options: ["always"], - errors: [ - { - message: "A space is required after '{'", - type: "ObjectExpression" - }, - { - message: "A space is required before '}'", - type: "ObjectExpression" - } - ] - }, - { - code: "var obj = {foo: bar, baz: qux };", - options: ["always"], - errors: [ - { - message: "A space is required after '{'", - type: "ObjectExpression" - } - ] - }, - { - code: "var obj = { foo: bar, baz: qux};", - options: ["always"], - errors: [ - { - message: "A space is required before '}'", - type: "ObjectExpression" - } - ] - }, - { - code: "var obj = { foo: bar, baz: qux };", - options: ["never"], - errors: [ - { - message: "There should be no space after '{'", - type: "ObjectExpression" - }, - { - message: "There should be no space before '}'", - type: "ObjectExpression" - } - ] - }, - { - code: "var obj = {foo: bar, baz: qux };", - options: ["never"], - errors: [ - { - message: "There should be no space before '}'", - type: "ObjectExpression" - } - ] - }, - { - code: "var obj = { foo: bar, baz: qux};", - options: ["never"], - errors: [ - { - message: "There should be no space after '{'", - type: "ObjectExpression" - } - ] - }, - { - code: "var obj = { foo: { bar: quxx}, baz: qux};", - options: ["never"], - errors: [ - { - message: "There should be no space after '{'", - type: "ObjectExpression" - }, - { - message: "There should be no space after '{'", - type: "ObjectExpression" - } - ] - }, - { - code: "var obj = {foo: {bar: quxx }, baz: qux };", - options: ["never"], - errors: [ - { - message: "There should be no space before '}'", - type: "ObjectExpression" - }, - { - message: "There should be no space before '}'", - type: "ObjectExpression" - } - ] - }, - { - code: "var arr = [1, 2, 3, 4];", - options: ["always"], - errors: [ - { - message: "A space is required after '['", - type: "ArrayExpression" - }, - { - message: "A space is required before ']'", - type: "ArrayExpression" - } - ] - }, - { - code: "var arr = [1, 2, 3, 4 ];", - options: ["always"], - errors: [ - { - message: "A space is required after '['", - type: "ArrayExpression" - } - ] - }, - { - code: "var arr = [ 1, 2, 3, 4];", - options: ["always"], - errors: [ - { - message: "A space is required before ']'", - type: "ArrayExpression" - } - ] - }, - { - code: "var arr = [ 1, 2, 3, 4 ];", - options: ["never"], - errors: [ - { - message: "There should be no space after '['", - type: "ArrayExpression" - }, - { - message: "There should be no space before ']'", - type: "ArrayExpression" - } - ] - }, - { - code: "var arr = [1, 2, 3, 4 ];", - options: ["never"], - errors: [ - { - message: "There should be no space before ']'", - type: "ArrayExpression" - } - ] - }, - { - code: "var arr = [ 1, 2, 3, 4];", - options: ["never"], - errors: [ - { - message: "There should be no space after '['", - type: "ArrayExpression" - } - ] - }, - { - code: "var arr = [ [ 1], 2, 3, 4];", - options: ["never"], - errors: [ - { - message: "There should be no space after '['", - type: "ArrayExpression" - }, - { - message: "There should be no space after '['", - type: "ArrayExpression" - } - ] - }, - { - code: "var arr = [[1 ], 2, 3, 4 ];", - options: ["never"], - errors: [ - { - message: "There should be no space before ']'", - type: "ArrayExpression" - }, - { - message: "There should be no space before ']'", - type: "ArrayExpression" - } - ] - }, - { - code: "obj[ foo ]", - options: ["never"], - errors: [ - { - message: "There should be no space after '['", - type: "MemberExpression" - }, - { - message: "There should be no space before ']'", - type: "MemberExpression" - } - ] - }, - { - code: "obj[foo ]", - options: ["never"], - errors: [ - { - message: "There should be no space before ']'", - type: "MemberExpression" - } - ] - }, - { - code: "obj[ foo]", - options: ["never"], - errors: [ - { - message: "There should be no space after '['", - type: "MemberExpression" - } - ] - }, - { - code: "var foo = obj[1]", - options: ["always"], - errors: [ - { - message: "A space is required after '['", - type: "MemberExpression" - }, - { - message: "A space is required before ']'", - type: "MemberExpression" - } - ] - }, - { - code: "export const thing = {value: 1 };", - ecmaFeatures: { - modules: true, - blockBindings: true - }, - options: ["always"], - errors: [ - { - message: "A space is required after '{'", - type: "ObjectExpression" - } - ] - } - ] -}); From fc31183a20cf317acf46638e15ae449d45051381 Mon Sep 17 00:00:00 2001 From: jquense Date: Tue, 4 Aug 2015 23:33:06 -0400 Subject: [PATCH 482/569] v2.0.0 --- eslint/babel-eslint-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index cfce981c1fc8..5acdaaa6a275 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-babel", - "version": "1.2.0", + "version": "2.0.0", "description": "an eslint rule plugin companion to babel-eslint", "main": "index.js", "scripts": { From f5f7b50e179b79aa4ae29ceabbfb9455c54da52c Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 15 Aug 2015 21:05:46 -0400 Subject: [PATCH 483/569] Merge pull request babel/eslint-plugin-babel#9 from babel/arrow-parens Add support for async functions in arrow-parens --- eslint/babel-eslint-plugin/README.md | 2 + eslint/babel-eslint-plugin/package.json | 4 +- .../babel-eslint-plugin/rules/arrow-parens.js | 53 ++++++ .../babel-eslint-plugin/tests/arrow-parens.js | 177 ++++++++++++++++++ 4 files changed, 234 insertions(+), 2 deletions(-) create mode 100644 eslint/babel-eslint-plugin/rules/arrow-parens.js create mode 100644 eslint/babel-eslint-plugin/tests/arrow-parens.js diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md index c76c666ca32d..3d28839d67fb 100644 --- a/eslint/babel-eslint-plugin/README.md +++ b/eslint/babel-eslint-plugin/README.md @@ -27,6 +27,7 @@ Finally enable all the rules you like to use (remember to disable the originals "babel/new-cap": 1, "babel/object-curly-spacing": 1, "babel/object-shorthand": 1, + "babel/arrow-parens": 1 } } ``` @@ -38,3 +39,4 @@ Each rule cooresponds to a core eslint rule, and has the same options. - `babel/new-cap`: Ignores capitalized decorators (`@Decorator`) - `babel/object-curly-spacing`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` - `babel/object-shorthand`: doesn't fail when using object spread (`...obj`) +- `babel/arrow-parens`: Handles async functions correctly \ No newline at end of file diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index 5acdaaa6a275..dacdf7518afa 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -27,8 +27,8 @@ "eslint": ">=1.0.0" }, "devDependencies": { - "babel-eslint": "^4.0.5", - "eslint": "^1.0.0", + "babel-eslint": "^4.0.7", + "eslint": "^1.1.0", "is-my-json-valid": "^2.12.0", "mocha": "^2.2.5", "phantomjs": "^1.9.17" diff --git a/eslint/babel-eslint-plugin/rules/arrow-parens.js b/eslint/babel-eslint-plugin/rules/arrow-parens.js new file mode 100644 index 000000000000..b3ee3a765262 --- /dev/null +++ b/eslint/babel-eslint-plugin/rules/arrow-parens.js @@ -0,0 +1,53 @@ +/** + * @fileoverview Rule to require parens in arrow function arguments. + * @author Jxck + * @copyright 2015 Jxck. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + var message = "Expected parentheses around arrow function argument."; + var asNeededMessage = "Unexpected parentheses around single function argument"; + var asNeeded = context.options[0] === "as-needed"; + + /** + * Determines whether a arrow function argument end with `)` + * @param {ASTNode} node The arrow function node. + * @returns {void} + */ + function parens(node) { + var token = context.getFirstToken(node); + if (node.async) token = context.getTokenAfter(token); + + // as-needed: x => x + if (asNeeded && node.params.length === 1 && node.params[0].type === "Identifier") { + if (token.type === "Punctuator" && token.value === "(") { + context.report(node, asNeededMessage); + } + return; + } + + if (token.type === "Identifier") { + var after = context.getTokenAfter(token); + + // (x) => x + if (after.value !== ")") { + context.report(node, message); + } + } + } + + return { + "ArrowFunctionExpression": parens + }; +}; + +module.exports.schema = [ + { + "enum": ["always", "as-needed"] + } +]; \ No newline at end of file diff --git a/eslint/babel-eslint-plugin/tests/arrow-parens.js b/eslint/babel-eslint-plugin/tests/arrow-parens.js new file mode 100644 index 000000000000..74a03f62c564 --- /dev/null +++ b/eslint/babel-eslint-plugin/tests/arrow-parens.js @@ -0,0 +1,177 @@ +/* eslint-disable */ + +/** + * @fileoverview Tests for arrow-parens + * @author Jxck + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var rule = require("../rules/arrow-parens"), + RuleTester = require('eslint').RuleTester; + +function ok(code, args){ + return { code: code, options: args, parser: 'babel-eslint' } +} + +function err(code, errors, args){ + var e = ok(code, args) + e.errors = errors + return e +} + +//------------------------------------------------------------------------------ +// Tests +//------------------------------------------------------------------------------ +var ruleTester = new RuleTester(); + +var valid = [ + { code: "() => {}", ecmaFeatures: { arrowFunctions: true } }, + { code: "(a) => {}", ecmaFeatures: { arrowFunctions: true } }, + { code: "(a) => a", ecmaFeatures: { arrowFunctions: true } }, + { code: "(a) => {\n}", ecmaFeatures: { arrowFunctions: true } }, + { code: "a.then((foo) => {});", ecmaFeatures: { arrowFunctions: true } }, + { code: "a.then((foo) => { if (true) {}; });", ecmaFeatures: { arrowFunctions: true } }, + + // // as-needed + { code: "() => {}", options: ["as-needed"], ecmaFeatures: { arrowFunctions: true } }, + { code: "a => {}", options: ["as-needed"], ecmaFeatures: { arrowFunctions: true } }, + { code: "a => a", options: ["as-needed"], ecmaFeatures: { arrowFunctions: true } }, + { code: "([a, b]) => {}", options: ["as-needed"], ecmaFeatures: { arrowFunctions: true, destructuring: true } }, + { code: "({ a, b }) => {}", options: ["as-needed"], ecmaFeatures: { arrowFunctions: true, destructuring: true } }, + { code: "(a = 10) => {}", options: ["as-needed"], ecmaFeatures: { arrowFunctions: true, destructuring: true, defaultParams: true } }, + { code: "(...a) => a[0]", options: ["as-needed"], ecmaFeatures: { arrowFunctions: true, restParams: true } }, + { code: "(a, b) => {}", options: ["as-needed"], ecmaFeatures: { arrowFunctions: true } }, + + // async + ok("async () => {}"), + ok("async (a) => {}"), + ok("async (a) => a"), + ok("async (a) => {\n}"), + ok("a.then(async (foo) => {});"), + ok("a.then((foo) => { if (true) {}; })"), + + ok("async () => {}", ["as-needed"]), + ok("async a => {}", ["as-needed"]), + ok("async a => a", ["as-needed"]), + ok("async ([a, b]) => {}", ["as-needed"]), + ok("async ({ a, b }) => {}", ["as-needed"]), + ok("async (a = 10) => {}", ["as-needed"]), + ok("async (...a) => a[0]", ["as-needed"]), + ok("async (a, b) => {}", ["as-needed"]), + +]; + +var message = message; +var asNeededMessage = asNeededMessage; +var type = type; + +var invalid = [ + { + code: "a => {}", + ecmaFeatures: { arrowFunctions: true }, + errors: [{ + line: 1, + column: 1, + message: message, + type: type + }] + }, + { + code: "a => a", + ecmaFeatures: { arrowFunctions: true }, + errors: [{ + line: 1, + column: 1, + message: message, + type: type + }] + }, + { + code: "a => {\n}", + ecmaFeatures: { arrowFunctions: true }, + errors: [{ + line: 1, + column: 1, + message: message, + type: type + }] + }, + { + code: "a.then(foo => {});", + ecmaFeatures: { arrowFunctions: true }, + errors: [{ + line: 1, + column: 8, + message: message, + type: type + }] + }, + { + code: "a.then(foo => a);", + ecmaFeatures: { arrowFunctions: true }, + errors: [{ + line: 1, + column: 8, + message: message, + type: type + }] + }, + { + code: "a(foo => { if (true) {}; });", + ecmaFeatures: { arrowFunctions: true }, + errors: [{ + line: 1, + column: 3, + message: message, + type: type + }] + }, + + // as-needed + { + code: "(a) => a", + options: ["as-needed"], + ecmaFeatures: { arrowFunctions: true }, + errors: [{ + line: 1, + column: 1, + message: asNeededMessage, + type: type + }] + }, + { + code: "(b) => b", + options: ["as-needed"], + ecmaFeatures: { arrowFunctions: true }, + errors: [{ + line: 1, + column: 1, + message: asNeededMessage, + type: type + }] + }, + + // async + err('async a => {}', [ + { message: 'Expected parentheses around arrow function argument.' }, + ]), + + err('async a => a', [ + { message: 'Expected parentheses around arrow function argument.' }, + ]), + + err('async (a) => a', [ + { message: 'Unexpected parentheses around single function argument' }, + ], + ["as-needed"]) +]; + +ruleTester.run("arrow-parens", rule, { + valid: valid, + invalid: invalid +}); \ No newline at end of file From 902ae7e6e7e7a9b891cf623d37c85983cd0cab97 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 15 Aug 2015 21:08:57 -0400 Subject: [PATCH 484/569] 2.1.0 --- eslint/babel-eslint-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index dacdf7518afa..cf091648556d 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-babel", - "version": "2.0.0", + "version": "2.1.0", "description": "an eslint rule plugin companion to babel-eslint", "main": "index.js", "scripts": { From cc73bb56b67757740b175fe296916b154dbe00f7 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 18 Aug 2015 10:52:55 -0400 Subject: [PATCH 485/569] Merge pull request babel/eslint-plugin-babel#10 from aruberto/master add arrow-parens to index.js --- eslint/babel-eslint-plugin/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eslint/babel-eslint-plugin/index.js b/eslint/babel-eslint-plugin/index.js index 369b9c11b6f8..5fde6a2cbc6b 100644 --- a/eslint/babel-eslint-plugin/index.js +++ b/eslint/babel-eslint-plugin/index.js @@ -6,11 +6,13 @@ module.exports = { 'new-cap': require('./rules/new-cap'), 'object-curly-spacing': require('./rules/object-curly-spacing'), 'object-shorthand': require('./rules/object-shorthand'), + 'arrow-parens': require('./rules/arrow-parens'), }, rulesConfig: { 'generator-star-spacing': 0, 'new-cap': 0, 'object-curly-spacing': 0, 'object-shorthand': 0, + 'arrow-parens': 0, } }; From eb438f0f9873b46c007cb1fab74ff14b9561381f Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 18 Aug 2015 10:53:41 -0400 Subject: [PATCH 486/569] 2.1.1 --- eslint/babel-eslint-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index cf091648556d..3d7d0c5e5807 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-babel", - "version": "2.1.0", + "version": "2.1.1", "description": "an eslint rule plugin companion to babel-eslint", "main": "index.js", "scripts": { From 64291d8d52a7c0a61af1ed2fd60fbbd93be26ff0 Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Tue, 18 Aug 2015 15:30:38 -0400 Subject: [PATCH 487/569] Merge pull request babel/eslint-plugin-babel#11 from pascalduez/pr__fix-readme Improve the Readme --- eslint/babel-eslint-plugin/README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md index 3d28839d67fb..50200eb65eff 100644 --- a/eslint/babel-eslint-plugin/README.md +++ b/eslint/babel-eslint-plugin/README.md @@ -1,14 +1,14 @@ # eslint-plugin-babel -An eslint plugin companion to babel-eslint. babel-eslint does a great job of adapting eslint for use with Babel, but to it can't change the built in rules to support experimental features. eslint-plugin-babel reimplements problematic rules so they do not give false positives or negatives. +An `eslint` plugin companion to `babel-eslint`. `babel-eslint` does a great job at adapting `eslint` for use with Babel, but it can't change the built in rules to support experimental features. `eslint-plugin-babel` reimplements problematic rules so they do not give false positives or negatives. ### Install ```sh -npm install eslint-plugin-babel -S +npm install eslint-plugin-babel -D ``` -enable the plugin by adjusting your `.eslintrc` file to include the plugin: +Load the plugin in your `.eslintrc` file: ```json { @@ -18,7 +18,8 @@ enable the plugin by adjusting your `.eslintrc` file to include the plugin: } ``` -Finally enable all the rules you like to use (remember to disable the originals as well!). +Finally enable all the rules you would like to use (remember to disable the +original ones as well!). ```json { @@ -33,10 +34,10 @@ Finally enable all the rules you like to use (remember to disable the originals ``` ### Rules -Each rule cooresponds to a core eslint rule, and has the same options. +Each rule corresponds to a core `eslint` rule, and has the same options. - `babel/generator-star-spacing`: Handles async/await functions correctly - `babel/new-cap`: Ignores capitalized decorators (`@Decorator`) - `babel/object-curly-spacing`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` - `babel/object-shorthand`: doesn't fail when using object spread (`...obj`) -- `babel/arrow-parens`: Handles async functions correctly \ No newline at end of file +- `babel/arrow-parens`: Handles async functions correctly From 9d8a2f14dd03a766ec694b29e314743579b932f1 Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Mon, 26 Oct 2015 10:36:36 +0700 Subject: [PATCH 488/569] Merge pull request babel/eslint-plugin-babel#23 from LegNeato/master Support trailing commas in import and export statements. Fixes babel/eslint-plugin-babel#21 --- .../rules/object-curly-spacing.js | 12 ++++++++++++ .../tests/object-curly-spacing.js | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/eslint/babel-eslint-plugin/rules/object-curly-spacing.js b/eslint/babel-eslint-plugin/rules/object-curly-spacing.js index d498211a998b..93e3ac17a4e9 100644 --- a/eslint/babel-eslint-plugin/rules/object-curly-spacing.js +++ b/eslint/babel-eslint-plugin/rules/object-curly-spacing.js @@ -173,6 +173,12 @@ module.exports = function(context) { penultimate = context.getLastToken(lastSpecifier), last = context.getTokenAfter(lastSpecifier); + // support trailing commas + if (last.value === ",") { + penultimate = last; + last = context.getTokenAfter(last); + } + validateBraceSpacing(node, first, second, penultimate, last); } @@ -195,6 +201,12 @@ module.exports = function(context) { return; } + // support trailing commas + if (last.value === ",") { + penultimate = last; + last = context.getTokenAfter(last); + } + validateBraceSpacing(node, first, second, penultimate, last); }, diff --git a/eslint/babel-eslint-plugin/tests/object-curly-spacing.js b/eslint/babel-eslint-plugin/tests/object-curly-spacing.js index 4b13e9d43d91..83332d4539a9 100644 --- a/eslint/babel-eslint-plugin/tests/object-curly-spacing.js +++ b/eslint/babel-eslint-plugin/tests/object-curly-spacing.js @@ -37,7 +37,11 @@ ruleTester.run('babel/object-curly-spacing', rule, { { code: "import {\ndoor } from 'room'", options: ["always"], ecmaFeatures: { modules: true } }, { code: "export { door } from 'room'", options: ["always"], ecmaFeatures: { modules: true } }, { code: "import { house, mouse } from 'caravan'", options: ["always"], ecmaFeatures: { modules: true } }, + { code: "import {\nhouse,\nmouse\n} from 'caravan'", options: ["always"], ecmaFeatures: { modules: true } }, + { code: "import {\nhouse,\nmouse,\n} from 'caravan'", options: ["always"], ecmaFeatures: { modules: true } }, { code: "export { door }", options: ["always"], ecmaFeatures: { modules: true } }, + { code: "export {\ndoor,\nhouse\n}", options: ["always"], ecmaFeatures: { modules: true } }, + { code: "export {\ndoor,\nhouse,\n}", options: ["always"], ecmaFeatures: { modules: true } }, { code: "import 'room'", options: ["always"], ecmaFeatures: { modules: true } }, // always - empty object @@ -85,7 +89,11 @@ ruleTester.run('babel/object-curly-spacing', rule, { { code: "export {\ndoor\n} from 'room'", options: ["never"], ecmaFeatures: { modules: true } }, { code: "import {house,mouse} from 'caravan'", options: ["never"], ecmaFeatures: { modules: true } }, { code: "import {house, mouse} from 'caravan'", options: ["never"], ecmaFeatures: { modules: true } }, + { code: "import {\nhouse,\nmouse} from 'caravan'", options: ["never"], ecmaFeatures: { modules: true } }, + { code: "import {\nhouse,\nmouse,\n} from 'caravan'", options: ["never"], ecmaFeatures: { modules: true } }, { code: "export {door}", options: ["never"], ecmaFeatures: { modules: true } }, + { code: "export {\ndoor,\nmouse\n}", options: ["never"], ecmaFeatures: { modules: true } }, + { code: "export {\ndoor,\nmouse,\n}", options: ["never"], ecmaFeatures: { modules: true } }, { code: "import 'room'", options: ["never"], ecmaFeatures: { modules: true } }, // never - empty object From dd8f357639f9c299dbd8558c77234a9260d309e9 Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Sun, 1 Nov 2015 11:46:24 -0500 Subject: [PATCH 489/569] Merge pull request babel/eslint-plugin-babel#22 from nmote/await Add no-await-in-loop rule. --- eslint/babel-eslint-plugin/index.js | 2 + .../rules/no-await-in-loop.js | 72 ++++++++++++ .../tests/no-await-in-loop.js | 106 ++++++++++++++++++ 3 files changed, 180 insertions(+) create mode 100644 eslint/babel-eslint-plugin/rules/no-await-in-loop.js create mode 100644 eslint/babel-eslint-plugin/tests/no-await-in-loop.js diff --git a/eslint/babel-eslint-plugin/index.js b/eslint/babel-eslint-plugin/index.js index 5fde6a2cbc6b..9bb58310c19d 100644 --- a/eslint/babel-eslint-plugin/index.js +++ b/eslint/babel-eslint-plugin/index.js @@ -7,6 +7,7 @@ module.exports = { 'object-curly-spacing': require('./rules/object-curly-spacing'), 'object-shorthand': require('./rules/object-shorthand'), 'arrow-parens': require('./rules/arrow-parens'), + 'no-await-in-loop': require('./rules/no-await-in-loop'), }, rulesConfig: { 'generator-star-spacing': 0, @@ -14,5 +15,6 @@ module.exports = { 'object-curly-spacing': 0, 'object-shorthand': 0, 'arrow-parens': 0, + 'no-await-in-loop': 0, } }; diff --git a/eslint/babel-eslint-plugin/rules/no-await-in-loop.js b/eslint/babel-eslint-plugin/rules/no-await-in-loop.js new file mode 100644 index 000000000000..cc3bb91af4f0 --- /dev/null +++ b/eslint/babel-eslint-plugin/rules/no-await-in-loop.js @@ -0,0 +1,72 @@ +/** + * @fileoverview Rule to disallow uses of await inside of loops. + * @author Nat Mote + */ +"use strict"; + +// Node types which are considered loops. +var loopTypes = { + 'ForStatement': true, + 'ForOfStatement': true, + 'ForInStatement': true, + 'WhileStatement': true, + 'DoWhileStatement': true, +}; + +// Node types at which we should stop looking for loops. For example, it is fine to declare an async +// function within a loop, and use await inside of that. +var boundaryTypes = { + 'FunctionDeclaration': true, + 'FunctionExpression': true, + 'ArrowFunctionExpression': true, +}; + +module.exports = function(context) { + return { + // babel-eslint transpiles AwaitExpressions to YieldExpressions, but the actual node kind is + // still available in _babelType. + YieldExpression: function(node) { + if (node._babelType === 'AwaitExpression') { + var ancestors = context.getAncestors(); + // Reverse so that we can traverse from the deepest node upwards. + ancestors.reverse(); + // Create a set of all the ancestors plus this node so that we can check + // if this use of await appears in the body of the loop as opposed to + // the right-hand side of a for...of, for example. + // + // Implement the set with an Array since there are likely to be very few + // elements. An Object would not be appropriate since the elements are + // not strings. + var ancestorSet = [].concat(ancestors, [node]); + var ancestorSetHas = function(element) { + return ancestorSet.indexOf(element) !== -1; + } + for (var i = 0; i < ancestors.length; i++) { + var ancestor = ancestors[i]; + if (boundaryTypes.hasOwnProperty(ancestor.type)) { + // Short-circuit out if we encounter a boundary type. Loops above + // this do not matter. + return; + } + if (loopTypes.hasOwnProperty(ancestor.type)) { + // Only report if we are actually in the body or another part that gets executed on + // every iteration. + if ( + ancestorSetHas(ancestor.body) || + ancestorSetHas(ancestor.test) || + ancestorSetHas(ancestor.update) + ) { + context.report( + node, + 'Avoid using await inside a loop. Consider refactoring to use Promise.all. If ' + + 'you are sure you want to do this, add `// eslint-disable-line ' + + context.id + '` at the end of this line.' + ); + return; + } + } + } + } + }, + }; +} diff --git a/eslint/babel-eslint-plugin/tests/no-await-in-loop.js b/eslint/babel-eslint-plugin/tests/no-await-in-loop.js new file mode 100644 index 000000000000..ba82e4e78cbb --- /dev/null +++ b/eslint/babel-eslint-plugin/tests/no-await-in-loop.js @@ -0,0 +1,106 @@ +/** + * @fileoverview Tests for no-await-in-loop. + * @author Nat Mote + */ + +"use strict"; + +var rule = require("../rules/no-await-in-loop"), + RuleTester = require('eslint').RuleTester; + +var features = { +}; + +function test(code, errors){ + var result = { + code: code, + parser: 'babel-eslint', + ecmaFeatures: features, + }; + if (errors != null) { + result.errors = errors; + } + return result; +} + +var ruleName = 'babel/no-await-in-loop'; + +var message = 'Avoid using await inside a loop. Consider refactoring to use Promise.all. If ' + + 'you are sure you want to do this, add `// eslint-disable-line ' + + ruleName + '` at the end of this line.' + +function ok(code) { + return test(code); +} + +function err(code) { + return test(code, [message]); +} + +// Construct an async function with the given body +function fun(body) { + return "async function foo() { " + body + " }"; +} + +// Construct a loop +function loop(kind, condition, body) { + return kind + " (" + condition + ") { " + body + " }"; +} + +// Construct a class with the given body +function cls(body) { + return "class Foo { " + body + " }"; +} + +var cases = [ + ok(fun("await bar;")), + + // While loops + ok(fun(loop("while", "true", fun("await bar;")))), // Blocked by a function declaration + err(fun(loop("while", "baz", "await bar;"))), + err(fun(loop("while", "await foo()", ""))), + + // For of loops + err(fun(loop("for", "var bar of baz", "await bar;"))), + + // For in loops + err(fun(loop("for", "var bar in baz", "await bar;"))), + + // For loops + ok(fun(loop("for", "var i = await bar; i < n; i++", ""))), + err(fun(loop("for", "var i; i < n; i++", "await bar;"))), + err(fun(loop("for", "var i; await foo(i); i++", ""))), + err(fun(loop("for", "var i; i < n; i = await bar", ""))), + + // Do while loops + ok(fun("do { } while (bar);")), + err(fun("do { await bar; } while (baz);")), + err(fun("do { } while (await bar);")), + + // Blocked by a function expression + ok(fun(loop("while", "true", "var y = async function() { await bar; }"))), + // Blocked by an arrow function + ok(fun(loop("while", "true", "var y = async () => await foo;"))), + ok(fun(loop("while", "true", "var y = async () => { await foo; }"))), + // Blocked by a class method, + ok(fun(loop("while", "true", cls("async foo() { await bar; }")))), + + // Deep in a loop body + err(fun(loop("while", "true", "if (bar) { foo(await bar); }"))), + // Deep in a loop condition + err(fun(loop("while", "xyz || 5 > await x", ""))), +]; + +function hasError(testCase) { + return testCase.errors != null && testCase.errors.length > 0; +} + +function hasNoError(testCase) { + return !hasError(testCase); +} + +var ruleTester = new RuleTester(); +ruleTester.run(ruleName, rule, { + valid: cases.filter(hasNoError), + invalid: cases.filter(hasError), +}); From fcdf7ec95de763558bc0ab7bad51b81c0eb7ebaf Mon Sep 17 00:00:00 2001 From: jquense Date: Mon, 23 Nov 2015 19:16:41 -0500 Subject: [PATCH 490/569] v2.2.0 --- eslint/babel-eslint-plugin/README.md | 4 +++- eslint/babel-eslint-plugin/package.json | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md index 50200eb65eff..2d613fbf3af2 100644 --- a/eslint/babel-eslint-plugin/README.md +++ b/eslint/babel-eslint-plugin/README.md @@ -28,7 +28,8 @@ original ones as well!). "babel/new-cap": 1, "babel/object-curly-spacing": 1, "babel/object-shorthand": 1, - "babel/arrow-parens": 1 + "babel/arrow-parens": 1, + "babel/no-await-in-loop": 1 } } ``` @@ -41,3 +42,4 @@ Each rule corresponds to a core `eslint` rule, and has the same options. - `babel/object-curly-spacing`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` - `babel/object-shorthand`: doesn't fail when using object spread (`...obj`) - `babel/arrow-parens`: Handles async functions correctly +- `bael/no-await-in-loop`: guard against awaiting async functions inside of a loop diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index 3d7d0c5e5807..29c67dcbd6cd 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-babel", - "version": "2.1.1", + "version": "2.2.0", "description": "an eslint rule plugin companion to babel-eslint", "main": "index.js", "scripts": { From a2c695275d7ae28cd837ed1673865060ad61fe10 Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Wed, 25 Nov 2015 14:47:17 -0500 Subject: [PATCH 491/569] Merge pull request babel/eslint-plugin-babel#29 from evocateur/no-deps Future-proofing --- eslint/babel-eslint-plugin/helpers.js | 15 --------------- eslint/babel-eslint-plugin/package.json | 3 --- eslint/babel-eslint-plugin/rules/new-cap.js | 8 ++++---- 3 files changed, 4 insertions(+), 22 deletions(-) delete mode 100644 eslint/babel-eslint-plugin/helpers.js diff --git a/eslint/babel-eslint-plugin/helpers.js b/eslint/babel-eslint-plugin/helpers.js deleted file mode 100644 index 77f42a3bf404..000000000000 --- a/eslint/babel-eslint-plugin/helpers.js +++ /dev/null @@ -1,15 +0,0 @@ -var _parse = require('babel-core').parse; - -module.exports = { - parse: function(code){ - var ast = null - try { - ast = _parse(code, { locations: true, ranges: true }).body[0] //unwrap body - } - catch (err){ - console.warn(err) - } - - return ast - } -} \ No newline at end of file diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index 29c67dcbd6cd..28a10bd21103 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -32,8 +32,5 @@ "is-my-json-valid": "^2.12.0", "mocha": "^2.2.5", "phantomjs": "^1.9.17" - }, - "dependencies": { - "babel-core": "^5.5.8" } } diff --git a/eslint/babel-eslint-plugin/rules/new-cap.js b/eslint/babel-eslint-plugin/rules/new-cap.js index a1d4575c2a80..0e17a9baae58 100644 --- a/eslint/babel-eslint-plugin/rules/new-cap.js +++ b/eslint/babel-eslint-plugin/rules/new-cap.js @@ -69,8 +69,8 @@ function calculateCapIsNewExceptions(config) { module.exports = function(context) { var config = context.options[0] || {}; - config.newIsCap = config.newIsCap !== false; - config.capIsNew = config.capIsNew !== false; + var NEW_IS_CAP = config.newIsCap !== false; + var CAP_IS_NEW = config.capIsNew !== false; var newIsCapExceptions = checkArray(config, "newIsCapExceptions", []).reduce(invert, {}); @@ -176,7 +176,7 @@ module.exports = function(context) { // Public //-------------------------------------------------------------------------- - if (config.newIsCap) { + if (NEW_IS_CAP) { listeners.NewExpression = function(node) { var constructorName = extractNameFromExpression(node); @@ -190,7 +190,7 @@ module.exports = function(context) { }; } - if (config.capIsNew) { + if (CAP_IS_NEW) { listeners.CallExpression = function(node) { var calleeName = extractNameFromExpression(node); From 1168d6056475010e214039f582a198be06aafa22 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 25 Nov 2015 18:51:45 -0500 Subject: [PATCH 492/569] 3.0.0 --- eslint/babel-eslint-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index 28a10bd21103..fdcbb5058d6e 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-babel", - "version": "2.2.0", + "version": "3.0.0", "description": "an eslint rule plugin companion to babel-eslint", "main": "index.js", "scripts": { From 885bfe95dc15bfe84f086aab1e194b3af5ff10db Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sun, 29 Nov 2015 19:28:01 -0500 Subject: [PATCH 493/569] Merge pull request babel/eslint-plugin-babel#32 from hawkrives/patch-1 Fix typo in README rules section --- eslint/babel-eslint-plugin/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md index 2d613fbf3af2..d0b799a5852f 100644 --- a/eslint/babel-eslint-plugin/README.md +++ b/eslint/babel-eslint-plugin/README.md @@ -42,4 +42,4 @@ Each rule corresponds to a core `eslint` rule, and has the same options. - `babel/object-curly-spacing`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` - `babel/object-shorthand`: doesn't fail when using object spread (`...obj`) - `babel/arrow-parens`: Handles async functions correctly -- `bael/no-await-in-loop`: guard against awaiting async functions inside of a loop +- `babel/no-await-in-loop`: guard against awaiting async functions inside of a loop From 9eebd7b05742d97c5ebf34cac724f1f08ceff926 Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Sun, 20 Dec 2015 16:43:33 -0500 Subject: [PATCH 494/569] Merge pull request babel/eslint-plugin-babel#38 from zaygraveyard/issue36 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix: `object-curly-spacing` had been crashing on an empty object patt… --- .../rules/object-curly-spacing.js | 172 ++++++----- .../tests/object-curly-spacing.js | 272 +++++++++++++++++- 2 files changed, 357 insertions(+), 87 deletions(-) diff --git a/eslint/babel-eslint-plugin/rules/object-curly-spacing.js b/eslint/babel-eslint-plugin/rules/object-curly-spacing.js index 93e3ac17a4e9..781d41562b7e 100644 --- a/eslint/babel-eslint-plugin/rules/object-curly-spacing.js +++ b/eslint/babel-eslint-plugin/rules/object-curly-spacing.js @@ -6,6 +6,8 @@ * @copyright 2014 Vignesh Anand. All rights reserved. * @copyright 2015 Jamund Ferguson. All rights reserved. * @copyright 2015 Mathieu M-Gosselin. All rights reserved. + * @copyright 2015 Toru Nagashima. All rights reserved. + * See LICENSE file in root directory for full license. */ "use strict"; @@ -14,7 +16,8 @@ //------------------------------------------------------------------------------ module.exports = function(context) { - var spaced = context.options[0] === "always"; + var spaced = context.options[0] === "always", + sourceCode = context.getSourceCode(); /** * Determines whether an option is set, relative to the spacing option. @@ -44,7 +47,7 @@ module.exports = function(context) { * @returns {boolean} Whether or not there is space between the tokens. */ function isSpaced(left, right) { - return left.range[1] < right.range[0]; + return sourceCode.isSpaceBetweenTokens(left, right); } /** @@ -64,7 +67,7 @@ module.exports = function(context) { * @returns {void} */ function reportNoBeginningSpace(node, token) { - context.report(node, token.loc.start, + context.report(node, token.loc.end, "There should be no space after '" + token.value + "'"); } @@ -86,7 +89,7 @@ module.exports = function(context) { * @returns {void} */ function reportRequiredBeginningSpace(node, token) { - context.report(node, token.loc.start, + context.report(node, token.loc.end, "A space is required after '" + token.value + "'"); } @@ -135,96 +138,115 @@ module.exports = function(context) { } } - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- + /** + * Reports a given object node if spacing in curly braces is invalid. + * @param {ASTNode} node - An ObjectExpression or ObjectPattern node to check. + * @returns {void} + */ + function checkForObject(node) { + if (node.properties.length === 0) { + return; + } - return { + var firstSpecifier = node.properties[0], + lastSpecifier = node.properties[node.properties.length - 1]; - // var {x} = y; - ObjectPattern: function(node) { - var firstSpecifier = node.properties[0], - lastSpecifier = node.properties[node.properties.length - 1]; - - var first = context.getTokenBefore(firstSpecifier), - second = context.getFirstToken(firstSpecifier), - penultimate = context.getLastToken(lastSpecifier), - last = context.getTokenAfter(lastSpecifier); - - // support trailing commas - if (last.value === ",") { - penultimate = last; - last = context.getTokenAfter(last); - } + var first = sourceCode.getTokenBefore(firstSpecifier), + last = sourceCode.getTokenAfter(lastSpecifier); - validateBraceSpacing(node, first, second, penultimate, last); - }, + // support trailing commas + if (last.value === ",") { + last = sourceCode.getTokenAfter(last); + } - // import {y} from 'x'; - ImportDeclaration: function(node) { + var second = sourceCode.getTokenAfter(first), + penultimate = sourceCode.getTokenBefore(last); - var firstSpecifier = node.specifiers[0], - lastSpecifier = node.specifiers[node.specifiers.length - 1]; + validateBraceSpacing(node, first, second, penultimate, last); + } - // don't do anything for namespace or default imports - if (firstSpecifier && lastSpecifier && firstSpecifier.type === "ImportSpecifier" && lastSpecifier.type === "ImportSpecifier") { - var first = context.getTokenBefore(firstSpecifier), - second = context.getFirstToken(firstSpecifier), - penultimate = context.getLastToken(lastSpecifier), - last = context.getTokenAfter(lastSpecifier); + /** + * Reports a given import node if spacing in curly braces is invalid. + * @param {ASTNode} node - An ImportDeclaration node to check. + * @returns {void} + */ + function checkForImport(node) { + if (node.specifiers.length === 0) { + return; + } - // support trailing commas - if (last.value === ",") { - penultimate = last; - last = context.getTokenAfter(last); - } + var firstSpecifier = node.specifiers[0], + lastSpecifier = node.specifiers[node.specifiers.length - 1]; - validateBraceSpacing(node, first, second, penultimate, last); - } + if (lastSpecifier.type !== "ImportSpecifier") { + return; + } + if (firstSpecifier.type !== "ImportSpecifier") { + firstSpecifier = node.specifiers[1]; + } - }, + var first = sourceCode.getTokenBefore(firstSpecifier), + last = sourceCode.getTokenAfter(lastSpecifier); - // export {name} from 'yo'; - ExportNamedDeclaration: function(node) { - if (!node.specifiers.length) { - return; - } + // to support a trailing comma. + if (last.value === ",") { + last = sourceCode.getTokenAfter(last); + } - var firstSpecifier = node.specifiers[0], - lastSpecifier = node.specifiers[node.specifiers.length - 1], - first = context.getTokenBefore(firstSpecifier), - second = context.getFirstToken(firstSpecifier), - penultimate = context.getLastToken(lastSpecifier), - last = context.getTokenAfter(lastSpecifier); + var second = sourceCode.getTokenAfter(first), + penultimate = sourceCode.getTokenBefore(last); - if (first.value === "export") { - return; - } + validateBraceSpacing(node, first, second, penultimate, last); + } - // support trailing commas - if (last.value === ",") { - penultimate = last; - last = context.getTokenAfter(last); - } + /** + * Reports a given export node if spacing in curly braces is invalid. + * @param {ASTNode} node - An ExportNamedDeclaration node to check. + * @returns {void} + */ + function checkForExport(node) { + if (node.specifiers.length === 0) { + return; + } - validateBraceSpacing(node, first, second, penultimate, last); + var firstSpecifier = node.specifiers[0], + lastSpecifier = node.specifiers[node.specifiers.length - 1], + first = sourceCode.getTokenBefore(firstSpecifier), + last = sourceCode.getTokenAfter(lastSpecifier); - }, + // export * as x from '...'; + // export x from '...'; + if (first.value === "export") { + return; + } - // var y = {x: 'y'} - ObjectExpression: function(node) { - if (node.properties.length === 0) { - return; - } + // to support a trailing comma. + if (last.value === ",") { + last = sourceCode.getTokenAfter(last); + } - var first = context.getFirstToken(node), - second = context.getFirstToken(node, 1), - penultimate = context.getLastToken(node, 1), - last = context.getLastToken(node); + var second = sourceCode.getTokenAfter(first), + penultimate = sourceCode.getTokenBefore(last); - validateBraceSpacing(node, first, second, penultimate, last); - } + validateBraceSpacing(node, first, second, penultimate, last); + } + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + // var {x} = y; + ObjectPattern: checkForObject, + + // var y = {x: 'y'} + ObjectExpression: checkForObject, + + // import {y} from 'x'; + ImportDeclaration: checkForImport, + + // export {name} from 'yo'; + ExportNamedDeclaration: checkForExport }; }; diff --git a/eslint/babel-eslint-plugin/tests/object-curly-spacing.js b/eslint/babel-eslint-plugin/tests/object-curly-spacing.js index 83332d4539a9..a94312a4c3e9 100644 --- a/eslint/babel-eslint-plugin/tests/object-curly-spacing.js +++ b/eslint/babel-eslint-plugin/tests/object-curly-spacing.js @@ -31,18 +31,28 @@ ruleTester.run('babel/object-curly-spacing', rule, { { code: "var { x: { z }, y } = y", options: ["always"], ecmaFeatures: { destructuring: true } }, { code: "var {\ny,\n} = x", options: ["always"], ecmaFeatures: { destructuring: true } }, { code: "var { y, } = x", options: ["always"], ecmaFeatures: { destructuring: true } }, + { code: "var { y: x } = x", options: ["always"], ecmaFeatures: { destructuring: true } }, // always - import / export + { code: "import door from 'room'", options: ["always"], ecmaFeatures: { modules: true } }, + { code: "import * as door from 'room'", options: ["always"], ecmaFeatures: { modules: true } }, { code: "import { door } from 'room'", options: ["always"], ecmaFeatures: { modules: true } }, { code: "import {\ndoor } from 'room'", options: ["always"], ecmaFeatures: { modules: true } }, { code: "export { door } from 'room'", options: ["always"], ecmaFeatures: { modules: true } }, { code: "import { house, mouse } from 'caravan'", options: ["always"], ecmaFeatures: { modules: true } }, { code: "import {\nhouse,\nmouse\n} from 'caravan'", options: ["always"], ecmaFeatures: { modules: true } }, { code: "import {\nhouse,\nmouse,\n} from 'caravan'", options: ["always"], ecmaFeatures: { modules: true } }, + { code: "import house, { mouse } from 'caravan'", options: ["always"], ecmaFeatures: { modules: true } }, + { code: "import door, { house, mouse } from 'caravan'", options: ["always"], ecmaFeatures: { modules: true } }, { code: "export { door }", options: ["always"], ecmaFeatures: { modules: true } }, { code: "export {\ndoor,\nhouse\n}", options: ["always"], ecmaFeatures: { modules: true } }, { code: "export {\ndoor,\nhouse,\n}", options: ["always"], ecmaFeatures: { modules: true } }, { code: "import 'room'", options: ["always"], ecmaFeatures: { modules: true } }, + { code: "import { bar as x } from 'foo';", options: ["always"], ecmaFeatures: { modules: true } }, + { code: "import { x, } from 'foo';", options: ["always"], ecmaFeatures: { modules: true } }, + { code: "import {\nx,\n} from 'foo';", options: ["always"], ecmaFeatures: { modules: true } }, + { code: "export { x, } from 'foo';", options: ["always"], ecmaFeatures: { modules: true } }, + { code: "export {\nx,\n} from 'foo';", options: ["always"], ecmaFeatures: { modules: true } }, // always - empty object { code: "var foo = {};", options: ["always"] }, @@ -81,8 +91,11 @@ ruleTester.run('babel/object-curly-spacing', rule, { { code: "var {\nx: {z\n}, y} = y", options: ["never"], ecmaFeatures: { destructuring: true } }, { code: "var {\ny,\n} = x", options: ["never"], ecmaFeatures: { destructuring: true } }, { code: "var {y,} = x", options: ["never"], ecmaFeatures: { destructuring: true } }, + { code: "var {y:x} = x", options: ["never"], ecmaFeatures: { destructuring: true } }, // never - import / export + { code: "import door from 'room'", options: ["never"], ecmaFeatures: { modules: true } }, + { code: "import * as door from 'room'", options: ["never"], ecmaFeatures: { modules: true } }, { code: "import {door} from 'room'", options: ["never"], ecmaFeatures: { modules: true } }, { code: "export {door} from 'room'", options: ["never"], ecmaFeatures: { modules: true } }, { code: "import {\ndoor} from 'room'", options: ["never"], ecmaFeatures: { modules: true } }, @@ -95,6 +108,14 @@ ruleTester.run('babel/object-curly-spacing', rule, { { code: "export {\ndoor,\nmouse\n}", options: ["never"], ecmaFeatures: { modules: true } }, { code: "export {\ndoor,\nmouse,\n}", options: ["never"], ecmaFeatures: { modules: true } }, { code: "import 'room'", options: ["never"], ecmaFeatures: { modules: true } }, + { code: "import x, {bar} from 'foo';", options: ["never"], ecmaFeatures: { modules: true } }, + { code: "import x, {bar, baz} from 'foo';", options: ["never"], ecmaFeatures: { modules: true } }, + { code: "import {bar as y} from 'foo';", options: ["never"], ecmaFeatures: { modules: true } }, + { code: "import {x,} from 'foo';", options: ["never"], ecmaFeatures: { modules: true } }, + { code: "import {\nx,\n} from 'foo';", options: ["never"], ecmaFeatures: { modules: true } }, + { code: "export {x,} from 'foo';", options: ["never"], ecmaFeatures: { modules: true } }, + { code: "export {\nx,\n} from 'foo';", options: ["never"], ecmaFeatures: { modules: true } }, + // never - empty object { code: "var foo = {};", options: ["never"] }, @@ -102,9 +123,32 @@ ruleTester.run('babel/object-curly-spacing', rule, { // never - objectsInObjects { code: "var obj = {'foo': {'bar': 1, 'baz': 2} };", options: ["never", {"objectsInObjects": true}]}, + // https://github.com/eslint/eslint/issues/3658 + // Empty cases. + { code: "var {} = foo;", ecmaFeatures: { destructuring: true }}, + { code: "var [] = foo;", ecmaFeatures: { destructuring: true }}, + { code: "var {a: {}} = foo;", ecmaFeatures: { destructuring: true }}, + { code: "var {a: []} = foo;", ecmaFeatures: { destructuring: true }}, + { code: "import {} from 'foo';", ecmaFeatures: { modules: true }}, + { code: "export {} from 'foo';", ecmaFeatures: { modules: true }}, + { code: "export {};", ecmaFeatures: { modules: true }}, + { code: "var {} = foo;", options: ["never"], ecmaFeatures: { destructuring: true }}, + { code: "var [] = foo;", options: ["never"], ecmaFeatures: { destructuring: true }}, + { code: "var {a: {}} = foo;", options: ["never"], ecmaFeatures: { destructuring: true }}, + { code: "var {a: []} = foo;", options: ["never"], ecmaFeatures: { destructuring: true }}, + { code: "import {} from 'foo';", options: ["never"], ecmaFeatures: { modules: true }}, + { code: "export {} from 'foo';", options: ["never"], ecmaFeatures: { modules: true }}, + { code: "export {};", options: ["never"], ecmaFeatures: { modules: true }}, + // Babel test cases. { code: "export * as x from \"mod\";", parser: "babel-eslint", ecmaFeatures: { modules: true } }, { code: "export x from \"mod\";", parser: "babel-eslint", ecmaFeatures: { modules: true } }, + + // always - destructuring typed object param + { code: "function fn({ a,b }:Object){}", options: ["always"], parser: "babel-eslint", ecmaFeatures: { destructuring: true } }, + + // never - destructuring typed object param + { code: "function fn({a,b}: Object){}", options: ["never"], parser: "babel-eslint", ecmaFeatures: { destructuring: true } }, ], invalid: [ @@ -119,13 +163,182 @@ ruleTester.run('babel/object-curly-spacing', rule, { message: "A space is required after '{'", type: "ImportDeclaration", line: 1, - column: 8 + column: 9 + }, + { + message: "A space is required before '}'", + type: "ImportDeclaration", + line: 1, + column: 12 + } + ] + }, + { + code: "import { bar as y} from 'foo.js';", + options: ["always"], + ecmaFeatures: { + modules: true + }, + errors: [ + { + message: "A space is required before '}'", + type: "ImportDeclaration", + line: 1, + column: 18 + } + ] + }, + { + code: "import {bar as y} from 'foo.js';", + options: ["always"], + ecmaFeatures: { + modules: true + }, + errors: [ + { + message: "A space is required after '{'", + type: "ImportDeclaration", + line: 1, + column: 9 + }, + { + message: "A space is required before '}'", + type: "ImportDeclaration", + line: 1, + column: 17 + } + ] + }, + { + code: "import { bar} from 'foo.js';", + options: ["always"], + ecmaFeatures: { + modules: true + }, + errors: [ + { + message: "A space is required before '}'", + type: "ImportDeclaration", + line: 1, + column: 13 + } + ] + }, + { + code: "import x, { bar} from 'foo';", + options: ["always"], + ecmaFeatures: { + modules: true + }, + errors: [ + { + message: "A space is required before '}'", + type: "ImportDeclaration", + line: 1, + column: 16 + } + + ] + }, + { + code: "import x, { bar, baz} from 'foo';", + options: ["always"], + ecmaFeatures: { + modules: true + }, + errors: [ + { + message: "A space is required before '}'", + type: "ImportDeclaration", + line: 1, + column: 21 + } + + ] + }, + { + code: "import x, {bar} from 'foo';", + options: ["always"], + ecmaFeatures: { + modules: true + }, + errors: [ + { + message: "A space is required after '{'", + type: "ImportDeclaration", + line: 1, + column: 12 }, { message: "A space is required before '}'", type: "ImportDeclaration", line: 1, + column: 15 + } + + ] + }, + { + code: "import x, {bar, baz} from 'foo';", + options: ["always"], + ecmaFeatures: { + modules: true + }, + errors: [ + { + message: "A space is required after '{'", + type: "ImportDeclaration", + line: 1, column: 12 + }, + { + message: "A space is required before '}'", + type: "ImportDeclaration", + line: 1, + column: 20 + } + ] + }, + { + code: "import {bar,} from 'foo';", + options: ["always"], + ecmaFeatures: { + modules: true + }, + errors: [ + { + message: "A space is required after '{'", + type: "ImportDeclaration", + line: 1, + column: 9 + }, + { + message: "A space is required before '}'", + type: "ImportDeclaration", + line: 1, + column: 13 + } + + ] + }, + { + code: "import { bar, } from 'foo';", + options: ["never"], + ecmaFeatures: { + modules: true + }, + errors: [ + { + message: "There should be no space after '{'", + type: "ImportDeclaration", + line: 1, + column: 9 + }, + { + message: "There should be no space before '}'", + type: "ImportDeclaration", + line: 1, + column: 15 } ] }, @@ -140,7 +353,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { message: "A space is required after '{'", type: "ExportNamedDeclaration", line: 1, - column: 8 + column: 9 }, { message: "A space is required before '}'", @@ -226,6 +439,38 @@ ruleTester.run('babel/object-curly-spacing', rule, { } ] }, + { + code: "var {a:b } = x;", + options: ["never"], + ecmaFeatures: { destructuring: true }, + errors: [ + { + message: "There should be no space before '}'", + type: "ObjectPattern", + line: 1, + column: 10 + } + ] + }, + { + code: "var { a:b } = x;", + options: ["never"], + ecmaFeatures: { destructuring: true }, + errors: [ + { + message: "There should be no space after '{'", + type: "ObjectPattern", + line: 1, + column: 6 + }, + { + message: "There should be no space before '}'", + type: "ObjectPattern", + line: 1, + column: 11 + } + ] + }, // never-objectsInObjects { @@ -262,7 +507,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { message: "A space is required after '{'", type: "ObjectExpression", line: 1, - column: 11 + column: 12 }, { message: "A space is required before '}'", @@ -280,7 +525,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { message: "A space is required after '{'", type: "ObjectExpression", line: 1, - column: 11 + column: 12 } ] }, @@ -304,7 +549,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { message: "There should be no space after '{'", type: "ObjectExpression", line: 1, - column: 11 + column: 12 }, { message: "There should be no space before '}'", @@ -334,7 +579,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { message: "There should be no space after '{'", type: "ObjectExpression", line: 1, - column: 11 + column: 12 } ] }, @@ -346,13 +591,13 @@ ruleTester.run('babel/object-curly-spacing', rule, { message: "There should be no space after '{'", type: "ObjectExpression", line: 1, - column: 11 + column: 12 }, { message: "There should be no space after '{'", type: "ObjectExpression", line: 1, - column: 18 + column: 19 } ] }, @@ -386,7 +631,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { message: "A space is required after '{'", type: "ObjectExpression", line: 1, - column: 22 + column: 23 } ] }, @@ -394,6 +639,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { // destructuring { code: "var {x, y} = y", + utput: "var { x, y = y", ecmaFeatures: {destructuring: true}, options: ["always"], errors: [ @@ -401,7 +647,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { message: "A space is required after '{'", type: "ObjectPattern", line: 1, - column: 5 + column: 6 }, { message: "A space is required before '}'", @@ -413,6 +659,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "var { x, y} = y", + ouput: "var { x, y } y", ecmaFeatures: {destructuring: true}, options: ["always"], errors: [ @@ -426,6 +673,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "var { x, y } = y", + ouput: "var {x, y} = ", ecmaFeatures: {destructuring: true}, options: ["never"], errors: [ @@ -433,7 +681,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { message: "There should be no space after '{'", type: "ObjectPattern", line: 1, - column: 5 + column: 6 }, { message: "There should be no space before '}'", @@ -478,7 +726,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { message: "A space is required after '{'", type: "ObjectPattern", line: 1, - column: 5 + column: 6 } ] }, From b5cdcbe06e93125247e1a0b19bed6a0823a6bcf4 Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Sun, 20 Dec 2015 17:14:32 -0500 Subject: [PATCH 495/569] Merge pull request babel/eslint-plugin-babel#39 from zaygraveyard/issue37 Update: Implement auto fix for object-curly-spacing (fixes babel/eslint-plugin-babel#37) --- .../rules/object-curly-spacing.js | 42 +++++++++++++---- .../tests/object-curly-spacing.js | 47 +++++++++++++++---- 2 files changed, 72 insertions(+), 17 deletions(-) diff --git a/eslint/babel-eslint-plugin/rules/object-curly-spacing.js b/eslint/babel-eslint-plugin/rules/object-curly-spacing.js index 781d41562b7e..54d8becae9a7 100644 --- a/eslint/babel-eslint-plugin/rules/object-curly-spacing.js +++ b/eslint/babel-eslint-plugin/rules/object-curly-spacing.js @@ -67,8 +67,15 @@ module.exports = function(context) { * @returns {void} */ function reportNoBeginningSpace(node, token) { - context.report(node, token.loc.end, - "There should be no space after '" + token.value + "'"); + context.report({ + node: node, + loc: token.loc.end, + message: "There should be no space after '" + token.value + "'", + fix: function(fixer) { + var nextToken = sourceCode.getTokenAfter(token); + return fixer.removeRange([token.range[1], nextToken.range[0]]); + } + }); } /** @@ -78,8 +85,15 @@ module.exports = function(context) { * @returns {void} */ function reportNoEndingSpace(node, token) { - context.report(node, token.loc.start, - "There should be no space before '" + token.value + "'"); + context.report({ + node: node, + loc: token.loc.start, + message: "There should be no space before '" + token.value + "'", + fix: function(fixer) { + var previousToken = sourceCode.getTokenBefore(token); + return fixer.removeRange([previousToken.range[1], token.range[0]]); + } + }); } /** @@ -89,8 +103,14 @@ module.exports = function(context) { * @returns {void} */ function reportRequiredBeginningSpace(node, token) { - context.report(node, token.loc.end, - "A space is required after '" + token.value + "'"); + context.report({ + node: node, + loc: token.loc.end, + message: "A space is required after '" + token.value + "'", + fix: function(fixer) { + return fixer.insertTextAfter(token, " "); + } + }); } /** @@ -100,8 +120,14 @@ module.exports = function(context) { * @returns {void} */ function reportRequiredEndingSpace(node, token) { - context.report(node, token.loc.start, - "A space is required before '" + token.value + "'"); + context.report({ + node: node, + loc: token.loc.start, + message: "A space is required before '" + token.value + "'", + fix: function(fixer) { + return fixer.insertTextBefore(token, " "); + } + }); } /** diff --git a/eslint/babel-eslint-plugin/tests/object-curly-spacing.js b/eslint/babel-eslint-plugin/tests/object-curly-spacing.js index a94312a4c3e9..70fbfaa6c809 100644 --- a/eslint/babel-eslint-plugin/tests/object-curly-spacing.js +++ b/eslint/babel-eslint-plugin/tests/object-curly-spacing.js @@ -143,17 +143,12 @@ ruleTester.run('babel/object-curly-spacing', rule, { // Babel test cases. { code: "export * as x from \"mod\";", parser: "babel-eslint", ecmaFeatures: { modules: true } }, { code: "export x from \"mod\";", parser: "babel-eslint", ecmaFeatures: { modules: true } }, - - // always - destructuring typed object param - { code: "function fn({ a,b }:Object){}", options: ["always"], parser: "babel-eslint", ecmaFeatures: { destructuring: true } }, - - // never - destructuring typed object param - { code: "function fn({a,b}: Object){}", options: ["never"], parser: "babel-eslint", ecmaFeatures: { destructuring: true } }, ], invalid: [ { code: "import {bar} from 'foo.js';", + output: "import { bar } from 'foo.js';", options: ["always"], ecmaFeatures: { modules: true @@ -175,6 +170,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "import { bar as y} from 'foo.js';", + output: "import { bar as y } from 'foo.js';", options: ["always"], ecmaFeatures: { modules: true @@ -190,6 +186,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "import {bar as y} from 'foo.js';", + output: "import { bar as y } from 'foo.js';", options: ["always"], ecmaFeatures: { modules: true @@ -211,6 +208,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "import { bar} from 'foo.js';", + output: "import { bar } from 'foo.js';", options: ["always"], ecmaFeatures: { modules: true @@ -226,6 +224,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "import x, { bar} from 'foo';", + output: "import x, { bar } from 'foo';", options: ["always"], ecmaFeatures: { modules: true @@ -242,6 +241,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "import x, { bar, baz} from 'foo';", + output: "import x, { bar, baz } from 'foo';", options: ["always"], ecmaFeatures: { modules: true @@ -258,6 +258,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "import x, {bar} from 'foo';", + output: "import x, { bar } from 'foo';", options: ["always"], ecmaFeatures: { modules: true @@ -280,6 +281,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "import x, {bar, baz} from 'foo';", + output: "import x, { bar, baz } from 'foo';", options: ["always"], ecmaFeatures: { modules: true @@ -301,6 +303,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "import {bar,} from 'foo';", + output: "import { bar, } from 'foo';", options: ["always"], ecmaFeatures: { modules: true @@ -323,6 +326,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "import { bar, } from 'foo';", + output: "import {bar,} from 'foo';", options: ["never"], ecmaFeatures: { modules: true @@ -344,6 +348,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "export {bar};", + output: "export { bar };", options: ["always"], ecmaFeatures: { modules: true @@ -367,6 +372,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { // always - arraysInObjects { code: "var obj = { 'foo': [ 1, 2 ] };", + output: "var obj = { 'foo': [ 1, 2 ]};", options: ["always", {"arraysInObjects": false}], errors: [ { @@ -377,6 +383,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "var obj = { 'foo': [ 1, 2 ] , 'bar': [ 'baz', 'qux' ] };", + output: "var obj = { 'foo': [ 1, 2 ] , 'bar': [ 'baz', 'qux' ]};", options: ["always", {"arraysInObjects": false}], errors: [ { @@ -389,6 +396,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { // always-objectsInObjects { code: "var obj = { 'foo': { 'bar': 1, 'baz': 2 } };", + output: "var obj = { 'foo': { 'bar': 1, 'baz': 2 }};", options: ["always", {"objectsInObjects": false}], errors: [ { @@ -401,6 +409,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "var obj = { 'foo': [ 1, 2 ] , 'bar': { 'baz': 1, 'qux': 2 } };", + output: "var obj = { 'foo': [ 1, 2 ] , 'bar': { 'baz': 1, 'qux': 2 }};", options: ["always", {"objectsInObjects": false}], errors: [ { @@ -415,6 +424,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { // always-destructuring trailing comma { code: "var { a,} = x;", + output: "var { a, } = x;", options: ["always"], ecmaFeatures: { destructuring: true }, errors: [ @@ -428,6 +438,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "var {a, } = x;", + output: "var {a,} = x;", options: ["never"], ecmaFeatures: { destructuring: true }, errors: [ @@ -441,6 +452,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "var {a:b } = x;", + output: "var {a:b} = x;", options: ["never"], ecmaFeatures: { destructuring: true }, errors: [ @@ -454,6 +466,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "var { a:b } = x;", + output: "var {a:b} = x;", options: ["never"], ecmaFeatures: { destructuring: true }, errors: [ @@ -475,6 +488,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { // never-objectsInObjects { code: "var obj = {'foo': {'bar': 1, 'baz': 2}};", + output: "var obj = {'foo': {'bar': 1, 'baz': 2} };", options: ["never", {"objectsInObjects": true}], errors: [ { @@ -487,6 +501,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "var obj = {'foo': [1, 2] , 'bar': {'baz': 1, 'qux': 2}};", + output: "var obj = {'foo': [1, 2] , 'bar': {'baz': 1, 'qux': 2} };", options: ["never", {"objectsInObjects": true}], errors: [ { @@ -501,6 +516,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { // always & never { code: "var obj = {foo: bar, baz: qux};", + output: "var obj = { foo: bar, baz: qux };", options: ["always"], errors: [ { @@ -519,6 +535,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "var obj = {foo: bar, baz: qux };", + output: "var obj = { foo: bar, baz: qux };", options: ["always"], errors: [ { @@ -531,6 +548,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "var obj = { foo: bar, baz: qux};", + output: "var obj = { foo: bar, baz: qux };", options: ["always"], errors: [ { @@ -543,6 +561,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "var obj = { foo: bar, baz: qux };", + output: "var obj = {foo: bar, baz: qux};", options: ["never"], errors: [ { @@ -561,6 +580,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "var obj = {foo: bar, baz: qux };", + output: "var obj = {foo: bar, baz: qux};", options: ["never"], errors: [ { @@ -573,6 +593,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "var obj = { foo: bar, baz: qux};", + output: "var obj = {foo: bar, baz: qux};", options: ["never"], errors: [ { @@ -585,6 +606,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "var obj = { foo: { bar: quxx}, baz: qux};", + output: "var obj = {foo: {bar: quxx}, baz: qux};", options: ["never"], errors: [ { @@ -603,6 +625,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "var obj = {foo: {bar: quxx }, baz: qux };", + output: "var obj = {foo: {bar: quxx}, baz: qux};", options: ["never"], errors: [ { @@ -621,6 +644,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "export const thing = {value: 1 };", + output: "export const thing = { value: 1 };", ecmaFeatures: { modules: true, blockBindings: true @@ -639,7 +663,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { // destructuring { code: "var {x, y} = y", - utput: "var { x, y = y", + output: "var { x, y } = y", ecmaFeatures: {destructuring: true}, options: ["always"], errors: [ @@ -659,7 +683,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "var { x, y} = y", - ouput: "var { x, y } y", + output: "var { x, y } = y", ecmaFeatures: {destructuring: true}, options: ["always"], errors: [ @@ -673,7 +697,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "var { x, y } = y", - ouput: "var {x, y} = ", + output: "var {x, y} = y", ecmaFeatures: {destructuring: true}, options: ["never"], errors: [ @@ -693,6 +717,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "var {x, y } = y", + output: "var {x, y} = y", ecmaFeatures: {destructuring: true}, options: ["never"], errors: [ @@ -706,6 +731,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "var { x=10} = y", + output: "var { x=10 } = y", ecmaFeatures: {destructuring: true}, options: ["always"], errors: [ @@ -719,6 +745,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "var {x=10 } = y", + output: "var { x=10 } = y", ecmaFeatures: {destructuring: true}, options: ["always"], errors: [ @@ -734,6 +761,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { // never - arraysInObjects { code: "var obj = {'foo': [1, 2]};", + output: "var obj = {'foo': [1, 2] };", options: ["never", {"arraysInObjects": true}], errors: [ { @@ -744,6 +772,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, { code: "var obj = {'foo': [1, 2] , 'bar': ['baz', 'qux']};", + output: "var obj = {'foo': [1, 2] , 'bar': ['baz', 'qux'] };", options: ["never", {"arraysInObjects": true}], errors: [ { From 8bc70e3aac37367817c20c1dd465851c0028a02e Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Sun, 20 Dec 2015 19:13:30 -0500 Subject: [PATCH 496/569] Merge pull request babel/eslint-plugin-babel#40 from zaygraveyard/issue18 Update: Add tests to check the issue babel/eslint-plugin-babel#18 --- .../tests/object-curly-spacing.js | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/eslint/babel-eslint-plugin/tests/object-curly-spacing.js b/eslint/babel-eslint-plugin/tests/object-curly-spacing.js index 70fbfaa6c809..5e70fc5bbcae 100644 --- a/eslint/babel-eslint-plugin/tests/object-curly-spacing.js +++ b/eslint/babel-eslint-plugin/tests/object-curly-spacing.js @@ -143,6 +143,12 @@ ruleTester.run('babel/object-curly-spacing', rule, { // Babel test cases. { code: "export * as x from \"mod\";", parser: "babel-eslint", ecmaFeatures: { modules: true } }, { code: "export x from \"mod\";", parser: "babel-eslint", ecmaFeatures: { modules: true } }, + + // always - destructuring typed object param + { code: "function fn({ a,b }:Object){}", options: ["always"], parser: "babel-eslint", ecmaFeatures: { destructuring: true } }, + + // never - destructuring typed object param + { code: "function fn({a,b}: Object){}", options: ["never"], parser: "babel-eslint", ecmaFeatures: { destructuring: true } }, ], invalid: [ @@ -780,6 +786,58 @@ ruleTester.run('babel/object-curly-spacing', rule, { type: "ObjectExpression" } ] + }, + + // Babel test cases. + + // always - destructuring typed object param + { + code: "function fn({a,b}: Object){}", + output: "function fn({ a,b }: Object){}", + options: ["always"], + parser: "babel-eslint", + ecmaFeatures: { + destructuring: true + }, + errors: [ + { + message: "A space is required after '{'", + type: "ObjectPattern", + line: 1, + column: 14 + }, + { + message: "A space is required before '}'", + type: "ObjectPattern", + line: 1, + column: 17 + } + ] + }, + + // never - destructuring typed object param + { + code: "function fn({ a,b }: Object){}", + output: "function fn({a,b}: Object){}", + options: ["never"], + parser: "babel-eslint", + ecmaFeatures: { + destructuring: true + }, + errors: [ + { + message: "There should be no space after '{'", + type: "ObjectPattern", + line: 1, + column: 14 + }, + { + message: "There should be no space before '}'", + type: "ObjectPattern", + line: 1, + column: 19 + } + ] } ] }); From d58dc7bd1d055ee0a47686697c3f3c9c26b226af Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Sun, 20 Dec 2015 19:45:01 -0500 Subject: [PATCH 497/569] Merge pull request babel/eslint-plugin-babel#41 from zaygraveyard/issue35 Fix: array-bracket-spacing for destructuring typed parameter (fixes babel/eslint-plugin-babel#35) --- eslint/babel-eslint-plugin/README.md | 2 + eslint/babel-eslint-plugin/index.js | 2 + .../rules/array-bracket-spacing.js | 222 ++++++ .../tests/array-bracket-spacing.js | 733 ++++++++++++++++++ 4 files changed, 959 insertions(+) create mode 100644 eslint/babel-eslint-plugin/rules/array-bracket-spacing.js create mode 100644 eslint/babel-eslint-plugin/tests/array-bracket-spacing.js diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md index d0b799a5852f..19cbf5389921 100644 --- a/eslint/babel-eslint-plugin/README.md +++ b/eslint/babel-eslint-plugin/README.md @@ -26,6 +26,7 @@ original ones as well!). "rules": { "babel/generator-star-spacing": 1, "babel/new-cap": 1, + "babel/array-bracket-spacing": 1, "babel/object-curly-spacing": 1, "babel/object-shorthand": 1, "babel/arrow-parens": 1, @@ -39,6 +40,7 @@ Each rule corresponds to a core `eslint` rule, and has the same options. - `babel/generator-star-spacing`: Handles async/await functions correctly - `babel/new-cap`: Ignores capitalized decorators (`@Decorator`) +- `babel/array-bracket-spacing`: Handles destructuring arrays with flow type in function parametres - `babel/object-curly-spacing`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` - `babel/object-shorthand`: doesn't fail when using object spread (`...obj`) - `babel/arrow-parens`: Handles async functions correctly diff --git a/eslint/babel-eslint-plugin/index.js b/eslint/babel-eslint-plugin/index.js index 9bb58310c19d..43c631615e16 100644 --- a/eslint/babel-eslint-plugin/index.js +++ b/eslint/babel-eslint-plugin/index.js @@ -5,6 +5,7 @@ module.exports = { 'generator-star-spacing': require('./rules/generator-star-spacing'), 'new-cap': require('./rules/new-cap'), 'object-curly-spacing': require('./rules/object-curly-spacing'), + 'array-bracket-spacing': require('./rules/array-bracket-spacing'), 'object-shorthand': require('./rules/object-shorthand'), 'arrow-parens': require('./rules/arrow-parens'), 'no-await-in-loop': require('./rules/no-await-in-loop'), @@ -13,6 +14,7 @@ module.exports = { 'generator-star-spacing': 0, 'new-cap': 0, 'object-curly-spacing': 0, + 'array-bracket-spacing': 0, 'object-shorthand': 0, 'arrow-parens': 0, 'no-await-in-loop': 0, diff --git a/eslint/babel-eslint-plugin/rules/array-bracket-spacing.js b/eslint/babel-eslint-plugin/rules/array-bracket-spacing.js new file mode 100644 index 000000000000..b67fbe92fbce --- /dev/null +++ b/eslint/babel-eslint-plugin/rules/array-bracket-spacing.js @@ -0,0 +1,222 @@ +/** + * @fileoverview Disallows or enforces spaces inside of array brackets. + * @author Jamund Ferguson + * @copyright 2015 Jamund Ferguson. All rights reserved. + * @copyright 2014 Brandyn Bennett. All rights reserved. + * @copyright 2014 Michael Ficarra. No rights reserved. + * @copyright 2014 Vignesh Anand. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + var spaced = context.options[0] === "always", + sourceCode = context.getSourceCode(); + + /** + * Determines whether an option is set, relative to the spacing option. + * If spaced is "always", then check whether option is set to false. + * If spaced is "never", then check whether option is set to true. + * @param {Object} option - The option to exclude. + * @returns {boolean} Whether or not the property is excluded. + */ + function isOptionSet(option) { + return context.options[1] ? context.options[1][option] === !spaced : false; + } + + var options = { + spaced: spaced, + singleElementException: isOptionSet("singleValue"), + objectsInArraysException: isOptionSet("objectsInArrays"), + arraysInArraysException: isOptionSet("arraysInArrays") + }; + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Determines whether two adjacent tokens are on the same line. + * @param {Object} left - The left token object. + * @param {Object} right - The right token object. + * @returns {boolean} Whether or not the tokens are on the same line. + */ + function isSameLine(left, right) { + return left.loc.start.line === right.loc.start.line; + } + + /** + * Reports that there shouldn't be a space after the first token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ + function reportNoBeginningSpace(node, token) { + context.report({ + node: node, + loc: token.loc.start, + message: "There should be no space after '" + token.value + "'", + fix: function(fixer) { + var nextToken = sourceCode.getTokenAfter(token); + return fixer.removeRange([token.range[1], nextToken.range[0]]); + } + }); + } + + /** + * Reports that there shouldn't be a space before the last token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ + function reportNoEndingSpace(node, token) { + context.report({ + node: node, + loc: token.loc.start, + message: "There should be no space before '" + token.value + "'", + fix: function(fixer) { + var previousToken = sourceCode.getTokenBefore(token); + return fixer.removeRange([previousToken.range[1], token.range[0]]); + } + }); + } + + /** + * Reports that there should be a space after the first token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ + function reportRequiredBeginningSpace(node, token) { + context.report({ + node: node, + loc: token.loc.start, + message: "A space is required after '" + token.value + "'", + fix: function(fixer) { + return fixer.insertTextAfter(token, " "); + } + }); + } + + /** + * Reports that there should be a space before the last token + * @param {ASTNode} node - The node to report in the event of an error. + * @param {Token} token - The token to use for the report. + * @returns {void} + */ + function reportRequiredEndingSpace(node, token) { + context.report({ + node: node, + loc: token.loc.start, + message: "A space is required before '" + token.value + "'", + fix: function(fixer) { + return fixer.insertTextBefore(token, " "); + } + }); + } + + /** + * Determines if a node is an object type + * @param {ASTNode} node - The node to check. + * @returns {boolean} Whether or not the node is an object type. + */ + function isObjectType(node) { + return node && (node.type === "ObjectExpression" || node.type === "ObjectPattern"); + } + + /** + * Determines if a node is an array type + * @param {ASTNode} node - The node to check. + * @returns {boolean} Whether or not the node is an array type. + */ + function isArrayType(node) { + return node && (node.type === "ArrayExpression" || node.type === "ArrayPattern"); + } + + /** + * Validates the spacing around array brackets + * @param {ASTNode} node - The node we're checking for spacing + * @returns {void} + */ + function validateArraySpacing(node) { + if (options.spaced && node.elements.length === 0) { + return; + } + + var first = sourceCode.getFirstToken(node), + second = sourceCode.getFirstToken(node, 1), + last = sourceCode.getLastToken(node), + firstElement = node.elements[0], + lastElement = node.elements[node.elements.length - 1]; + + while (last.type !== "Punctuation" && last.value !== "]") { + last = sourceCode.getTokenBefore(last); + } + + var penultimate = sourceCode.getTokenBefore(last); + + var openingBracketMustBeSpaced = + options.objectsInArraysException && isObjectType(firstElement) || + options.arraysInArraysException && isArrayType(firstElement) || + options.singleElementException && node.elements.length === 1 + ? !options.spaced : options.spaced; + + var closingBracketMustBeSpaced = + options.objectsInArraysException && isObjectType(lastElement) || + options.arraysInArraysException && isArrayType(lastElement) || + options.singleElementException && node.elements.length === 1 + ? !options.spaced : options.spaced; + + if (isSameLine(first, second)) { + if (openingBracketMustBeSpaced && !sourceCode.isSpaceBetweenTokens(first, second)) { + reportRequiredBeginningSpace(node, first); + } + if (!openingBracketMustBeSpaced && sourceCode.isSpaceBetweenTokens(first, second)) { + reportNoBeginningSpace(node, first); + } + } + + if (first !== penultimate && isSameLine(penultimate, last)) { + if (closingBracketMustBeSpaced && !sourceCode.isSpaceBetweenTokens(penultimate, last)) { + reportRequiredEndingSpace(node, last); + } + if (!closingBracketMustBeSpaced && sourceCode.isSpaceBetweenTokens(penultimate, last)) { + reportNoEndingSpace(node, last); + } + } + } + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + return { + ArrayPattern: validateArraySpacing, + ArrayExpression: validateArraySpacing + }; + +}; + +module.exports.schema = [ + { + "enum": ["always", "never"] + }, + { + "type": "object", + "properties": { + "singleValue": { + "type": "boolean" + }, + "objectsInArrays": { + "type": "boolean" + }, + "arraysInArrays": { + "type": "boolean" + } + }, + "additionalProperties": false + } +]; diff --git a/eslint/babel-eslint-plugin/tests/array-bracket-spacing.js b/eslint/babel-eslint-plugin/tests/array-bracket-spacing.js new file mode 100644 index 000000000000..e4d743d2542a --- /dev/null +++ b/eslint/babel-eslint-plugin/tests/array-bracket-spacing.js @@ -0,0 +1,733 @@ +/** + * @fileoverview Disallows or enforces spaces inside of brackets. + * @author Ian Christian Myers + * @copyright 2014 Vignesh Anand. All rights reserved. + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var rule = require('../rules/array-bracket-spacing'), + RuleTester = require('eslint').RuleTester; + +//------------------------------------------------------------------------------ +// Tests +//------------------------------------------------------------------------------ + +var ruleTester = new RuleTester(); +ruleTester.run("array-bracket-spacing", rule, { + + valid: [ + { code: "var foo = obj[ 1 ]", options: ["always"] }, + { code: "var foo = obj[ 'foo' ];", options: ["always"] }, + { code: "var foo = obj[ [ 1, 1 ] ];", options: ["always"] }, + + // always - singleValue + { code: "var foo = ['foo']", options: ["always", {singleValue: false}] }, + { code: "var foo = [2]", options: ["always", {singleValue: false}] }, + { code: "var foo = [[ 1, 1 ]]", options: ["always", {singleValue: false}] }, + { code: "var foo = [{ 'foo': 'bar' }]", options: ["always", {singleValue: false}] }, + { code: "var foo = [bar]", options: ["always", {singleValue: false}] }, + + // always - objectsInArrays + { code: "var foo = [{ 'bar': 'baz' }, 1, 5 ];", options: ["always", {objectsInArrays: false}] }, + { code: "var foo = [ 1, 5, { 'bar': 'baz' }];", options: ["always", {objectsInArrays: false}] }, + { code: "var foo = [{\n'bar': 'baz', \n'qux': [{ 'bar': 'baz' }], \n'quxx': 1 \n}]", options: ["always", {objectsInArrays: false}] }, + { code: "var foo = [{ 'bar': 'baz' }]", options: ["always", {objectsInArrays: false}] }, + { code: "var foo = [{ 'bar': 'baz' }, 1, { 'bar': 'baz' }];", options: ["always", {objectsInArrays: false}] }, + { code: "var foo = [ 1, { 'bar': 'baz' }, 5 ];", options: ["always", {objectsInArrays: false}] }, + { code: "var foo = [ 1, { 'bar': 'baz' }, [{ 'bar': 'baz' }] ];", options: ["always", {objectsInArrays: false}] }, + { code: "var foo = [ function(){} ];", options: ["always", {objectsInArrays: false}] }, + + // always - arraysInArrays + { code: "var arr = [[ 1, 2 ], 2, 3, 4 ];", options: ["always", {"arraysInArrays": false}] }, + { code: "var arr = [[ 1, 2 ], [[[ 1 ]]], 3, 4 ];", options: ["always", {"arraysInArrays": false}] }, + { code: "var foo = [ arr[i], arr[j] ];", options: ["always", {"arraysInArrays": false}] }, + + // always - arraysInArrays, objectsInArrays + { code: "var arr = [[ 1, 2 ], 2, 3, { 'foo': 'bar' }];", options: ["always", {"arraysInArrays": false, objectsInArrays: false}] }, + + // always - arraysInArrays, objectsInArrays, singleValue + { code: "var arr = [[ 1, 2 ], [2], 3, { 'foo': 'bar' }];", options: ["always", {"arraysInArrays": false, objectsInArrays: false, singleValue: false}] }, + + // always + { code: "obj[ foo ]", options: ["always"] }, + { code: "obj[\nfoo\n]", options: ["always"] }, + { code: "obj[ 'foo' ]", options: ["always"] }, + { code: "obj[ 'foo' + 'bar' ]", options: ["always"] }, + { code: "obj[ obj2[ foo ] ]", options: ["always"] }, + { code: "obj.map(function(item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["always"] }, + { code: "obj[ 'map' ](function(item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["always"] }, + { code: "obj[ 'for' + 'Each' ](function(item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["always"] }, + + { code: "var arr = [ 1, 2, 3, 4 ];", options: ["always"] }, + { code: "var arr = [ [ 1, 2 ], 2, 3, 4 ];", options: ["always"] }, + { code: "var arr = [\n1, 2, 3, 4\n];", options: ["always"] }, + { code: "var foo = [];", options: ["always"] }, + + // singleValue: false, objectsInArrays: true, arraysInArrays + { code: "this.db.mappings.insert([\n { alias: 'a', url: 'http://www.amazon.de' },\n { alias: 'g', url: 'http://www.google.de' }\n], function() {});", options: ["always", {singleValue: false, objectsInArrays: true, arraysInArrays: true}] }, + + // always - destructuring assignment + { code: "var [ x, y ] = z", ecmaFeatures: { destructuring: true }, options: ["always"] }, + { code: "var [ x,y ] = z", ecmaFeatures: { destructuring: true }, options: ["always"] }, + { code: "var [ x, y\n] = z", ecmaFeatures: { destructuring: true }, options: ["always"] }, + { code: "var [\nx, y ] = z", ecmaFeatures: { destructuring: true }, options: ["always"] }, + { code: "var [\nx, y\n] = z", ecmaFeatures: { destructuring: true }, options: ["always"] }, + { code: "var [\nx, y\n] = z", ecmaFeatures: { destructuring: true }, options: ["always"] }, + { code: "var [\nx,,,\n] = z", ecmaFeatures: { destructuring: true }, options: ["always"] }, + { code: "var [ ,x, ] = z", ecmaFeatures: { destructuring: true }, options: ["always"] }, + { code: "var [\nx, ...y\n] = z", ecmaFeatures: { destructuring: true, spread:true }, options: ["always"] }, + { code: "var [\nx, ...y ] = z", ecmaFeatures: { destructuring: true, spread:true }, options: ["always"] }, + { code: "var [[ x, y ], z ] = arr;", ecmaFeatures: { destructuring: true }, options: ["always", {"arraysInArrays": false}] }, + { code: "var [ x, [ y, z ]] = arr;", ecmaFeatures: { destructuring: true }, options: ["always", {"arraysInArrays": false}] }, + { code: "[{ x, y }, z ] = arr;", ecmaFeatures: { destructuring: true }, options: ["always", {objectsInArrays: false}] }, + { code: "[ x, { y, z }] = arr;", ecmaFeatures: { destructuring: true }, options: ["always", {objectsInArrays: false}] }, + + // never + { code: "obj[foo]", options: ["never"] }, + { code: "obj['foo']", options: ["never"] }, + { code: "obj['foo' + 'bar']", options: ["never"] }, + { code: "obj['foo'+'bar']", options: ["never"] }, + { code: "obj[obj2[foo]]", options: ["never"] }, + { code: "obj.map(function(item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["never"] }, + { code: "obj['map'](function(item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["never"] }, + { code: "obj['for' + 'Each'](function(item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["never"] }, + { code: "obj['for' + 'Each'](function(item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["never"] }, + { code: "var arr = [1, 2, 3, 4];", options: ["never"] }, + { code: "var arr = [[1, 2], 2, 3, 4];", options: ["never"] }, + { code: "var arr = [\n1, 2, 3, 4\n];", options: ["never"] }, + { code: "obj[\nfoo]", options: ["never"] }, + { code: "obj[foo\n]", options: ["never"] }, + { code: "var arr = [1,\n2,\n3,\n4\n];", options: ["never"] }, + { code: "var arr = [\n1,\n2,\n3,\n4];", options: ["never"] }, + + // never - destructuring assignment + { code: "var [x, y] = z", ecmaFeatures: { destructuring: true }, options: ["never"] }, + { code: "var [x,y] = z", ecmaFeatures: { destructuring: true }, options: ["never"] }, + { code: "var [x, y\n] = z", ecmaFeatures: { destructuring: true }, options: ["never"] }, + { code: "var [\nx, y] = z", ecmaFeatures: { destructuring: true }, options: ["never"] }, + { code: "var [\nx, y\n] = z", ecmaFeatures: { destructuring: true }, options: ["never"] }, + { code: "var [\nx, y\n] = z", ecmaFeatures: { destructuring: true }, options: ["never"] }, + { code: "var [\nx,,,\n] = z", ecmaFeatures: { destructuring: true }, options: ["never"] }, + { code: "var [,x,] = z", ecmaFeatures: { destructuring: true }, options: ["never"] }, + { code: "var [\nx, ...y\n] = z", ecmaFeatures: { destructuring: true, spread:true }, options: ["never"] }, + { code: "var [\nx, ...y] = z", ecmaFeatures: { destructuring: true, spread:true }, options: ["never"] }, + { code: "var [ [x, y], z] = arr;", ecmaFeatures: { destructuring: true }, options: ["never", {"arraysInArrays": true}] }, + { code: "var [x, [y, z] ] = arr;", ecmaFeatures: { destructuring: true }, options: ["never", {"arraysInArrays": true}] }, + { code: "[ { x, y }, z] = arr;", ecmaFeatures: { destructuring: true }, options: ["never", {objectsInArrays: true}] }, + { code: "[x, { y, z } ] = arr;", ecmaFeatures: { destructuring: true }, options: ["never", {objectsInArrays: true}] }, + + // never - singleValue + { code: "var foo = [ 'foo' ]", options: ["never", {singleValue: true}] }, + { code: "var foo = [ 2 ]", options: ["never", {singleValue: true}] }, + { code: "var foo = [ [1, 1] ]", options: ["never", {singleValue: true}] }, + { code: "var foo = [ {'foo': 'bar'} ]", options: ["never", {singleValue: true}] }, + { code: "var foo = [ bar ]", options: ["never", {singleValue: true}] }, + + // never - objectsInArrays + { code: "var foo = [ {'bar': 'baz'}, 1, 5];", options: ["never", {objectsInArrays: true}] }, + { code: "var foo = [1, 5, {'bar': 'baz'} ];", options: ["never", {objectsInArrays: true}] }, + { code: "var foo = [ {\n'bar': 'baz', \n'qux': [ {'bar': 'baz'} ], \n'quxx': 1 \n} ]", options: ["never", {objectsInArrays: true}] }, + { code: "var foo = [ {'bar': 'baz'} ]", options: ["never", {objectsInArrays: true}] }, + { code: "var foo = [ {'bar': 'baz'}, 1, {'bar': 'baz'} ];", options: ["never", {objectsInArrays: true}] }, + { code: "var foo = [1, {'bar': 'baz'} , 5];", options: ["never", {objectsInArrays: true}] }, + { code: "var foo = [1, {'bar': 'baz'}, [ {'bar': 'baz'} ]];", options: ["never", {objectsInArrays: true}] }, + { code: "var foo = [function(){}];", options: ["never", {objectsInArrays: true}] }, + { code: "var foo = [];", options: ["never", {objectsInArrays: true}] }, + + // never - arraysInArrays + { code: "var arr = [ [1, 2], 2, 3, 4];", options: ["never", {"arraysInArrays": true}] }, + { code: "var foo = [arr[i], arr[j]];", options: ["never", {"arraysInArrays": true}] }, + { code: "var foo = [];", options: ["never", {"arraysInArrays": true}] }, + + // never - arraysInArrays, singleValue + { code: "var arr = [ [1, 2], [ [ [ 1 ] ] ], 3, 4];", options: ["never", {"arraysInArrays": true, singleValue: true}] }, + + // never - arraysInArrays, objectsInArrays + { code: "var arr = [ [1, 2], 2, 3, {'foo': 'bar'} ];", options: ["never", {"arraysInArrays": true, objectsInArrays: true}] }, + + // should not warn + { code: "var foo = {};", options: ["never"] }, + { code: "var foo = [];", options: ["never"] }, + + { code: "var foo = [{'bar':'baz'}, 1, {'bar': 'baz'}];", options: ["never"] }, + { code: "var foo = [{'bar': 'baz'}];", options: ["never"] }, + { code: "var foo = [{\n'bar': 'baz', \n'qux': [{'bar': 'baz'}], \n'quxx': 1 \n}]", options: ["never"] }, + { code: "var foo = [1, {'bar': 'baz'}, 5];", options: ["never"] }, + { code: "var foo = [{'bar': 'baz'}, 1, 5];", options: ["never"] }, + { code: "var foo = [1, 5, {'bar': 'baz'}];", options: ["never"] }, + { code: "var obj = {'foo': [1, 2]}", options: ["never"] }, + + // Babel test cases. + // always - destructuring typed array param + { code: "function fn([ a,b ]: Array){}", options: ["always"], parser: "babel-eslint", ecmaFeatures: { destructuring: true } }, + + // never - destructuring typed array param + { code: "function fn([a,b]: Array){}", options: ["never"], parser: "babel-eslint", ecmaFeatures: { destructuring: true } }, + + ], + + invalid: [ + { + code: "var foo = [ ]", + output: "var foo = []", + options: ["never"], + errors: [ + { + message: "There should be no space after '['", + type: "ArrayExpression", + line: 1, + column: 11 + } + ] + }, + // objectsInArrays + { + code: "var foo = [ { 'bar': 'baz' }, 1, 5];", + output: "var foo = [{ 'bar': 'baz' }, 1, 5 ];", + options: ["always", {objectsInArrays: false}], + errors: [ + { + message: "There should be no space after '['", + type: "ArrayExpression", + line: 1, + column: 11 + }, + { + message: "A space is required before ']'", + type: "ArrayExpression", + line: 1, + column: 36 + } + ] + }, + { + code: "var foo = [1, 5, { 'bar': 'baz' } ];", + output: "var foo = [ 1, 5, { 'bar': 'baz' }];", + options: ["always", {objectsInArrays: false}], + errors: [ + { + message: "A space is required after '['", + type: "ArrayExpression", + line: 1, + column: 11 + }, + { + message: "There should be no space before ']'", + type: "ArrayExpression", + line: 1, + column: 35 + } + ] + }, + { + code: "var foo = [ { 'bar':'baz' }, 1, { 'bar': 'baz' } ];", + output: "var foo = [{ 'bar':'baz' }, 1, { 'bar': 'baz' }];", + options: ["always", {objectsInArrays: false}], + errors: [ + { + message: "There should be no space after '['", + type: "ArrayExpression", + line: 1, + column: 11 + }, + { + message: "There should be no space before ']'", + type: "ArrayExpression", + line: 1, + column: 50 + } + ] + }, + + // singleValue + { + code: "var obj = [ 'foo' ];", + output: "var obj = ['foo'];", + options: ["always", {singleValue: false}], + errors: [ + { + message: "There should be no space after '['", + type: "ArrayExpression", + line: 1, + column: 11 + }, + { + message: "There should be no space before ']'", + type: "ArrayExpression", + line: 1, + column: 19 + } + ] + }, + { + code: "var obj = ['foo' ];", + output: "var obj = ['foo'];", + options: ["always", {singleValue: false}], + errors: [ + { + message: "There should be no space before ']'", + type: "ArrayExpression", + line: 1, + column: 18 + } + ] + }, + { + code: "var obj = ['foo'];", + output: "var obj = [ 'foo' ];", + options: ["never", {singleValue: true}], + errors: [ + { + message: "A space is required after '['", + type: "ArrayExpression", + line: 1, + column: 11 + }, + { + message: "A space is required before ']'", + type: "ArrayExpression", + line: 1, + column: 17 + } + ] + }, + + // always - arraysInArrays + { + code: "var arr = [ [ 1, 2 ], 2, 3, 4 ];", + output: "var arr = [[ 1, 2 ], 2, 3, 4 ];", + options: ["always", {"arraysInArrays": false}], + errors: [ + { + message: "There should be no space after '['", + type: "ArrayExpression", + line: 1, + column: 11 + } + ] + }, + { + code: "var arr = [ 1, 2, 2, [ 3, 4 ] ];", + output: "var arr = [ 1, 2, 2, [ 3, 4 ]];", + options: ["always", {"arraysInArrays": false}], + errors: [ + { + message: "There should be no space before ']'", + type: "ArrayExpression", + line: 1, + column: 31 + } + ] + }, + { + code: "var arr = [[ 1, 2 ], 2, [ 3, 4 ] ];", + output: "var arr = [[ 1, 2 ], 2, [ 3, 4 ]];", + options: ["always", {"arraysInArrays": false}], + errors: [ + { + message: "There should be no space before ']'", + type: "ArrayExpression", + line: 1, + column: 34 + } + ] + }, + { + code: "var arr = [ [ 1, 2 ], 2, [ 3, 4 ]];", + output: "var arr = [[ 1, 2 ], 2, [ 3, 4 ]];", + options: ["always", {"arraysInArrays": false}], + errors: [ + { + message: "There should be no space after '['", + type: "ArrayExpression", + line: 1, + column: 11 + } + ] + }, + { + code: "var arr = [ [ 1, 2 ], 2, [ 3, 4 ] ];", + output: "var arr = [[ 1, 2 ], 2, [ 3, 4 ]];", + options: ["always", {"arraysInArrays": false}], + errors: [ + { + message: "There should be no space after '['", + type: "ArrayExpression", + line: 1, + column: 11 + }, + { + message: "There should be no space before ']'", + type: "ArrayExpression", + line: 1, + column: 35 + } + ] + }, + + // always - destructuring + { + code: "var [x,y] = y", + output: "var [ x,y ] = y", + options: ["always"], + ecmaFeatures: { destructuring: true }, + errors: [{ + message: "A space is required after '['", + type: "ArrayPattern", + line: 1, + column: 5 + }, + { + message: "A space is required before ']'", + type: "ArrayPattern", + line: 1, + column: 9 + }] + }, + { + code: "var [x,y ] = y", + output: "var [ x,y ] = y", + options: ["always"], + ecmaFeatures: { destructuring: true }, + errors: [{ + message: "A space is required after '['", + type: "ArrayPattern", + line: 1, + column: 5 + }] + }, + { + code: "var [,,,x,,] = y", + output: "var [ ,,,x,, ] = y", + options: ["always"], + ecmaFeatures: { destructuring: true }, + errors: [{ + message: "A space is required after '['", + type: "ArrayPattern", + line: 1, + column: 5 + }, + { + message: "A space is required before ']'", + type: "ArrayPattern", + line: 1, + column: 12 + }] + }, + { + code: "var [ ,,,x,,] = y", + output: "var [ ,,,x,, ] = y", + options: ["always"], + ecmaFeatures: { destructuring: true }, + errors: [{ + message: "A space is required before ']'", + type: "ArrayPattern", + line: 1, + column: 13 + }] + }, + { + code: "var [...horse] = y", + output: "var [ ...horse ] = y", + options: ["always"], + ecmaFeatures: { destructuring: true, spread:true }, + errors: [{ + message: "A space is required after '['", + type: "ArrayPattern", + line: 1, + column: 5 + }, + { + message: "A space is required before ']'", + type: "ArrayPattern", + line: 1, + column: 14 + }] + }, + { + code: "var [...horse ] = y", + output: "var [ ...horse ] = y", + options: ["always"], + ecmaFeatures: { destructuring: true, spread:true }, + errors: [{ + message: "A space is required after '['", + type: "ArrayPattern", + line: 1, + column: 5 + }] + }, + { + code: "var [ [ x, y ], z ] = arr;", + output: "var [[ x, y ], z ] = arr;", + options: ["always", {"arraysInArrays": false}], + ecmaFeatures: { destructuring: true }, + errors: [{ + message: "There should be no space after '['", + type: "ArrayPattern", + line: 1, + column: 5 + }] + }, + { + code: "[ { x, y }, z ] = arr;", + output: "[{ x, y }, z ] = arr;", + options: ["always", {"objectsInArrays": false}], + ecmaFeatures: { destructuring: true }, + errors: [{ + message: "There should be no space after '['", + type: "ArrayPattern", + line: 1, + column: 1 + }] + }, + { + code: "[ x, { y, z } ] = arr;", + output: "[ x, { y, z }] = arr;", + options: ["always", {"objectsInArrays": false}], + ecmaFeatures: { destructuring: true }, + errors: [{ + message: "There should be no space before ']'", + type: "ArrayPattern", + line: 1, + column: 15 + }] + }, + + // never - arraysInArrays + { + code: "var arr = [[1, 2], 2, [3, 4]];", + output: "var arr = [ [1, 2], 2, [3, 4] ];", + options: ["never", {"arraysInArrays": true}], + errors: [ + { + message: "A space is required after '['", + type: "ArrayExpression", + line: 1, + column: 11 + }, + { + message: "A space is required before ']'", + type: "ArrayExpression", + line: 1, + column: 29 + } + ] + }, + { + code: "var arr = [ ];", + output: "var arr = [];", + options: ["never", {"arraysInArrays": true}], + errors: [ + { + message: "There should be no space after '['", + type: "ArrayExpression", + line: 1, + column: 11 + } + ] + }, + + // never - objectsInArrays + { + code: "var arr = [ ];", + output: "var arr = [];", + options: ["never", {"objectsInArrays": true}], + errors: [ + { + message: "There should be no space after '['", + type: "ArrayExpression", + line: 1, + column: 11 + } + ] + }, + + // always + { + code: "var arr = [1, 2, 3, 4];", + output: "var arr = [ 1, 2, 3, 4 ];", + options: ["always"], + errors: [ + { + message: "A space is required after '['", + type: "ArrayExpression", + line: 1, + column: 11 + }, + { + message: "A space is required before ']'", + type: "ArrayExpression", + line: 1, + column: 22 + } + ] + }, + { + code: "var arr = [1, 2, 3, 4 ];", + output: "var arr = [ 1, 2, 3, 4 ];", + options: ["always"], + errors: [ + { + message: "A space is required after '['", + type: "ArrayExpression", + line: 1, + column: 11 + } + ] + }, + { + code: "var arr = [ 1, 2, 3, 4];", + output: "var arr = [ 1, 2, 3, 4 ];", + options: ["always"], + errors: [ + { + message: "A space is required before ']'", + type: "ArrayExpression", + line: 1, + column: 23 + } + ] + }, + + // never + { + code: "var arr = [ 1, 2, 3, 4 ];", + output: "var arr = [1, 2, 3, 4];", + options: ["never"], + errors: [ + { + message: "There should be no space after '['", + type: "ArrayExpression", + line: 1, + column: 11 + }, + { + message: "There should be no space before ']'", + type: "ArrayExpression", + line: 1, + column: 24 + } + ] + }, + { + code: "var arr = [1, 2, 3, 4 ];", + output: "var arr = [1, 2, 3, 4];", + options: ["never"], + errors: [ + { + message: "There should be no space before ']'", + type: "ArrayExpression", + line: 1, + column: 23 + } + ] + }, + { + code: "var arr = [ 1, 2, 3, 4];", + output: "var arr = [1, 2, 3, 4];", + options: ["never"], + errors: [ + { + message: "There should be no space after '['", + type: "ArrayExpression", + line: 1, + column: 11 + } + ] + }, + { + code: "var arr = [ [ 1], 2, 3, 4];", + output: "var arr = [[1], 2, 3, 4];", + options: ["never"], + errors: [ + { + message: "There should be no space after '['", + type: "ArrayExpression", + line: 1, + column: 11 + }, + { + message: "There should be no space after '['", + type: "ArrayExpression", + line: 1, + column: 13 + } + ] + }, + { + code: "var arr = [[1 ], 2, 3, 4 ];", + output: "var arr = [[1], 2, 3, 4];", + options: ["never"], + errors: [ + { + message: "There should be no space before ']'", + type: "ArrayExpression", + line: 1, + column: 15 + }, + { + message: "There should be no space before ']'", + type: "ArrayExpression", + line: 1, + column: 26 + } + ] + }, + + // Babel test cases. + + // always - destructuring typed array param + { + code: "function fn([a,b]: Array){}", + output: "function fn([ a,b ]: Array){}", + options: ["always"], + parser: "babel-eslint", + ecmaFeatures: { + destructuring: true + }, + errors: [ + { + message: "A space is required after '['", + type: "ArrayPattern", + line: 1, + column: 13 + }, + { + message: "A space is required before ']'", + type: "ArrayPattern", + line: 1, + column: 17 + } + ] + }, + + // never - destructuring typed array param + { + code: "function fn([ a,b ]: Array){}", + output: "function fn([a,b]: Array){}", + options: ["never"], + parser: "babel-eslint", + ecmaFeatures: { + destructuring: true + }, + errors: [ + { + message: "There should be no space after '['", + type: "ArrayPattern", + line: 1, + column: 13 + }, + { + message: "There should be no space before ']'", + type: "ArrayPattern", + line: 1, + column: 19 + } + ] + } + ] +}); From 7a2ecd251685d7e5ce24416acae4b350f9146d2b Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Thu, 21 Jan 2016 20:20:23 -0500 Subject: [PATCH 498/569] Merge pull request babel/eslint-plugin-babel#44 from ssorallen/arrow-type-annotations Add type annotations to arrow-parens "as-needed" --- eslint/babel-eslint-plugin/rules/arrow-parens.js | 6 ++++-- eslint/babel-eslint-plugin/tests/arrow-parens.js | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/eslint/babel-eslint-plugin/rules/arrow-parens.js b/eslint/babel-eslint-plugin/rules/arrow-parens.js index b3ee3a765262..8e7c9456be51 100644 --- a/eslint/babel-eslint-plugin/rules/arrow-parens.js +++ b/eslint/babel-eslint-plugin/rules/arrow-parens.js @@ -24,7 +24,9 @@ module.exports = function(context) { if (node.async) token = context.getTokenAfter(token); // as-needed: x => x - if (asNeeded && node.params.length === 1 && node.params[0].type === "Identifier") { + if (asNeeded && node.params.length === 1 + && node.params[0].type === "Identifier" + && node.params[0].typeAnnotation === undefined) { if (token.type === "Punctuator" && token.value === "(") { context.report(node, asNeededMessage); } @@ -50,4 +52,4 @@ module.exports.schema = [ { "enum": ["always", "as-needed"] } -]; \ No newline at end of file +]; diff --git a/eslint/babel-eslint-plugin/tests/arrow-parens.js b/eslint/babel-eslint-plugin/tests/arrow-parens.js index 74a03f62c564..3616fa7022ba 100644 --- a/eslint/babel-eslint-plugin/tests/arrow-parens.js +++ b/eslint/babel-eslint-plugin/tests/arrow-parens.js @@ -46,6 +46,7 @@ var valid = [ { code: "(a = 10) => {}", options: ["as-needed"], ecmaFeatures: { arrowFunctions: true, destructuring: true, defaultParams: true } }, { code: "(...a) => a[0]", options: ["as-needed"], ecmaFeatures: { arrowFunctions: true, restParams: true } }, { code: "(a, b) => {}", options: ["as-needed"], ecmaFeatures: { arrowFunctions: true } }, + ok("(a: string) => a", ["as-needed"]), // async ok("async () => {}"), @@ -174,4 +175,4 @@ var invalid = [ ruleTester.run("arrow-parens", rule, { valid: valid, invalid: invalid -}); \ No newline at end of file +}); From 7fa3aa9116c7d842615b8eb354cfcf5a5b43584b Mon Sep 17 00:00:00 2001 From: jquense Date: Wed, 3 Feb 2016 19:28:25 -0500 Subject: [PATCH 499/569] 3.1.0 --- eslint/babel-eslint-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index fdcbb5058d6e..5bccf2083f8a 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-babel", - "version": "3.0.0", + "version": "3.1.0", "description": "an eslint rule plugin companion to babel-eslint", "main": "index.js", "scripts": { From 6ac58744fe06ff61194689d7dd6a4653c6b93d55 Mon Sep 17 00:00:00 2001 From: jquense Date: Wed, 3 Feb 2016 19:30:16 -0500 Subject: [PATCH 500/569] update readme --- eslint/babel-eslint-plugin/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md index 19cbf5389921..29a817b31459 100644 --- a/eslint/babel-eslint-plugin/README.md +++ b/eslint/babel-eslint-plugin/README.md @@ -1,6 +1,8 @@ # eslint-plugin-babel -An `eslint` plugin companion to `babel-eslint`. `babel-eslint` does a great job at adapting `eslint` for use with Babel, but it can't change the built in rules to support experimental features. `eslint-plugin-babel` reimplements problematic rules so they do not give false positives or negatives. +An `eslint` plugin companion to `babel-eslint`. `babel-eslint` does a great job at adapting `eslint` +for use with Babel, but it can't change the built in rules to support experimental features. +`eslint-plugin-babel` re-implements problematic rules so they do not give false positives or negatives. ### Install @@ -40,7 +42,7 @@ Each rule corresponds to a core `eslint` rule, and has the same options. - `babel/generator-star-spacing`: Handles async/await functions correctly - `babel/new-cap`: Ignores capitalized decorators (`@Decorator`) -- `babel/array-bracket-spacing`: Handles destructuring arrays with flow type in function parametres +- `babel/array-bracket-spacing`: Handles destructuring arrays with flow type in function parameters - `babel/object-curly-spacing`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` - `babel/object-shorthand`: doesn't fail when using object spread (`...obj`) - `babel/arrow-parens`: Handles async functions correctly From 5363ff85ccbeadc3370dd2190d7a3d73da58abc2 Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Tue, 5 Apr 2016 16:19:28 -0400 Subject: [PATCH 501/569] Merge pull request babel/eslint-plugin-babel#56 from nmote/flow-object-type Add flow-object-type rule --- eslint/babel-eslint-plugin/index.js | 2 + .../rules/flow-object-type.js | 52 ++++++++++++++ .../tests/flow-object-type.js | 69 +++++++++++++++++++ 3 files changed, 123 insertions(+) create mode 100644 eslint/babel-eslint-plugin/rules/flow-object-type.js create mode 100644 eslint/babel-eslint-plugin/tests/flow-object-type.js diff --git a/eslint/babel-eslint-plugin/index.js b/eslint/babel-eslint-plugin/index.js index 43c631615e16..7a3f7f46172d 100644 --- a/eslint/babel-eslint-plugin/index.js +++ b/eslint/babel-eslint-plugin/index.js @@ -9,6 +9,7 @@ module.exports = { 'object-shorthand': require('./rules/object-shorthand'), 'arrow-parens': require('./rules/arrow-parens'), 'no-await-in-loop': require('./rules/no-await-in-loop'), + 'flow-object-type': require('./rules/flow-object-type'), }, rulesConfig: { 'generator-star-spacing': 0, @@ -18,5 +19,6 @@ module.exports = { 'object-shorthand': 0, 'arrow-parens': 0, 'no-await-in-loop': 0, + 'flow-object-type': 0, } }; diff --git a/eslint/babel-eslint-plugin/rules/flow-object-type.js b/eslint/babel-eslint-plugin/rules/flow-object-type.js new file mode 100644 index 000000000000..f452832d6bf4 --- /dev/null +++ b/eslint/babel-eslint-plugin/rules/flow-object-type.js @@ -0,0 +1,52 @@ +/** + * @fileoverview Enforces a choice between semicolons and commas in Flow object and class types. + * @author Nat Mote + */ +"use strict"; + +var SEMICOLON = { + char: ';', + name: 'semicolon', +} + +var COMMA = { + char: ',', + name: 'comma', +}; + +module.exports = function(context) { + var GOOD; + var BAD; + if (context.options[0] === undefined || context.options[0] === SEMICOLON.name) { + GOOD = SEMICOLON; + BAD = COMMA; + } else { + GOOD = COMMA; + BAD = SEMICOLON; + } + function requireProperPunctuation(node) { + var tokens = context.getSourceCode().getTokens(node); + var lastToken = tokens[tokens.length - 1]; + if (lastToken.type === 'Punctuator') { + if (lastToken.value === BAD.char) { + context.report({ + message: 'Prefer ' + GOOD.name + 's to ' + BAD.name + 's in object and class types', + node: lastToken, + fix: function(fixer) { + return fixer.replaceText(lastToken, GOOD.char); + }, + }); + } + } + } + + return { + ObjectTypeProperty: requireProperPunctuation, + }; +}; + +module.exports.schema = [ + { + 'enum': ['semicolon', 'comma'], + } +]; diff --git a/eslint/babel-eslint-plugin/tests/flow-object-type.js b/eslint/babel-eslint-plugin/tests/flow-object-type.js new file mode 100644 index 000000000000..f98c63266454 --- /dev/null +++ b/eslint/babel-eslint-plugin/tests/flow-object-type.js @@ -0,0 +1,69 @@ +/** + * @fileoverview Tests for flow-object-type. + * @author Nat Mote + */ + +"use strict"; + +var rule = require("../rules/flow-object-type"), + RuleTester = require('eslint').RuleTester; + +var features = { +}; + +function test(code, options, errors, output){ + var result = { + code: code, + parser: 'babel-eslint', + ecmaFeatures: features, + }; + if (options != null) { + result.options = options; + } + if (errors != null) { + result.errors = errors; + } + if (output != null) { + result.output = output; + } + return result; +} + +var commaMessage = 'Prefer commas to semicolons in object and class types'; +var semiMessage = 'Prefer semicolons to commas in object and class types'; + +function ok(code, commaOrSemi) { + return test(code, [commaOrSemi]); +} + +function err(code, commaOrSemi, errorMessage, output) { + return test(code, [commaOrSemi], [errorMessage], output); +} + +var cases = [ + ok('type Foo = { a: Foo; b: Bar }', 'semicolon'), + err('type Foo = { a: Foo, b: Bar }', 'semicolon', semiMessage, 'type Foo = { a: Foo; b: Bar }'), + + ok('type Foo = { a: Foo, b: Bar }', 'comma'), + err('type Foo = { a: Foo; b: Bar }', 'comma', commaMessage, 'type Foo = { a: Foo, b: Bar }'), + + ok('declare class Foo { a: Foo; }', 'semicolon'), + err('declare class Foo { a: Foo, }', 'semicolon', semiMessage, 'declare class Foo { a: Foo; }'), + + ok('declare class Foo { a: Foo, }', 'comma'), + err('declare class Foo { a: Foo; }', 'comma', commaMessage, 'declare class Foo { a: Foo, }'), +]; + +function hasError(testCase) { + return testCase.errors != null && testCase.errors.length > 0; +} + +function hasNoError(testCase) { + return !hasError(testCase); +} + +var ruleTester = new RuleTester(); +ruleTester.run('flow-object-type', rule, { + valid: cases.filter(hasNoError), + invalid: cases.filter(hasError), +}); From ba2b2bc04d50353eef0753904237407413be03cd Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 7 Apr 2016 18:24:59 -0400 Subject: [PATCH 502/569] Merge pull request babel/eslint-plugin-babel#57 from nmote/docs Add docs for flow-object-type rule --- eslint/babel-eslint-plugin/README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md index 29a817b31459..4fc00c0cdf70 100644 --- a/eslint/babel-eslint-plugin/README.md +++ b/eslint/babel-eslint-plugin/README.md @@ -32,7 +32,8 @@ original ones as well!). "babel/object-curly-spacing": 1, "babel/object-shorthand": 1, "babel/arrow-parens": 1, - "babel/no-await-in-loop": 1 + "babel/no-await-in-loop": 1, + "babel/flow-object-type": 1 } } ``` @@ -46,4 +47,11 @@ Each rule corresponds to a core `eslint` rule, and has the same options. - `babel/object-curly-spacing`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` - `babel/object-shorthand`: doesn't fail when using object spread (`...obj`) - `babel/arrow-parens`: Handles async functions correctly + +The following rules are not in `eslint`, but are relevant only to syntax that is not specified by +the current JavaScript standard or supported by `eslint`. + - `babel/no-await-in-loop`: guard against awaiting async functions inside of a loop +- `babel/flow-object-type`: Require a particular separator between properties in Flow object types. + - Use the option `semicolon` to require semicolons (e.g. `type Foo = { bar: number; baz: string }`). + - Use the option `comma` to require commas (e.g. `type Foo = { bar: number, baz: string }`). From 8487ec8a67d5b78c68b5bbbf3e2742ae4ae1595b Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 7 Apr 2016 18:25:57 -0400 Subject: [PATCH 503/569] 3.2.0 --- eslint/babel-eslint-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index 5bccf2083f8a..35d923259738 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-babel", - "version": "3.1.0", + "version": "3.2.0", "description": "an eslint rule plugin companion to babel-eslint", "main": "index.js", "scripts": { From f57dc5227ab45f271dad7b803c076428be1142da Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Wed, 1 Jun 2016 16:45:26 -0400 Subject: [PATCH 504/569] Merge pull request babel/eslint-plugin-babel#62 from lemonmade/fix-for-arrow-parens Add an automated fix for arrow-parens --- .../babel-eslint-plugin/rules/arrow-parens.js | 21 +++++++++++++++++-- .../babel-eslint-plugin/tests/arrow-parens.js | 17 +++++++++++---- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/eslint/babel-eslint-plugin/rules/arrow-parens.js b/eslint/babel-eslint-plugin/rules/arrow-parens.js index 8e7c9456be51..6ca3ffc776bf 100644 --- a/eslint/babel-eslint-plugin/rules/arrow-parens.js +++ b/eslint/babel-eslint-plugin/rules/arrow-parens.js @@ -28,7 +28,18 @@ module.exports = function(context) { && node.params[0].type === "Identifier" && node.params[0].typeAnnotation === undefined) { if (token.type === "Punctuator" && token.value === "(") { - context.report(node, asNeededMessage); + context.report({ + node: node, + message: asNeededMessage, + fix: function(fixer) { + var paramToken = context.getTokenAfter(token); + var closingParenToken = context.getTokenAfter(paramToken); + return fixer.replaceTextRange([ + token.range[0], + closingParenToken.range[1] + ], paramToken.value); + } + }); } return; } @@ -38,7 +49,13 @@ module.exports = function(context) { // (x) => x if (after.value !== ")") { - context.report(node, message); + context.report({ + node: node, + message: message, + fix: function(fixer) { + return fixer.replaceText(token, '(' + token.value + ')'); + } + }); } } } diff --git a/eslint/babel-eslint-plugin/tests/arrow-parens.js b/eslint/babel-eslint-plugin/tests/arrow-parens.js index 3616fa7022ba..f129f77f71b8 100644 --- a/eslint/babel-eslint-plugin/tests/arrow-parens.js +++ b/eslint/babel-eslint-plugin/tests/arrow-parens.js @@ -18,9 +18,10 @@ function ok(code, args){ return { code: code, options: args, parser: 'babel-eslint' } } -function err(code, errors, args){ +function err(code, output, errors, args){ var e = ok(code, args) e.errors = errors + e.output = output return e } @@ -74,6 +75,7 @@ var type = type; var invalid = [ { code: "a => {}", + output: "(a) => {}", ecmaFeatures: { arrowFunctions: true }, errors: [{ line: 1, @@ -84,6 +86,7 @@ var invalid = [ }, { code: "a => a", + output: "(a) => a", ecmaFeatures: { arrowFunctions: true }, errors: [{ line: 1, @@ -94,6 +97,7 @@ var invalid = [ }, { code: "a => {\n}", + output: "(a) => {\n}", ecmaFeatures: { arrowFunctions: true }, errors: [{ line: 1, @@ -104,6 +108,7 @@ var invalid = [ }, { code: "a.then(foo => {});", + output: "a.then((foo) => {});", ecmaFeatures: { arrowFunctions: true }, errors: [{ line: 1, @@ -114,6 +119,7 @@ var invalid = [ }, { code: "a.then(foo => a);", + output: "a.then((foo) => a);", ecmaFeatures: { arrowFunctions: true }, errors: [{ line: 1, @@ -124,6 +130,7 @@ var invalid = [ }, { code: "a(foo => { if (true) {}; });", + output: "a((foo) => { if (true) {}; });", ecmaFeatures: { arrowFunctions: true }, errors: [{ line: 1, @@ -136,6 +143,7 @@ var invalid = [ // as-needed { code: "(a) => a", + output: "a => a", options: ["as-needed"], ecmaFeatures: { arrowFunctions: true }, errors: [{ @@ -147,6 +155,7 @@ var invalid = [ }, { code: "(b) => b", + output: "b => b", options: ["as-needed"], ecmaFeatures: { arrowFunctions: true }, errors: [{ @@ -158,15 +167,15 @@ var invalid = [ }, // async - err('async a => {}', [ + err('async a => {}', 'async (a) => {}', [ { message: 'Expected parentheses around arrow function argument.' }, ]), - err('async a => a', [ + err('async a => a', 'async (a) => a', [ { message: 'Expected parentheses around arrow function argument.' }, ]), - err('async (a) => a', [ + err('async (a) => a', 'async a => a', [ { message: 'Unexpected parentheses around single function argument' }, ], ["as-needed"]) From 148e6be60f5d753b51b4cbc27b96d08ffe85bf76 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 1 Jun 2016 18:13:06 -0400 Subject: [PATCH 505/569] show which rules are fixable --- eslint/babel-eslint-plugin/README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md index 4fc00c0cdf70..48611f3cd376 100644 --- a/eslint/babel-eslint-plugin/README.md +++ b/eslint/babel-eslint-plugin/README.md @@ -41,17 +41,19 @@ original ones as well!). Each rule corresponds to a core `eslint` rule, and has the same options. +🛠 : means it's autofixable with `--fix`. + - `babel/generator-star-spacing`: Handles async/await functions correctly - `babel/new-cap`: Ignores capitalized decorators (`@Decorator`) -- `babel/array-bracket-spacing`: Handles destructuring arrays with flow type in function parameters -- `babel/object-curly-spacing`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` +- `babel/array-bracket-spacing`: Handles destructuring arrays with flow type in function parameters (🛠 ) +- `babel/object-curly-spacing`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` (🛠 ) - `babel/object-shorthand`: doesn't fail when using object spread (`...obj`) -- `babel/arrow-parens`: Handles async functions correctly +- `babel/arrow-parens`: Handles async functions correctly (🛠 ) The following rules are not in `eslint`, but are relevant only to syntax that is not specified by the current JavaScript standard or supported by `eslint`. - `babel/no-await-in-loop`: guard against awaiting async functions inside of a loop -- `babel/flow-object-type`: Require a particular separator between properties in Flow object types. +- `babel/flow-object-type`: Require a particular separator between properties in Flow object types. (🛠 ) - Use the option `semicolon` to require semicolons (e.g. `type Foo = { bar: number; baz: string }`). - Use the option `comma` to require commas (e.g. `type Foo = { bar: number, baz: string }`). From 8cd329f61189b714e97f1f887d8c67f3d9fbc739 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 21 Jun 2016 16:15:36 -0400 Subject: [PATCH 506/569] Merge pull request babel/eslint-plugin-babel#64 from zertosh/master Add func-params-comma-dangle rule --- eslint/babel-eslint-plugin/README.md | 4 +- eslint/babel-eslint-plugin/index.js | 2 + .../rules/func-params-comma-dangle.js | 137 +++++++++ .../tests/func-params-comma-dangle.js | 278 ++++++++++++++++++ 4 files changed, 420 insertions(+), 1 deletion(-) create mode 100644 eslint/babel-eslint-plugin/rules/func-params-comma-dangle.js create mode 100644 eslint/babel-eslint-plugin/tests/func-params-comma-dangle.js diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md index 48611f3cd376..a712dee52ca9 100644 --- a/eslint/babel-eslint-plugin/README.md +++ b/eslint/babel-eslint-plugin/README.md @@ -33,7 +33,8 @@ original ones as well!). "babel/object-shorthand": 1, "babel/arrow-parens": 1, "babel/no-await-in-loop": 1, - "babel/flow-object-type": 1 + "babel/flow-object-type": 1, + "babel/func-params-comma-dangle": 1 } } ``` @@ -57,3 +58,4 @@ the current JavaScript standard or supported by `eslint`. - `babel/flow-object-type`: Require a particular separator between properties in Flow object types. (🛠 ) - Use the option `semicolon` to require semicolons (e.g. `type Foo = { bar: number; baz: string }`). - Use the option `comma` to require commas (e.g. `type Foo = { bar: number, baz: string }`). +- `babel/func-params-comma-dangle`: Require or forbid trailing commas for function paramater lists. Behaves like, and takes the same options as, `eslint`'s [`comma-dangle`](http://eslint.org/docs/rules/comma-dangle). (🛠 ) diff --git a/eslint/babel-eslint-plugin/index.js b/eslint/babel-eslint-plugin/index.js index 7a3f7f46172d..3656458f0b3a 100644 --- a/eslint/babel-eslint-plugin/index.js +++ b/eslint/babel-eslint-plugin/index.js @@ -10,6 +10,7 @@ module.exports = { 'arrow-parens': require('./rules/arrow-parens'), 'no-await-in-loop': require('./rules/no-await-in-loop'), 'flow-object-type': require('./rules/flow-object-type'), + 'func-params-comma-dangle': require('./rules/func-params-comma-dangle'), }, rulesConfig: { 'generator-star-spacing': 0, @@ -20,5 +21,6 @@ module.exports = { 'arrow-parens': 0, 'no-await-in-loop': 0, 'flow-object-type': 0, + 'func-params-comma-dangle': 0, } }; diff --git a/eslint/babel-eslint-plugin/rules/func-params-comma-dangle.js b/eslint/babel-eslint-plugin/rules/func-params-comma-dangle.js new file mode 100644 index 000000000000..d750323d392a --- /dev/null +++ b/eslint/babel-eslint-plugin/rules/func-params-comma-dangle.js @@ -0,0 +1,137 @@ +'use strict'; + +// Based on https://github.com/eslint/eslint/blob/v2.11.1/lib/rules/comma-dangle.js + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +function last(arr) { + return arr.length !== 0 ? arr[arr.length - 1] : undefined; +} + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = function(context) { + var mode = context.options[0]; + var UNEXPECTED_MESSAGE = 'Unexpected trailing comma.'; + var MISSING_MESSAGE = 'Missing trailing comma.'; + + function isMultiline(node) { + var lastItem = last(node.params || node.arguments); + + if (!lastItem) { + return false; + } + + var sourceCode = context.getSourceCode(); + var penultimateToken = sourceCode.getLastToken(lastItem); + var lastToken = sourceCode.getTokenAfter(penultimateToken); + + if (lastToken.value === ',') { + penultimateToken = lastToken; + lastToken = sourceCode.getTokenAfter(lastToken); + } + + return lastToken.loc.end.line !== penultimateToken.loc.end.line; + } + + function forbidTrailingComma(node) { + var lastItem = last(node.params || node.arguments); + + if (!lastItem) { + return; + } + + var sourceCode = context.getSourceCode(); + var trailingToken = sourceCode.getTokenAfter(lastItem); + + if (trailingToken.value === ',') { + context.report({ + node: lastItem, + loc: trailingToken.loc.start, + message: UNEXPECTED_MESSAGE, + fix: function(fixer) { + return fixer.remove(trailingToken); + } + }); + } + } + + function forceTrailingComma(node) { + var lastItem = last(node.params || node.arguments); + + if (!lastItem) { + return; + } + + // `f(...a,)` is ok, but `function f(...a,) {}` is invalid syntax. + if (lastItem.type === 'RestElement') { + return; + } + + var sourceCode = context.getSourceCode(); + var penultimateToken = lastItem; + var trailingToken = sourceCode.getTokenAfter(lastItem); + + // `f = a, => {}` is invalid syntax. + if (node.type === 'ArrowFunctionExpression' && + node.params.length === 1 && + sourceCode.getTokenBefore(lastItem).value !== '(') { + return; + } + + if (trailingToken.value !== ',') { + context.report({ + node: lastItem, + loc: lastItem.loc.end, + message: MISSING_MESSAGE, + fix: function(fixer) { + return fixer.insertTextAfter(penultimateToken, ','); + } + }); + } + } + + function forceTrailingCommaIfMultiline(node) { + if (isMultiline(node)) { + forceTrailingComma(node); + } else { + forbidTrailingComma(node); + } + } + + function allowTrailingCommaIfMultiline(node) { + if (!isMultiline(node)) { + forbidTrailingComma(node); + } + } + + var checkForTrailingComma; + if (mode === 'always') { + checkForTrailingComma = forceTrailingComma; + } else if (mode === 'always-multiline') { + checkForTrailingComma = forceTrailingCommaIfMultiline; + } else if (mode === 'only-multiline') { + checkForTrailingComma = allowTrailingCommaIfMultiline; + } else { + checkForTrailingComma = forbidTrailingComma; + } + + return { + ArrowFunctionExpression: checkForTrailingComma, + FunctionDeclaration: checkForTrailingComma, + FunctionExpression: checkForTrailingComma, + CallExpression: checkForTrailingComma, + NewExpression: checkForTrailingComma, + }; +}; + +module.exports.fixable = 'code'; +module.exports.schema = [ + { + enum: ['always', 'always-multiline', 'only-multiline', 'never'] + } +]; diff --git a/eslint/babel-eslint-plugin/tests/func-params-comma-dangle.js b/eslint/babel-eslint-plugin/tests/func-params-comma-dangle.js new file mode 100644 index 000000000000..9fc5c2110f66 --- /dev/null +++ b/eslint/babel-eslint-plugin/tests/func-params-comma-dangle.js @@ -0,0 +1,278 @@ +'use strict'; + +var rule = require('../rules/func-params-comma-dangle'); +var RuleTester = require('eslint').RuleTester; + +var MISSING_I = [{message: 'Missing trailing comma.', type: 'Identifier'}]; +var MISSING_AP = [{message: 'Missing trailing comma.', type: 'AssignmentPattern'}]; +var MISSING_SE = [{message: 'Missing trailing comma.', type: 'SpreadElement'}]; +var UNEXPECTED_I = [{message: 'Unexpected trailing comma.', type: 'Identifier'}]; +var UNEXPECTED_AP = [{message: 'Unexpected trailing comma.', type: 'AssignmentPattern'}]; +var UNEXPECTED_SE = [{message: 'Unexpected trailing comma.', type: 'SpreadElement'}]; + +var ruleTester = new RuleTester({parser: 'babel-eslint'}); +ruleTester.run('func-params-comma-dangle', rule, { + valid: [ + {code: 'function f() {}'}, + {code: 'function f(\n) {}'}, + {code: 'function f(...a) {}'}, + {code: 'function f(...a\n) {}'}, + + {code: 'f()'}, + {code: 'f(\n)'}, + + {code: 'new F()'}, + {code: 'new F(\n)'}, + + // FunctionDeclaration + {code: 'function f(a) {}', options: ['always-multiline']}, + {code: 'function f(a) {}', options: ['never']}, + {code: 'function f(a) {}', options: ['only-multiline']}, + {code: 'function f(a,) {}', options: ['always']}, + {code: 'function f(a,\n) {}', options: ['always']}, + {code: 'function f(a,\n) {}', options: ['always-multiline']}, + {code: 'function f(a,\n) {}', options: ['only-multiline']}, + {code: 'function f(a\n) {}', options: ['never']}, + {code: 'function f(a\n) {}', options: ['only-multiline']}, + + {code: 'function f(a=1) {}', options: ['always-multiline']}, + {code: 'function f(a=1) {}', options: ['never']}, + {code: 'function f(a=1) {}', options: ['only-multiline']}, + {code: 'function f(a=1,) {}', options: ['always']}, + {code: 'function f(a=1,\n) {}', options: ['always']}, + {code: 'function f(a=1,\n) {}', options: ['always-multiline']}, + {code: 'function f(a=1,\n) {}', options: ['only-multiline']}, + {code: 'function f(a=1\n) {}', options: ['never']}, + {code: 'function f(a=1\n) {}', options: ['only-multiline']}, + + {code: 'function f(a:T) {}', options: ['always-multiline']}, + {code: 'function f(a:T) {}', options: ['never']}, + {code: 'function f(a:T) {}', options: ['only-multiline']}, + {code: 'function f(a:T,) {}', options: ['always']}, + {code: 'function f(a:T,\n) {}', options: ['always']}, + {code: 'function f(a:T,\n) {}', options: ['always-multiline']}, + {code: 'function f(a:T,\n) {}', options: ['only-multiline']}, + {code: 'function f(a:T\n) {}', options: ['never']}, + {code: 'function f(a:T\n) {}', options: ['only-multiline']}, + + // FunctionExpression + {code: 'f = function(a) {}', options: ['always-multiline']}, + {code: 'f = function(a) {}', options: ['never']}, + {code: 'f = function(a) {}', options: ['only-multiline']}, + {code: 'f = function(a,) {}', options: ['always']}, + {code: 'f = function(a,\n) {}', options: ['always']}, + {code: 'f = function(a,\n) {}', options: ['always-multiline']}, + {code: 'f = function(a,\n) {}', options: ['only-multiline']}, + {code: 'f = function(a\n) {}', options: ['never']}, + {code: 'f = function(a\n) {}', options: ['only-multiline']}, + + {code: 'f = function(a=1) {}', options: ['always-multiline']}, + {code: 'f = function(a=1) {}', options: ['never']}, + {code: 'f = function(a=1) {}', options: ['only-multiline']}, + {code: 'f = function(a=1,) {}', options: ['always']}, + {code: 'f = function(a=1,\n) {}', options: ['always']}, + {code: 'f = function(a=1,\n) {}', options: ['always-multiline']}, + {code: 'f = function(a=1,\n) {}', options: ['only-multiline']}, + {code: 'f = function(a=1\n) {}', options: ['never']}, + {code: 'f = function(a=1\n) {}', options: ['only-multiline']}, + + {code: 'f = function(a:T) {}', options: ['always-multiline']}, + {code: 'f = function(a:T) {}', options: ['never']}, + {code: 'f = function(a:T) {}', options: ['only-multiline']}, + {code: 'f = function(a:T,) {}', options: ['always']}, + {code: 'f = function(a:T,\n) {}', options: ['always']}, + {code: 'f = function(a:T,\n) {}', options: ['always-multiline']}, + {code: 'f = function(a:T,\n) {}', options: ['only-multiline']}, + {code: 'f = function(a:T\n) {}', options: ['never']}, + {code: 'f = function(a:T\n) {}', options: ['only-multiline']}, + + // ArrowFunctionExpression + {code: 'f = (a) => {}', options: ['always-multiline']}, + {code: 'f = (a) => {}', options: ['never']}, + {code: 'f = (a) => {}', options: ['only-multiline']}, + {code: 'f = (a,) => {}', options: ['always']}, + {code: 'f = (a,\n) => {}', options: ['always']}, + {code: 'f = (a,\n) => {}', options: ['always-multiline']}, + {code: 'f = (a,\n) => {}', options: ['only-multiline']}, + {code: 'f = (a\n) => {}', options: ['never']}, + {code: 'f = (a\n) => {}', options: ['only-multiline']}, + + {code: 'f = a => {}', options: ['always-multiline']}, + {code: 'f = a => {}', options: ['never']}, + {code: 'f = a => {}', options: ['only-multiline']}, + {code: 'f = a => {}', options: ['always']}, + + {code: 'f = (a=1) => {}', options: ['always-multiline']}, + {code: 'f = (a=1) => {}', options: ['never']}, + {code: 'f = (a=1) => {}', options: ['only-multiline']}, + {code: 'f = (a=1,) => {}', options: ['always']}, + {code: 'f = (a=1,\n) => {}', options: ['always']}, + {code: 'f = (a=1,\n) => {}', options: ['always-multiline']}, + {code: 'f = (a=1,\n) => {}', options: ['only-multiline']}, + {code: 'f = (a=1\n) => {}', options: ['never']}, + {code: 'f = (a=1\n) => {}', options: ['only-multiline']}, + + {code: 'f = (a:T) => {}', options: ['always-multiline']}, + {code: 'f = (a:T) => {}', options: ['never']}, + {code: 'f = (a:T) => {}', options: ['only-multiline']}, + // Arrow functions with flow types aren't getting the correct loc. + // {code: 'f = (a:T,) => {}', options: ['always']}, + // {code: 'f = (a:T,\n) => {}', options: ['always']}, + {code: 'f = (a:T,\n) => {}', options: ['always-multiline']}, + {code: 'f = (a:T,\n) => {}', options: ['only-multiline']}, + {code: 'f = (a:T\n) => {}', options: ['never']}, + {code: 'f = (a:T\n) => {}', options: ['only-multiline']}, + + // CallExpression + {code: 'f(a)', options: ['always-multiline']}, + {code: 'f(a)', options: ['never']}, + {code: 'f(a)', options: ['only-multiline']}, + {code: 'f(a,)', options: ['always']}, + {code: 'f(a,\n)', options: ['always']}, + {code: 'f(a,\n)', options: ['always-multiline']}, + {code: 'f(a,\n)', options: ['only-multiline']}, + {code: 'f(a\n)', options: ['never']}, + {code: 'f(a\n)', options: ['only-multiline']}, + {code: 'f(...a)', options: ['always-multiline']}, + {code: 'f(...a)', options: ['never']}, + {code: 'f(...a)', options: ['only-multiline']}, + {code: 'f(...a,)', options: ['always']}, + {code: 'f(...a,\n)', options: ['always']}, + {code: 'f(...a,\n)', options: ['always-multiline']}, + {code: 'f(...a,\n)', options: ['only-multiline']}, + {code: 'f(...a\n)', options: ['never']}, + {code: 'f(...a\n)', options: ['only-multiline']}, + + // NewExpression + {code: 'new F(a)', options: ['always-multiline']}, + {code: 'new F(a)', options: ['never']}, + {code: 'new F(a)', options: ['only-multiline']}, + {code: 'new F(a,)', options: ['always']}, + {code: 'new F(a,\n)', options: ['always']}, + {code: 'new F(a,\n)', options: ['always-multiline']}, + {code: 'new F(a,\n)', options: ['only-multiline']}, + {code: 'new F(a\n)', options: ['never']}, + {code: 'new F(a\n)', options: ['only-multiline']}, + {code: 'new F(...a)', options: ['always-multiline']}, + {code: 'new F(...a)', options: ['never']}, + {code: 'new F(...a)', options: ['only-multiline']}, + {code: 'new F(...a,)', options: ['always']}, + {code: 'new F(...a,\n)', options: ['always']}, + {code: 'new F(...a,\n)', options: ['always-multiline']}, + {code: 'new F(...a,\n)', options: ['only-multiline']}, + {code: 'new F(...a\n)', options: ['never']}, + {code: 'new F(...a\n)', options: ['only-multiline']}, + ], + invalid: [ + // FunctionDeclaration + {code: 'function f(a) {}', output: 'function f(a,) {}', options: ['always'], errors: MISSING_I}, + {code: 'function f(a,) {}', output: 'function f(a) {}', options: ['always-multiline'], errors: UNEXPECTED_I}, + {code: 'function f(a,) {}', output: 'function f(a) {}', options: ['only-multiline'], errors: UNEXPECTED_I}, + {code: 'function f(a,) {}', output: 'function f(a) {}', options: ['never'], errors: UNEXPECTED_I}, + {code: 'function f(a,\n) {}', output: 'function f(a\n) {}', options: ['never'], errors: UNEXPECTED_I}, + {code: 'function f(a\n) {}', output: 'function f(a,\n) {}', options: ['always'], errors: MISSING_I}, + {code: 'function f(a\n) {}', output: 'function f(a,\n) {}', options: ['always-multiline'], errors: MISSING_I}, + + {code: 'function f(a=1) {}', output: 'function f(a=1,) {}', options: ['always'], errors: MISSING_AP}, + {code: 'function f(a=1,) {}', output: 'function f(a=1) {}', options: ['always-multiline'], errors: UNEXPECTED_AP}, + {code: 'function f(a=1,) {}', output: 'function f(a=1) {}', options: ['always-multiline'], errors: UNEXPECTED_AP}, + {code: 'function f(a=1,) {}', output: 'function f(a=1) {}', options: ['only-multiline'], errors: UNEXPECTED_AP}, + {code: 'function f(a=1,) {}', output: 'function f(a=1) {}', options: ['never'], errors: UNEXPECTED_AP}, + {code: 'function f(a=1,\n) {}', output: 'function f(a=1\n) {}', options: ['never'], errors: UNEXPECTED_AP}, + {code: 'function f(a=1\n) {}', output: 'function f(a=1,\n) {}', options: ['always'], errors: MISSING_AP}, + {code: 'function f(a=1\n) {}', output: 'function f(a=1,\n) {}', options: ['always-multiline'], errors: MISSING_AP}, + + {code: 'function f(a:T) {}', output: 'function f(a:T,) {}', options: ['always'], errors: MISSING_I}, + {code: 'function f(a:T,) {}', output: 'function f(a:T) {}', options: ['always-multiline'], errors: UNEXPECTED_I}, + {code: 'function f(a:T,) {}', output: 'function f(a:T) {}', options: ['only-multiline'], errors: UNEXPECTED_I}, + {code: 'function f(a:T,) {}', output: 'function f(a:T) {}', options: ['never'], errors: UNEXPECTED_I}, + {code: 'function f(a:T,\n) {}', output: 'function f(a:T\n) {}', options: ['never'], errors: UNEXPECTED_I}, + {code: 'function f(a:T\n) {}', output: 'function f(a:T,\n) {}', options: ['always'], errors: MISSING_I}, + {code: 'function f(a:T\n) {}', output: 'function f(a:T,\n) {}', options: ['always-multiline'], errors: MISSING_I}, + + // FunctionExpression + {code: 'f = function f(a) {}', output: 'f = function f(a,) {}', options: ['always'], errors: MISSING_I}, + {code: 'f = function f(a,) {}', output: 'f = function f(a) {}', options: ['always-multiline'], errors: UNEXPECTED_I}, + {code: 'f = function f(a,) {}', output: 'f = function f(a) {}', options: ['only-multiline'], errors: UNEXPECTED_I}, + {code: 'f = function f(a,) {}', output: 'f = function f(a) {}', options: ['never'], errors: UNEXPECTED_I}, + {code: 'f = function f(a,\n) {}', output: 'f = function f(a\n) {}', options: ['never'], errors: UNEXPECTED_I}, + {code: 'f = function f(a\n) {}', output: 'f = function f(a,\n) {}', options: ['always'], errors: MISSING_I}, + {code: 'f = function f(a\n) {}', output: 'f = function f(a,\n) {}', options: ['always-multiline'], errors: MISSING_I}, + + {code: 'f = function f(a=1) {}', output: 'f = function f(a=1,) {}', options: ['always'], errors: MISSING_AP}, + {code: 'f = function f(a=1,) {}', output: 'f = function f(a=1) {}', options: ['always-multiline'], errors: UNEXPECTED_AP}, + {code: 'f = function f(a=1,) {}', output: 'f = function f(a=1) {}', options: ['only-multiline'], errors: UNEXPECTED_AP}, + {code: 'f = function f(a=1,) {}', output: 'f = function f(a=1) {}', options: ['never'], errors: UNEXPECTED_AP}, + {code: 'f = function f(a=1,\n) {}', output: 'f = function f(a=1\n) {}', options: ['never'], errors: UNEXPECTED_AP}, + {code: 'f = function f(a=1\n) {}', output: 'f = function f(a=1,\n) {}', options: ['always'], errors: MISSING_AP}, + {code: 'f = function f(a=1\n) {}', output: 'f = function f(a=1,\n) {}', options: ['always-multiline'], errors: MISSING_AP}, + + {code: 'f = function f(a:T) {}', output: 'f = function f(a:T,) {}', options: ['always'], errors: MISSING_I}, + {code: 'f = function f(a:T,) {}', output: 'f = function f(a:T) {}', options: ['always-multiline'], errors: UNEXPECTED_I}, + {code: 'f = function f(a:T,) {}', output: 'f = function f(a:T) {}', options: ['only-multiline'], errors: UNEXPECTED_I}, + {code: 'f = function f(a:T,) {}', output: 'f = function f(a:T) {}', options: ['never'], errors: UNEXPECTED_I}, + {code: 'f = function f(a:T,\n) {}', output: 'f = function f(a:T\n) {}', options: ['never'], errors: UNEXPECTED_I}, + {code: 'f = function f(a:T\n) {}', output: 'f = function f(a:T,\n) {}', options: ['always'], errors: MISSING_I}, + {code: 'f = function f(a:T\n) {}', output: 'f = function f(a:T,\n) {}', options: ['always-multiline'], errors: MISSING_I}, + + // ArrowFunctionExpression + {code: 'f = (a) => {}', output: 'f = (a,) => {}', options: ['always'], errors: MISSING_I}, + {code: 'f = (a,) => {}', output: 'f = (a) => {}', options: ['always-multiline'], errors: UNEXPECTED_I}, + {code: 'f = (a,) => {}', output: 'f = (a) => {}', options: ['only-multiline'], errors: UNEXPECTED_I}, + {code: 'f = (a,) => {}', output: 'f = (a) => {}', options: ['never'], errors: UNEXPECTED_I}, + {code: 'f = (a,\n) => {}', output: 'f = (a\n) => {}', options: ['never'], errors: UNEXPECTED_I}, + {code: 'f = (a\n) => {}', output: 'f = (a,\n) => {}', options: ['always'], errors: MISSING_I}, + {code: 'f = (a\n) => {}', output: 'f = (a,\n) => {}', options: ['always-multiline'], errors: MISSING_I}, + + {code: 'f = (a=1) => {}', output: 'f = (a=1,) => {}', options: ['always'], errors: MISSING_AP}, + {code: 'f = (a=1,) => {}', output: 'f = (a=1) => {}', options: ['always-multiline'], errors: UNEXPECTED_AP}, + {code: 'f = (a=1,) => {}', output: 'f = (a=1) => {}', options: ['only-multiline'], errors: UNEXPECTED_AP}, + {code: 'f = (a=1,) => {}', output: 'f = (a=1) => {}', options: ['never'], errors: UNEXPECTED_AP}, + {code: 'f = (a=1,\n) => {}', output: 'f = (a=1\n) => {}', options: ['never'], errors: UNEXPECTED_AP}, + {code: 'f = (a=1\n) => {}', output: 'f = (a=1,\n) => {}', options: ['always'], errors: MISSING_AP}, + {code: 'f = (a=1\n) => {}', output: 'f = (a=1,\n) => {}', options: ['always-multiline'], errors: MISSING_AP}, + + // Arrow functions with flow types aren't getting the correct loc. + // {code: 'f = (a:T) => {}', output: 'f = (a:T,) => {}', options: ['always'], errors: MISSING_I}, + // {code: 'f = (a:T,) => {}', output: 'f = (a:T) => {}', options: ['always-multiline'], errors: UNEXPECTED_I}, + // {code: 'f = (a:T,) => {}', output: 'f = (a:T) => {}', options: ['only-multiline'], errors: UNEXPECTED_I}, + // {code: 'f = (a:T,) => {}', output: 'f = (a:T) => {}', options: ['never'], errors: UNEXPECTED_I}, + // {code: 'f = (a:T,\n) => {}', output: 'f = (a:T\n) => {}', options: ['never'], errors: UNEXPECTED_I}, + // {code: 'f = (a:T\n) => {}', output: 'f = (a:T,\n) => {}', options: ['always'], errors: MISSING_I}, + // {code: 'f = (a:T\n) => {}', output: 'f = (a:T,\n) => {}', options: ['always-multiline'], errors: MISSING_I}, + + // CallExpression + {code: 'f(a)', output: 'f(a,)', options: ['always'], errors: MISSING_I}, + {code: 'f(a,)', output: 'f(a)', options: ['always-multiline'], errors: UNEXPECTED_I}, + {code: 'f(a,)', output: 'f(a)', options: ['only-multiline'], errors: UNEXPECTED_I}, + {code: 'f(a,)', output: 'f(a)', options: ['never'], errors: UNEXPECTED_I}, + {code: 'f(a,\n)', output: 'f(a\n)', options: ['never'], errors: UNEXPECTED_I}, + {code: 'f(a\n)', output: 'f(a,\n)', options: ['always'], errors: MISSING_I}, + {code: 'f(a\n)', output: 'f(a,\n)', options: ['always-multiline'], errors: MISSING_I}, + + {code: 'f(...a)', output: 'f(...a,)', options: ['always'], errors: MISSING_SE}, + {code: 'f(...a,)', output: 'f(...a)', options: ['always-multiline'], errors: UNEXPECTED_SE}, + {code: 'f(...a,)', output: 'f(...a)', options: ['only-multiline'], errors: UNEXPECTED_SE}, + {code: 'f(...a,)', output: 'f(...a)', options: ['never'], errors: UNEXPECTED_SE}, + {code: 'f(...a,\n)', output: 'f(...a\n)', options: ['never'], errors: UNEXPECTED_SE}, + {code: 'f(...a\n)', output: 'f(...a,\n)', options: ['always'], errors: MISSING_SE}, + {code: 'f(...a\n)', output: 'f(...a,\n)', options: ['always-multiline'], errors: MISSING_SE}, + + // NewExpression + {code: 'new F(a)', output: 'new F(a,)', options: ['always'], errors: MISSING_I}, + {code: 'new F(a,)', output: 'new F(a)', options: ['always-multiline'], errors: UNEXPECTED_I}, + {code: 'new F(a,)', output: 'new F(a)', options: ['only-multiline'], errors: UNEXPECTED_I}, + {code: 'new F(a,)', output: 'new F(a)', options: ['never'], errors: UNEXPECTED_I}, + {code: 'new F(a,\n)', output: 'new F(a\n)', options: ['never'], errors: UNEXPECTED_I}, + {code: 'new F(a\n)', output: 'new F(a,\n)', options: ['always'], errors: MISSING_I}, + {code: 'new F(a\n)', output: 'new F(a,\n)', options: ['always-multiline'], errors: MISSING_I}, + + {code: 'new F(...a)', output: 'new F(...a,)', options: ['always'], errors: MISSING_SE}, + {code: 'new F(...a,)', output: 'new F(...a)', options: ['always-multiline'], errors: UNEXPECTED_SE}, + {code: 'new F(...a,)', output: 'new F(...a)', options: ['only-multiline'], errors: UNEXPECTED_SE}, + {code: 'new F(...a,)', output: 'new F(...a)', options: ['never'], errors: UNEXPECTED_SE}, + {code: 'new F(...a,\n)', output: 'new F(...a\n)', options: ['never'], errors: UNEXPECTED_SE}, + {code: 'new F(...a\n)', output: 'new F(...a,\n)', options: ['always'], errors: MISSING_SE}, + {code: 'new F(...a\n)', output: 'new F(...a,\n)', options: ['always-multiline'], errors: MISSING_SE}, + ], +}); From cae851363613c712c356ae0c6e278a7f048e19cf Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 21 Jun 2016 16:17:06 -0400 Subject: [PATCH 507/569] 3.3.0 --- eslint/babel-eslint-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index 35d923259738..1487c6b70653 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-babel", - "version": "3.2.0", + "version": "3.3.0", "description": "an eslint rule plugin companion to babel-eslint", "main": "index.js", "scripts": { From 1daf7f986599978dc71db15dc120b82a8b279838 Mon Sep 17 00:00:00 2001 From: Kai Cataldo Date: Fri, 1 Jul 2016 07:58:05 -0400 Subject: [PATCH 508/569] Run Travis CI in same Node versions as babel-eslint (babel/eslint-plugin-babel#68) --- eslint/babel-eslint-plugin/.travis.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/.travis.yml b/eslint/babel-eslint-plugin/.travis.yml index 5a7ce2a7f99e..2d156dd6d5e0 100644 --- a/eslint/babel-eslint-plugin/.travis.yml +++ b/eslint/babel-eslint-plugin/.travis.yml @@ -1,7 +1,11 @@ --- git: depth: 1 +sudo: false language: node_js node_js: + - '0.10' - '0.12' - - 'io.js' \ No newline at end of file + - '4' + - '5' + - '6' From f6c2d2e0e525f49f553f412ce14390774f3f3cd6 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 1 Jul 2016 08:24:41 -0400 Subject: [PATCH 509/569] `--save-dev` instead of `-D` [skip ci] --- eslint/babel-eslint-plugin/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md index a712dee52ca9..419cafa07c22 100644 --- a/eslint/babel-eslint-plugin/README.md +++ b/eslint/babel-eslint-plugin/README.md @@ -7,7 +7,7 @@ for use with Babel, but it can't change the built in rules to support experiment ### Install ```sh -npm install eslint-plugin-babel -D +npm install eslint-plugin-babel --save-dev ``` Load the plugin in your `.eslintrc` file: From 6e4d44f312129d1e5bb83498c718a601d428fe26 Mon Sep 17 00:00:00 2001 From: Kai Cataldo Date: Fri, 1 Jul 2016 10:15:59 -0400 Subject: [PATCH 510/569] Update Dependencies (babel/eslint-plugin-babel#67) * Update Dependencies fixes babel/eslint-plugin-babel#65 * Remove PhantomJS & is-my-json-valid PhantomJS & is-my-json-valid is not actually used anywhere * Change ESLint peerDependency version back to >=1.0.0 --- eslint/babel-eslint-plugin/package.json | 10 ++++------ eslint/babel-eslint-plugin/tests/RuleTester.js | 7 +++++++ .../tests/{ => rules}/array-bracket-spacing.js | 4 ++-- .../tests/{ => rules}/arrow-parens.js | 4 ++-- .../tests/{ => rules}/flow-object-type.js | 4 ++-- .../tests/{ => rules}/func-params-comma-dangle.js | 4 ++-- .../tests/{ => rules}/generator-star-spacing.js | 4 ++-- .../babel-eslint-plugin/tests/{ => rules}/new-cap.js | 4 ++-- .../tests/{ => rules}/no-await-in-loop.js | 4 ++-- .../tests/{ => rules}/object-curly-spacing.js | 4 ++-- .../tests/{ => rules}/object-shorthand.js | 4 ++-- 11 files changed, 29 insertions(+), 24 deletions(-) create mode 100644 eslint/babel-eslint-plugin/tests/RuleTester.js rename eslint/babel-eslint-plugin/tests/{ => rules}/array-bracket-spacing.js (99%) rename eslint/babel-eslint-plugin/tests/{ => rules}/arrow-parens.js (98%) rename eslint/babel-eslint-plugin/tests/{ => rules}/flow-object-type.js (94%) rename eslint/babel-eslint-plugin/tests/{ => rules}/func-params-comma-dangle.js (99%) rename eslint/babel-eslint-plugin/tests/{ => rules}/generator-star-spacing.js (99%) rename eslint/babel-eslint-plugin/tests/{ => rules}/new-cap.js (98%) rename eslint/babel-eslint-plugin/tests/{ => rules}/no-await-in-loop.js (96%) rename eslint/babel-eslint-plugin/tests/{ => rules}/object-curly-spacing.js (99%) rename eslint/babel-eslint-plugin/tests/{ => rules}/object-shorthand.js (98%) diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index 1487c6b70653..fe4173229ddd 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -4,7 +4,7 @@ "description": "an eslint rule plugin companion to babel-eslint", "main": "index.js", "scripts": { - "test": "mocha ./tests/*.js" + "test": "mocha ./tests/rules/*.js" }, "repository": { "type": "git", @@ -27,10 +27,8 @@ "eslint": ">=1.0.0" }, "devDependencies": { - "babel-eslint": "^4.0.7", - "eslint": "^1.1.0", - "is-my-json-valid": "^2.12.0", - "mocha": "^2.2.5", - "phantomjs": "^1.9.17" + "babel-eslint": "^6.1.0", + "eslint": "^2.13.1", + "mocha": "^2.2.5" } } diff --git a/eslint/babel-eslint-plugin/tests/RuleTester.js b/eslint/babel-eslint-plugin/tests/RuleTester.js new file mode 100644 index 000000000000..e183277bfb40 --- /dev/null +++ b/eslint/babel-eslint-plugin/tests/RuleTester.js @@ -0,0 +1,7 @@ +var RuleTester = require("eslint").RuleTester; + +RuleTester.setDefaultConfig({ + parser: 'babel-eslint' +}); + +module.exports = RuleTester; diff --git a/eslint/babel-eslint-plugin/tests/array-bracket-spacing.js b/eslint/babel-eslint-plugin/tests/rules/array-bracket-spacing.js similarity index 99% rename from eslint/babel-eslint-plugin/tests/array-bracket-spacing.js rename to eslint/babel-eslint-plugin/tests/rules/array-bracket-spacing.js index e4d743d2542a..ea5aa2f45875 100644 --- a/eslint/babel-eslint-plugin/tests/array-bracket-spacing.js +++ b/eslint/babel-eslint-plugin/tests/rules/array-bracket-spacing.js @@ -9,8 +9,8 @@ // Requirements //------------------------------------------------------------------------------ -var rule = require('../rules/array-bracket-spacing'), - RuleTester = require('eslint').RuleTester; +var rule = require('../../rules/array-bracket-spacing'), + RuleTester = require('../RuleTester'); //------------------------------------------------------------------------------ // Tests diff --git a/eslint/babel-eslint-plugin/tests/arrow-parens.js b/eslint/babel-eslint-plugin/tests/rules/arrow-parens.js similarity index 98% rename from eslint/babel-eslint-plugin/tests/arrow-parens.js rename to eslint/babel-eslint-plugin/tests/rules/arrow-parens.js index f129f77f71b8..1962be7b8891 100644 --- a/eslint/babel-eslint-plugin/tests/arrow-parens.js +++ b/eslint/babel-eslint-plugin/tests/rules/arrow-parens.js @@ -11,8 +11,8 @@ // Requirements //------------------------------------------------------------------------------ -var rule = require("../rules/arrow-parens"), - RuleTester = require('eslint').RuleTester; +var rule = require("../../rules/arrow-parens"), + RuleTester = require('../RuleTester'); function ok(code, args){ return { code: code, options: args, parser: 'babel-eslint' } diff --git a/eslint/babel-eslint-plugin/tests/flow-object-type.js b/eslint/babel-eslint-plugin/tests/rules/flow-object-type.js similarity index 94% rename from eslint/babel-eslint-plugin/tests/flow-object-type.js rename to eslint/babel-eslint-plugin/tests/rules/flow-object-type.js index f98c63266454..9d34036b0f68 100644 --- a/eslint/babel-eslint-plugin/tests/flow-object-type.js +++ b/eslint/babel-eslint-plugin/tests/rules/flow-object-type.js @@ -5,8 +5,8 @@ "use strict"; -var rule = require("../rules/flow-object-type"), - RuleTester = require('eslint').RuleTester; +var rule = require("../../rules/flow-object-type"), + RuleTester = require('../RuleTester'); var features = { }; diff --git a/eslint/babel-eslint-plugin/tests/func-params-comma-dangle.js b/eslint/babel-eslint-plugin/tests/rules/func-params-comma-dangle.js similarity index 99% rename from eslint/babel-eslint-plugin/tests/func-params-comma-dangle.js rename to eslint/babel-eslint-plugin/tests/rules/func-params-comma-dangle.js index 9fc5c2110f66..a1676e4fc4b1 100644 --- a/eslint/babel-eslint-plugin/tests/func-params-comma-dangle.js +++ b/eslint/babel-eslint-plugin/tests/rules/func-params-comma-dangle.js @@ -1,7 +1,7 @@ 'use strict'; -var rule = require('../rules/func-params-comma-dangle'); -var RuleTester = require('eslint').RuleTester; +var rule = require('../../rules/func-params-comma-dangle'); +var RuleTester = require('../RuleTester'); var MISSING_I = [{message: 'Missing trailing comma.', type: 'Identifier'}]; var MISSING_AP = [{message: 'Missing trailing comma.', type: 'AssignmentPattern'}]; diff --git a/eslint/babel-eslint-plugin/tests/generator-star-spacing.js b/eslint/babel-eslint-plugin/tests/rules/generator-star-spacing.js similarity index 99% rename from eslint/babel-eslint-plugin/tests/generator-star-spacing.js rename to eslint/babel-eslint-plugin/tests/rules/generator-star-spacing.js index cf93add7c9e0..86438a940c7f 100644 --- a/eslint/babel-eslint-plugin/tests/generator-star-spacing.js +++ b/eslint/babel-eslint-plugin/tests/rules/generator-star-spacing.js @@ -1,6 +1,6 @@ /* eslint-disable */ -var rule = require('../rules/generator-star-spacing'), - RuleTester = require('eslint').RuleTester; +var rule = require('../../rules/generator-star-spacing'), + RuleTester = require('../RuleTester'); var features = { generators: true diff --git a/eslint/babel-eslint-plugin/tests/new-cap.js b/eslint/babel-eslint-plugin/tests/rules/new-cap.js similarity index 98% rename from eslint/babel-eslint-plugin/tests/new-cap.js rename to eslint/babel-eslint-plugin/tests/rules/new-cap.js index b7a9da45a0e1..5fe53cbe3996 100644 --- a/eslint/babel-eslint-plugin/tests/new-cap.js +++ b/eslint/babel-eslint-plugin/tests/rules/new-cap.js @@ -5,8 +5,8 @@ * @author Nicholas C. Zakas */ -var rule = require('../rules/new-cap'), - RuleTester = require('eslint').RuleTester; +var rule = require('../../rules/new-cap'), + RuleTester = require('../RuleTester'); var ruleTester = new RuleTester(); ruleTester.run('babel/new-cap', rule, { diff --git a/eslint/babel-eslint-plugin/tests/no-await-in-loop.js b/eslint/babel-eslint-plugin/tests/rules/no-await-in-loop.js similarity index 96% rename from eslint/babel-eslint-plugin/tests/no-await-in-loop.js rename to eslint/babel-eslint-plugin/tests/rules/no-await-in-loop.js index ba82e4e78cbb..97de50fdd940 100644 --- a/eslint/babel-eslint-plugin/tests/no-await-in-loop.js +++ b/eslint/babel-eslint-plugin/tests/rules/no-await-in-loop.js @@ -5,8 +5,8 @@ "use strict"; -var rule = require("../rules/no-await-in-loop"), - RuleTester = require('eslint').RuleTester; +var rule = require("../../rules/no-await-in-loop"), + RuleTester = require('../RuleTester'); var features = { }; diff --git a/eslint/babel-eslint-plugin/tests/object-curly-spacing.js b/eslint/babel-eslint-plugin/tests/rules/object-curly-spacing.js similarity index 99% rename from eslint/babel-eslint-plugin/tests/object-curly-spacing.js rename to eslint/babel-eslint-plugin/tests/rules/object-curly-spacing.js index 5e70fc5bbcae..44c188fdd0a3 100644 --- a/eslint/babel-eslint-plugin/tests/object-curly-spacing.js +++ b/eslint/babel-eslint-plugin/tests/rules/object-curly-spacing.js @@ -8,8 +8,8 @@ * @copyright 2015 Mathieu M-Gosselin. All rights reserved. */ -var rule = require('../rules/object-curly-spacing'), - RuleTester = require('eslint').RuleTester; +var rule = require('../../rules/object-curly-spacing'), + RuleTester = require('../RuleTester'); var ruleTester = new RuleTester(); ruleTester.run('babel/object-curly-spacing', rule, { diff --git a/eslint/babel-eslint-plugin/tests/object-shorthand.js b/eslint/babel-eslint-plugin/tests/rules/object-shorthand.js similarity index 98% rename from eslint/babel-eslint-plugin/tests/object-shorthand.js rename to eslint/babel-eslint-plugin/tests/rules/object-shorthand.js index 0dfe5fb51c39..c35c086b51a1 100644 --- a/eslint/babel-eslint-plugin/tests/object-shorthand.js +++ b/eslint/babel-eslint-plugin/tests/rules/object-shorthand.js @@ -1,6 +1,6 @@ /* eslint-disable */ -var rule = require('../rules/object-shorthand'), - RuleTester = require('eslint').RuleTester; +var rule = require('../../rules/object-shorthand'), + RuleTester = require('../RuleTester'); var features = { objectLiteralShorthandMethods: true, From 57b06a504aeedb40113dc8a2b3298ac29bcafbd1 Mon Sep 17 00:00:00 2001 From: Greenkeeper Date: Fri, 1 Jul 2016 21:27:59 +0200 Subject: [PATCH 511/569] chore(package): update eslint to version 3.0.0 (babel/eslint-plugin-babel#70) https://greenkeeper.io/ --- eslint/babel-eslint-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index fe4173229ddd..0e2b1ff0d446 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -28,7 +28,7 @@ }, "devDependencies": { "babel-eslint": "^6.1.0", - "eslint": "^2.13.1", + "eslint": "^3.0.0", "mocha": "^2.2.5" } } From 831a217d006c9cfb6acda091ced26ccc4f7c0f95 Mon Sep 17 00:00:00 2001 From: Greenkeeper Date: Thu, 22 Sep 2016 10:27:31 +0200 Subject: [PATCH 512/569] chore(package): update mocha to version 3.0.0 (babel/eslint-plugin-babel#79) https://greenkeeper.io/ --- eslint/babel-eslint-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index 0e2b1ff0d446..80cc7a38e0f7 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -29,6 +29,6 @@ "devDependencies": { "babel-eslint": "^6.1.0", "eslint": "^3.0.0", - "mocha": "^2.2.5" + "mocha": "^3.0.0" } } From 2b52d67ebcba973ce7452cf1815a897993d57fdc Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Wed, 2 Nov 2016 14:38:46 -0400 Subject: [PATCH 513/569] Merge pull request babel/eslint-plugin-babel#101 from mathieumg/no-invalid-this Added `babel/no-invalid-this` --- eslint/babel-eslint-plugin/README.md | 4 +- eslint/babel-eslint-plugin/ast-utils.js | 727 ++++++++++++++++++ eslint/babel-eslint-plugin/index.js | 2 + eslint/babel-eslint-plugin/package.json | 1 + .../rules/no-invalid-this.js | 143 ++++ .../tests/rules/no-invalid-this.js | 609 +++++++++++++++ 6 files changed, 1485 insertions(+), 1 deletion(-) create mode 100644 eslint/babel-eslint-plugin/ast-utils.js create mode 100644 eslint/babel-eslint-plugin/rules/no-invalid-this.js create mode 100644 eslint/babel-eslint-plugin/tests/rules/no-invalid-this.js diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md index 419cafa07c22..171a4083fa5c 100644 --- a/eslint/babel-eslint-plugin/README.md +++ b/eslint/babel-eslint-plugin/README.md @@ -34,7 +34,8 @@ original ones as well!). "babel/arrow-parens": 1, "babel/no-await-in-loop": 1, "babel/flow-object-type": 1, - "babel/func-params-comma-dangle": 1 + "babel/func-params-comma-dangle": 1, + "babel/no-invalid-this": 1 } } ``` @@ -50,6 +51,7 @@ Each rule corresponds to a core `eslint` rule, and has the same options. - `babel/object-curly-spacing`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` (🛠 ) - `babel/object-shorthand`: doesn't fail when using object spread (`...obj`) - `babel/arrow-parens`: Handles async functions correctly (🛠 ) +- `babel/no-invalid-this`: doesn't fail when inside class properties (`class A { a = this.b; }`) The following rules are not in `eslint`, but are relevant only to syntax that is not specified by the current JavaScript standard or supported by `eslint`. diff --git a/eslint/babel-eslint-plugin/ast-utils.js b/eslint/babel-eslint-plugin/ast-utils.js new file mode 100644 index 000000000000..9f0d91f7edbb --- /dev/null +++ b/eslint/babel-eslint-plugin/ast-utils.js @@ -0,0 +1,727 @@ +/** + * @fileoverview Common utils for AST. + * @author Gyandeep Singh + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const anyFunctionPattern = /^(?:Function(?:Declaration|Expression)|ArrowFunctionExpression)$/; +const anyLoopPattern = /^(?:DoWhile|For|ForIn|ForOf|While)Statement$/; +const arrayOrTypedArrayPattern = /Array$/; +const arrayMethodPattern = /^(?:every|filter|find|findIndex|forEach|map|some)$/; +const bindOrCallOrApplyPattern = /^(?:bind|call|apply)$/; +const breakableTypePattern = /^(?:(?:Do)?While|For(?:In|Of)?|Switch)Statement$/; +const thisTagPattern = /^[\s\*]*@this/m; + +/** + * Checks reference if is non initializer and writable. + * @param {Reference} reference - A reference to check. + * @param {int} index - The index of the reference in the references. + * @param {Reference[]} references - The array that the reference belongs to. + * @returns {boolean} Success/Failure + * @private + */ +function isModifyingReference(reference, index, references) { + const identifier = reference.identifier; + + /* + * Destructuring assignments can have multiple default value, so + * possibly there are multiple writeable references for the same + * identifier. + */ + const modifyingDifferentIdentifier = index === 0 || + references[index - 1].identifier !== identifier; + + return (identifier && + reference.init === false && + reference.isWrite() && + modifyingDifferentIdentifier + ); +} + +/** + * Checks whether the given string starts with uppercase or not. + * + * @param {string} s - The string to check. + * @returns {boolean} `true` if the string starts with uppercase. + */ +function startsWithUpperCase(s) { + return s[0] !== s[0].toLocaleLowerCase(); +} + +/** + * Checks whether or not a node is a constructor. + * @param {ASTNode} node - A function node to check. + * @returns {boolean} Wehether or not a node is a constructor. + */ +function isES5Constructor(node) { + return (node.id && startsWithUpperCase(node.id.name)); +} + +/** + * Finds a function node from ancestors of a node. + * @param {ASTNode} node - A start node to find. + * @returns {Node|null} A found function node. + */ +function getUpperFunction(node) { + while (node) { + if (anyFunctionPattern.test(node.type)) { + return node; + } + node = node.parent; + } + return null; +} + +/** + * Checks whether or not a node is `null` or `undefined`. + * @param {ASTNode} node - A node to check. + * @returns {boolean} Whether or not the node is a `null` or `undefined`. + * @public + */ +function isNullOrUndefined(node) { + return ( + (node.type === "Literal" && node.value === null) || + (node.type === "Identifier" && node.name === "undefined") || + (node.type === "UnaryExpression" && node.operator === "void") + ); +} + +/** + * Checks whether or not a node is callee. + * @param {ASTNode} node - A node to check. + * @returns {boolean} Whether or not the node is callee. + */ +function isCallee(node) { + return node.parent.type === "CallExpression" && node.parent.callee === node; +} + +/** + * Checks whether or not a node is `Reclect.apply`. + * @param {ASTNode} node - A node to check. + * @returns {boolean} Whether or not the node is a `Reclect.apply`. + */ +function isReflectApply(node) { + return ( + node.type === "MemberExpression" && + node.object.type === "Identifier" && + node.object.name === "Reflect" && + node.property.type === "Identifier" && + node.property.name === "apply" && + node.computed === false + ); +} + +/** + * Checks whether or not a node is `Array.from`. + * @param {ASTNode} node - A node to check. + * @returns {boolean} Whether or not the node is a `Array.from`. + */ +function isArrayFromMethod(node) { + return ( + node.type === "MemberExpression" && + node.object.type === "Identifier" && + arrayOrTypedArrayPattern.test(node.object.name) && + node.property.type === "Identifier" && + node.property.name === "from" && + node.computed === false + ); +} + +/** + * Checks whether or not a node is a method which has `thisArg`. + * @param {ASTNode} node - A node to check. + * @returns {boolean} Whether or not the node is a method which has `thisArg`. + */ +function isMethodWhichHasThisArg(node) { + while (node) { + if (node.type === "Identifier") { + return arrayMethodPattern.test(node.name); + } + if (node.type === "MemberExpression" && !node.computed) { + node = node.property; + continue; + } + + break; + } + + return false; +} + +/** + * Checks whether or not a node has a `@this` tag in its comments. + * @param {ASTNode} node - A node to check. + * @param {SourceCode} sourceCode - A SourceCode instance to get comments. + * @returns {boolean} Whether or not the node has a `@this` tag in its comments. + */ +function hasJSDocThisTag(node, sourceCode) { + const jsdocComment = sourceCode.getJSDocComment(node); + + if (jsdocComment && thisTagPattern.test(jsdocComment.value)) { + return true; + } + + // Checks `@this` in its leading comments for callbacks, + // because callbacks don't have its JSDoc comment. + // e.g. + // sinon.test(/* @this sinon.Sandbox */function() { this.spy(); }); + return sourceCode.getComments(node).leading.some(function(comment) { + return thisTagPattern.test(comment.value); + }); +} + +/** + * Determines if a node is surrounded by parentheses. + * @param {SourceCode} sourceCode The ESLint source code object + * @param {ASTNode} node The node to be checked. + * @returns {boolean} True if the node is parenthesised. + * @private + */ +function isParenthesised(sourceCode, node) { + const previousToken = sourceCode.getTokenBefore(node), + nextToken = sourceCode.getTokenAfter(node); + + return Boolean(previousToken && nextToken) && + previousToken.value === "(" && previousToken.range[1] <= node.range[0] && + nextToken.value === ")" && nextToken.range[0] >= node.range[1]; +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +module.exports = { + + /** + * Determines whether two adjacent tokens are on the same line. + * @param {Object} left - The left token object. + * @param {Object} right - The right token object. + * @returns {boolean} Whether or not the tokens are on the same line. + * @public + */ + isTokenOnSameLine(left, right) { + return left.loc.end.line === right.loc.start.line; + }, + + isNullOrUndefined, + isCallee, + isES5Constructor, + getUpperFunction, + isArrayFromMethod, + isParenthesised, + + /** + * Checks whether or not a given node is a string literal. + * @param {ASTNode} node - A node to check. + * @returns {boolean} `true` if the node is a string literal. + */ + isStringLiteral(node) { + return ( + (node.type === "Literal" && typeof node.value === "string") || + node.type === "TemplateLiteral" + ); + }, + + /** + * Checks whether a given node is a breakable statement or not. + * The node is breakable if the node is one of the following type: + * + * - DoWhileStatement + * - ForInStatement + * - ForOfStatement + * - ForStatement + * - SwitchStatement + * - WhileStatement + * + * @param {ASTNode} node - A node to check. + * @returns {boolean} `true` if the node is breakable. + */ + isBreakableStatement(node) { + return breakableTypePattern.test(node.type); + }, + + /** + * Gets the label if the parent node of a given node is a LabeledStatement. + * + * @param {ASTNode} node - A node to get. + * @returns {string|null} The label or `null`. + */ + getLabel(node) { + if (node.parent.type === "LabeledStatement") { + return node.parent.label.name; + } + return null; + }, + + /** + * Gets references which are non initializer and writable. + * @param {Reference[]} references - An array of references. + * @returns {Reference[]} An array of only references which are non initializer and writable. + * @public + */ + getModifyingReferences(references) { + return references.filter(isModifyingReference); + }, + + /** + * Validate that a string passed in is surrounded by the specified character + * @param {string} val The text to check. + * @param {string} character The character to see if it's surrounded by. + * @returns {boolean} True if the text is surrounded by the character, false if not. + * @private + */ + isSurroundedBy(val, character) { + return val[0] === character && val[val.length - 1] === character; + }, + + /** + * Returns whether the provided node is an ESLint directive comment or not + * @param {LineComment|BlockComment} node The node to be checked + * @returns {boolean} `true` if the node is an ESLint directive comment + */ + isDirectiveComment(node) { + const comment = node.value.trim(); + + return ( + node.type === "Line" && comment.indexOf("eslint-") === 0 || + node.type === "Block" && ( + comment.indexOf("global ") === 0 || + comment.indexOf("eslint ") === 0 || + comment.indexOf("eslint-") === 0 + ) + ); + }, + + /** + * Finds the variable by a given name in a given scope and its upper scopes. + * + * @param {escope.Scope} initScope - A scope to start find. + * @param {string} name - A variable name to find. + * @returns {escope.Variable|null} A found variable or `null`. + */ + getVariableByName(initScope, name) { + let scope = initScope; + + while (scope) { + const variable = scope.set.get(name); + + if (variable) { + return variable; + } + + scope = scope.upper; + } + + return null; + }, + + /** + * Checks whether or not a given function node is the default `this` binding. + * + * First, this checks the node: + * + * - The function name does not start with uppercase (it's a constructor). + * - The function does not have a JSDoc comment that has a @this tag. + * + * Next, this checks the location of the node. + * If the location is below, this judges `this` is valid. + * + * - The location is not on an object literal. + * - The location is not assigned to a variable which starts with an uppercase letter. + * - The location is not on an ES2015 class. + * - Its `bind`/`call`/`apply` method is not called directly. + * - The function is not a callback of array methods (such as `.forEach()`) if `thisArg` is given. + * + * @param {ASTNode} node - A function node to check. + * @param {SourceCode} sourceCode - A SourceCode instance to get comments. + * @returns {boolean} The function node is the default `this` binding. + */ + isDefaultThisBinding(node, sourceCode) { + if (isES5Constructor(node) || hasJSDocThisTag(node, sourceCode)) { + return false; + } + const isAnonymous = node.id === null; + + while (node) { + const parent = node.parent; + + switch (parent.type) { + + /* + * Looks up the destination. + * e.g., obj.foo = nativeFoo || function foo() { ... }; + */ + case "LogicalExpression": + case "ConditionalExpression": + node = parent; + break; + + // If the upper function is IIFE, checks the destination of the return value. + // e.g. + // obj.foo = (function() { + // // setup... + // return function foo() { ... }; + // })(); + case "ReturnStatement": { + const func = getUpperFunction(parent); + + if (func === null || !isCallee(func)) { + return true; + } + node = func.parent; + break; + } + + // e.g. + // var obj = { foo() { ... } }; + // var obj = { foo: function() { ... } }; + // class A { constructor() { ... } } + // class A { foo() { ... } } + // class A { get foo() { ... } } + // class A { set foo() { ... } } + // class A { static foo() { ... } } + case "Property": + case "MethodDefinition": + return parent.value !== node; + + // e.g. + // obj.foo = function foo() { ... }; + // Foo = function() { ... }; + // [obj.foo = function foo() { ... }] = a; + // [Foo = function() { ... }] = a; + case "AssignmentExpression": + case "AssignmentPattern": + if (parent.right === node) { + if (parent.left.type === "MemberExpression") { + return false; + } + if (isAnonymous && + parent.left.type === "Identifier" && + startsWithUpperCase(parent.left.name) + ) { + return false; + } + } + return true; + + // e.g. + // var Foo = function() { ... }; + case "VariableDeclarator": + return !( + isAnonymous && + parent.init === node && + parent.id.type === "Identifier" && + startsWithUpperCase(parent.id.name) + ); + + // e.g. + // var foo = function foo() { ... }.bind(obj); + // (function foo() { ... }).call(obj); + // (function foo() { ... }).apply(obj, []); + case "MemberExpression": + return ( + parent.object !== node || + parent.property.type !== "Identifier" || + !bindOrCallOrApplyPattern.test(parent.property.name) || + !isCallee(parent) || + parent.parent.arguments.length === 0 || + isNullOrUndefined(parent.parent.arguments[0]) + ); + + // e.g. + // Reflect.apply(function() {}, obj, []); + // Array.from([], function() {}, obj); + // list.forEach(function() {}, obj); + case "CallExpression": + if (isReflectApply(parent.callee)) { + return ( + parent.arguments.length !== 3 || + parent.arguments[0] !== node || + isNullOrUndefined(parent.arguments[1]) + ); + } + if (isArrayFromMethod(parent.callee)) { + return ( + parent.arguments.length !== 3 || + parent.arguments[1] !== node || + isNullOrUndefined(parent.arguments[2]) + ); + } + if (isMethodWhichHasThisArg(parent.callee)) { + return ( + parent.arguments.length !== 2 || + parent.arguments[0] !== node || + isNullOrUndefined(parent.arguments[1]) + ); + } + return true; + + // Otherwise `this` is default. + default: + return true; + } + } + + /* istanbul ignore next */ + return true; + }, + + /** + * Get the precedence level based on the node type + * @param {ASTNode} node node to evaluate + * @returns {int} precedence level + * @private + */ + getPrecedence(node) { + switch (node.type) { + case "SequenceExpression": + return 0; + + case "AssignmentExpression": + case "ArrowFunctionExpression": + case "YieldExpression": + return 1; + + case "ConditionalExpression": + return 3; + + case "LogicalExpression": + switch (node.operator) { + case "||": + return 4; + case "&&": + return 5; + + // no default + } + + /* falls through */ + + case "BinaryExpression": + + switch (node.operator) { + case "|": + return 6; + case "^": + return 7; + case "&": + return 8; + case "==": + case "!=": + case "===": + case "!==": + return 9; + case "<": + case "<=": + case ">": + case ">=": + case "in": + case "instanceof": + return 10; + case "<<": + case ">>": + case ">>>": + return 11; + case "+": + case "-": + return 12; + case "*": + case "/": + case "%": + return 13; + + // no default + } + + /* falls through */ + + case "UnaryExpression": + case "AwaitExpression": + return 14; + + case "UpdateExpression": + return 15; + + case "CallExpression": + + // IIFE is allowed to have parens in any position (#655) + if (node.callee.type === "FunctionExpression") { + return -1; + } + return 16; + + case "NewExpression": + return 17; + + // no default + } + return 18; + }, + + /** + * Checks whether a given node is a loop node or not. + * The following types are loop nodes: + * + * - DoWhileStatement + * - ForInStatement + * - ForOfStatement + * - ForStatement + * - WhileStatement + * + * @param {ASTNode|null} node - A node to check. + * @returns {boolean} `true` if the node is a loop node. + */ + isLoop(node) { + return Boolean(node && anyLoopPattern.test(node.type)); + }, + + /** + * Checks whether a given node is a function node or not. + * The following types are function nodes: + * + * - ArrowFunctionExpression + * - FunctionDeclaration + * - FunctionExpression + * + * @param {ASTNode|null} node - A node to check. + * @returns {boolean} `true` if the node is a function node. + */ + isFunction(node) { + return Boolean(node && anyFunctionPattern.test(node.type)); + }, + + /** + * Gets the property name of a given node. + * The node can be a MemberExpression, a Property, or a MethodDefinition. + * + * If the name is dynamic, this returns `null`. + * + * For examples: + * + * a.b // => "b" + * a["b"] // => "b" + * a['b'] // => "b" + * a[`b`] // => "b" + * a[100] // => "100" + * a[b] // => null + * a["a" + "b"] // => null + * a[tag`b`] // => null + * a[`${b}`] // => null + * + * let a = {b: 1} // => "b" + * let a = {["b"]: 1} // => "b" + * let a = {['b']: 1} // => "b" + * let a = {[`b`]: 1} // => "b" + * let a = {[100]: 1} // => "100" + * let a = {[b]: 1} // => null + * let a = {["a" + "b"]: 1} // => null + * let a = {[tag`b`]: 1} // => null + * let a = {[`${b}`]: 1} // => null + * + * @param {ASTNode} node - The node to get. + * @returns {string|null} The property name if static. Otherwise, null. + */ + getStaticPropertyName(node) { + let prop; + + switch (node && node.type) { + case "Property": + case "MethodDefinition": + prop = node.key; + break; + + case "MemberExpression": + prop = node.property; + break; + + // no default + } + + switch (prop && prop.type) { + case "Literal": + return String(prop.value); + + case "TemplateLiteral": + if (prop.expressions.length === 0 && prop.quasis.length === 1) { + return prop.quasis[0].value.cooked; + } + break; + + case "Identifier": + if (!node.computed) { + return prop.name; + } + break; + + // no default + } + + return null; + }, + + /** + * Get directives from directive prologue of a Program or Function node. + * @param {ASTNode} node - The node to check. + * @returns {ASTNode[]} The directives found in the directive prologue. + */ + getDirectivePrologue(node) { + const directives = []; + + // Directive prologues only occur at the top of files or functions. + if ( + node.type === "Program" || + node.type === "FunctionDeclaration" || + node.type === "FunctionExpression" || + + // Do not check arrow functions with implicit return. + // `() => "use strict";` returns the string `"use strict"`. + (node.type === "ArrowFunctionExpression" && node.body.type === "BlockStatement") + ) { + const statements = node.type === "Program" ? node.body : node.body.body; + + for (const statement of statements) { + if ( + statement.type === "ExpressionStatement" && + statement.expression.type === "Literal" + ) { + directives.push(statement); + } else { + break; + } + } + } + + return directives; + }, + + + /** + * Determines whether this node is a decimal integer literal. If a node is a decimal integer literal, a dot added + after the node will be parsed as a decimal point, rather than a property-access dot. + * @param {ASTNode} node - The node to check. + * @returns {boolean} `true` if this node is a decimal integer. + * @example + * + * 5 // true + * 5. // false + * 5.0 // false + * 05 // false + * 0x5 // false + * 0b101 // false + * 0o5 // false + * 5e0 // false + * '5' // false + */ + isDecimalInteger(node) { + return node.type === "Literal" && typeof node.value === "number" && /^(0|[1-9]\d*)$/.test(node.raw); + } +}; diff --git a/eslint/babel-eslint-plugin/index.js b/eslint/babel-eslint-plugin/index.js index 3656458f0b3a..efba7b74eb37 100644 --- a/eslint/babel-eslint-plugin/index.js +++ b/eslint/babel-eslint-plugin/index.js @@ -11,6 +11,7 @@ module.exports = { 'no-await-in-loop': require('./rules/no-await-in-loop'), 'flow-object-type': require('./rules/flow-object-type'), 'func-params-comma-dangle': require('./rules/func-params-comma-dangle'), + 'no-invalid-this': require('./rules/no-invalid-this'), }, rulesConfig: { 'generator-star-spacing': 0, @@ -22,5 +23,6 @@ module.exports = { 'no-await-in-loop': 0, 'flow-object-type': 0, 'func-params-comma-dangle': 0, + 'no-invalid-this': 0, } }; diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index 80cc7a38e0f7..69228e6099ff 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -29,6 +29,7 @@ "devDependencies": { "babel-eslint": "^6.1.0", "eslint": "^3.0.0", + "lodash.clonedeep": "^4.5.0", "mocha": "^3.0.0" } } diff --git a/eslint/babel-eslint-plugin/rules/no-invalid-this.js b/eslint/babel-eslint-plugin/rules/no-invalid-this.js new file mode 100644 index 000000000000..a8478a852f5b --- /dev/null +++ b/eslint/babel-eslint-plugin/rules/no-invalid-this.js @@ -0,0 +1,143 @@ +/** + * @fileoverview A rule to disallow `this` keywords outside of classes or class-like objects. + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("../ast-utils"); + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = { + meta: { + docs: { + description: "disallow `this` keywords outside of classes or class-like objects", + category: "Best Practices", + recommended: false + }, + + schema: [] + }, + + create(context) { + const stack = [], + sourceCode = context.getSourceCode(); + + let insideClassProperty = false; + + /** + * Gets the current checking context. + * + * The return value has a flag that whether or not `this` keyword is valid. + * The flag is initialized when got at the first time. + * + * @returns {{valid: boolean}} + * an object which has a flag that whether or not `this` keyword is valid. + */ + stack.getCurrent = function() { + const current = this[this.length - 1]; + + if (!current.init) { + current.init = true; + current.valid = !astUtils.isDefaultThisBinding( + current.node, + sourceCode); + } + return current; + }; + + /** + * `this` should be fair game anywhere inside a class property. + * + * @returns {void} + */ + function enterClassProperty() { + insideClassProperty = true; + } + + /** + * Back to the normal check. + * @returns {void} + */ + function exitClassProperty() { + insideClassProperty = false; + } + + /** + * Pushs new checking context into the stack. + * + * The checking context is not initialized yet. + * Because most functions don't have `this` keyword. + * When `this` keyword was found, the checking context is initialized. + * + * @param {ASTNode} node - A function node that was entered. + * @returns {void} + */ + function enterFunction(node) { + + // `this` can be invalid only under strict mode. + stack.push({ + init: !context.getScope().isStrict, + node, + valid: true + }); + } + + /** + * Pops the current checking context from the stack. + * @returns {void} + */ + function exitFunction() { + stack.pop(); + } + + return { + + /* + * `this` is invalid only under strict mode. + * Modules is always strict mode. + */ + Program(node) { + const scope = context.getScope(), + features = context.parserOptions.ecmaFeatures || {}; + + stack.push({ + init: true, + node, + valid: !( + scope.isStrict || + node.sourceType === "module" || + (features.globalReturn && scope.childScopes[0].isStrict) + ) + }); + }, + + "Program:exit"() { + stack.pop(); + }, + + ClassProperty: enterClassProperty, + "ClassProperty:exit": exitClassProperty, + FunctionDeclaration: enterFunction, + "FunctionDeclaration:exit": exitFunction, + FunctionExpression: enterFunction, + "FunctionExpression:exit": exitFunction, + + // Reports if `this` of the current context is invalid. + ThisExpression(node) { + const current = stack.getCurrent(); + + if (!insideClassProperty && current && !current.valid) { + context.report(node, "Unexpected 'this'."); + } + } + }; + } +}; diff --git a/eslint/babel-eslint-plugin/tests/rules/no-invalid-this.js b/eslint/babel-eslint-plugin/tests/rules/no-invalid-this.js new file mode 100644 index 000000000000..5e1c67c8b8ae --- /dev/null +++ b/eslint/babel-eslint-plugin/tests/rules/no-invalid-this.js @@ -0,0 +1,609 @@ +/** + * @fileoverview Tests for no-invalid-this rule. + * @author Toru Nagashima + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const cloneDeep = require("lodash.clonedeep"); +const rule = require("../../rules/no-invalid-this"); +const RuleTester = require("../RuleTester"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * A constant value for non strict mode environment. + * @returns {void} + */ +function NORMAL(pattern) { + pattern.parserOptions.sourceType = "script"; +} + +/** + * A constant value for strict mode environment. + * This modifies pattern object to make strict mode. + * @param {Object} pattern - A pattern object to modify. + * @returns {void} + */ +function USE_STRICT(pattern) { + pattern.code = "\"use strict\"; " + pattern.code; +} + +/** + * A constant value for implied strict mode. + * This modifies pattern object to impose strict mode. + * @param {Object} pattern - A pattern object to modify. + * @returns {void} + */ +function IMPLIED_STRICT(pattern) { + pattern.code = "/* implied strict mode */ " + pattern.code; + pattern.parserOptions.ecmaFeatures = pattern.parserOptions.ecmaFeatures || {}; + pattern.parserOptions.ecmaFeatures.impliedStrict = true; +} + +/** + * A constant value for modules environment. + * This modifies pattern object to make modules. + * @param {Object} pattern - A pattern object to modify. + * @returns {void} + */ +function MODULES(pattern) { + pattern.code = "/* modules */ " + pattern.code; +} + +/** + * Extracts patterns each condition for a specified type. The type is `valid` or `invalid`. + * @param {Object[]} patterns - Original patterns. + * @param {string} type - One of `"valid"` or `"invalid"`. + * @returns {Object[]} Test patterns. + */ +function extractPatterns(patterns, type) { + + // Clone and apply the pattern environment. + const patternsList = patterns.map(function(pattern) { + return pattern[type].map(function(applyCondition) { + const thisPattern = cloneDeep(pattern); + + applyCondition(thisPattern); + + if (type === "valid") { + thisPattern.errors = []; + } else { + thisPattern.code += " /* should error */"; + } + + return thisPattern; + }); + }); + + // Flatten. + return Array.prototype.concat.apply([], patternsList); +} + + +//------------------------------------------------------------------------------ +// Tests +//------------------------------------------------------------------------------ + +const errors = [ + {message: "Unexpected 'this'.", type: "ThisExpression"}, + {message: "Unexpected 'this'.", type: "ThisExpression"} +]; + +const patterns = [ + + // Global. + { + code: "console.log(this); z(x => console.log(x, this));", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT, MODULES] + }, + { + code: "console.log(this); z(x => console.log(x, this));", + parserOptions: { + ecmaVersion: 6, + ecmaFeatures: {globalReturn: true} + }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT, MODULES] + }, + + // IIFE. + { + code: "(function() { console.log(this); z(x => console.log(x, this)); })();", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT, MODULES] + }, + + // Just functions. + { + code: "function foo() { console.log(this); z(x => console.log(x, this)); }", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT, MODULES] + }, + { + code: "function foo() { \"use strict\"; console.log(this); z(x => console.log(x, this)); }", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [], + invalid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES] + }, + { + code: "return function() { console.log(this); z(x => console.log(x, this)); };", + parserOptions: { + ecmaVersion: 6, + ecmaFeatures: {globalReturn: true} + }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT] // modules cannot return on global. + }, + { + code: "var foo = (function() { console.log(this); z(x => console.log(x, this)); }).bar(obj);", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT, MODULES] + }, + + // Functions in methods. + { + code: "var obj = {foo: function() { function foo() { console.log(this); z(x => console.log(x, this)); } foo(); }};", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT, MODULES] + }, + { + code: "var obj = {foo() { function foo() { console.log(this); z(x => console.log(x, this)); } foo(); }};", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT, MODULES] + }, + { + code: "var obj = {foo: function() { return function() { console.log(this); z(x => console.log(x, this)); }; }};", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT, MODULES] + }, + { + code: "var obj = {foo: function() { \"use strict\"; return function() { console.log(this); z(x => console.log(x, this)); }; }};", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [], + invalid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES] + }, + { + code: "obj.foo = function() { return function() { console.log(this); z(x => console.log(x, this)); }; };", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT, MODULES] + }, + { + code: "obj.foo = function() { \"use strict\"; return function() { console.log(this); z(x => console.log(x, this)); }; };", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [], + invalid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES] + }, + { + code: "class A { foo() { return function() { console.log(this); z(x => console.log(x, this)); }; } }", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [], + invalid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES] + }, + + // Class Static methods. + { + code: "class A {static foo() { console.log(this); z(x => console.log(x, this)); }};", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + + // Constructors. + { + code: "function Foo() { console.log(this); z(x => console.log(x, this)); }", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + { + code: "var Foo = function Foo() { console.log(this); z(x => console.log(x, this)); };", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + { + code: "class A {constructor() { console.log(this); z(x => console.log(x, this)); }};", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + + // On a property. + { + code: "var obj = {foo: function() { console.log(this); z(x => console.log(x, this)); }};", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + { + code: "var obj = {foo() { console.log(this); z(x => console.log(x, this)); }};", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + { + code: "var obj = {foo: foo || function() { console.log(this); z(x => console.log(x, this)); }};", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + { + code: "var obj = {foo: hasNative ? foo : function() { console.log(this); z(x => console.log(x, this)); }};", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + { + code: "var obj = {foo: (function() { return function() { console.log(this); z(x => console.log(x, this)); }; })()};", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + { + code: "Object.defineProperty(obj, \"foo\", {value: function() { console.log(this); z(x => console.log(x, this)); }})", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + { + code: "Object.defineProperties(obj, {foo: {value: function() { console.log(this); z(x => console.log(x, this)); }}})", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + + // Assigns to a property. + { + code: "obj.foo = function() { console.log(this); z(x => console.log(x, this)); };", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + { + code: "obj.foo = foo || function() { console.log(this); z(x => console.log(x, this)); };", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + { + code: "obj.foo = foo ? bar : function() { console.log(this); z(x => console.log(x, this)); };", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + { + code: "obj.foo = (function() { return function() { console.log(this); z(x => console.log(x, this)); }; })();", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + + // Class Instance Methods. + { + code: "class A {foo() { console.log(this); z(x => console.log(x, this)); }};", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + + // Bind/Call/Apply + { + code: "var foo = function() { console.log(this); z(x => console.log(x, this)); }.bind(obj);", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + { + code: "var foo = function() { console.log(this); z(x => console.log(x, this)); }.bind(null);", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT, MODULES] + }, + { + code: "(function() { console.log(this); z(x => console.log(x, this)); }).call(obj);", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + { + code: "(function() { console.log(this); z(x => console.log(x, this)); }).call(undefined);", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT, MODULES] + }, + { + code: "(function() { console.log(this); z(x => console.log(x, this)); }).apply(obj);", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + { + code: "(function() { console.log(this); z(x => console.log(x, this)); }).apply(void 0);", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT, MODULES] + }, + { + code: "Reflect.apply(function() { console.log(this); z(x => console.log(x, this)); }, obj, []);", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + + // Array methods. + { + code: "Array.from([], function() { console.log(this); z(x => console.log(x, this)); });", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT, MODULES] + }, + { + code: "foo.every(function() { console.log(this); z(x => console.log(x, this)); });", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT, MODULES] + }, + { + code: "foo.filter(function() { console.log(this); z(x => console.log(x, this)); });", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT, MODULES] + }, + { + code: "foo.find(function() { console.log(this); z(x => console.log(x, this)); });", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT, MODULES] + }, + { + code: "foo.findIndex(function() { console.log(this); z(x => console.log(x, this)); });", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT, MODULES] + }, + { + code: "foo.forEach(function() { console.log(this); z(x => console.log(x, this)); });", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT, MODULES] + }, + { + code: "foo.map(function() { console.log(this); z(x => console.log(x, this)); });", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT, MODULES] + }, + { + code: "foo.some(function() { console.log(this); z(x => console.log(x, this)); });", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT, MODULES] + }, + { + code: "Array.from([], function() { console.log(this); z(x => console.log(x, this)); }, obj);", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + { + code: "foo.every(function() { console.log(this); z(x => console.log(x, this)); }, obj);", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + { + code: "foo.filter(function() { console.log(this); z(x => console.log(x, this)); }, obj);", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + { + code: "foo.find(function() { console.log(this); z(x => console.log(x, this)); }, obj);", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + { + code: "foo.findIndex(function() { console.log(this); z(x => console.log(x, this)); }, obj);", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + { + code: "foo.forEach(function() { console.log(this); z(x => console.log(x, this)); }, obj);", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + { + code: "foo.map(function() { console.log(this); z(x => console.log(x, this)); }, obj);", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + { + code: "foo.some(function() { console.log(this); z(x => console.log(x, this)); }, obj);", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + { + code: "foo.forEach(function() { console.log(this); z(x => console.log(x, this)); }, null);", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT, MODULES] + }, + + // @this tag. + { + code: "/** @this Obj */ function foo() { console.log(this); z(x => console.log(x, this)); }", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + { + code: "/**\n * @returns {void}\n * @this Obj\n */\nfunction foo() { console.log(this); z(x => console.log(x, this)); }", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + { + code: "/** @returns {void} */ function foo() { console.log(this); z(x => console.log(x, this)); }", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT, MODULES] + }, + { + code: "/** @this Obj */ foo(function() { console.log(this); z(x => console.log(x, this)); });", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT, MODULES] + }, + { + code: "foo(/* @this Obj */ function() { console.log(this); z(x => console.log(x, this)); });", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + + // https://github.com/eslint/eslint/issues/3254 + { + code: "function foo() { console.log(this); z(x => console.log(x, this)); }", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT, MODULES] + }, + + // https://github.com/eslint/eslint/issues/3287 + { + code: "function foo() { /** @this Obj*/ return function bar() { console.log(this); z(x => console.log(x, this)); }; }", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + + // https://github.com/eslint/eslint/issues/6824 + { + code: "var Ctor = function() { console.log(this); z(x => console.log(x, this)); }", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + { + code: "var func = function() { console.log(this); z(x => console.log(x, this)); }", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT, MODULES] + }, + { + code: "Ctor = function() { console.log(this); z(x => console.log(x, this)); }", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + { + code: "func = function() { console.log(this); z(x => console.log(x, this)); }", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT, MODULES] + }, + { + code: "function foo(Ctor = function() { console.log(this); z(x => console.log(x, this)); }) {}", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + { + code: "function foo(func = function() { console.log(this); z(x => console.log(x, this)); }) {}", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT, MODULES] + }, + { + code: "[obj.method = function() { console.log(this); z(x => console.log(x, this)); }] = a", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + { + code: "[func = function() { console.log(this); z(x => console.log(x, this)); }] = a", + parserOptions: { ecmaVersion: 6 }, + errors, + valid: [NORMAL], + invalid: [USE_STRICT, IMPLIED_STRICT, MODULES] + }, + + // babel/no-invalid-this + + // Class Instance Properties. + { + code: "class A {a = this.b;};", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + + { + code: "class A {a = () => {return this.b;};};", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, +]; + +const ruleTester = new RuleTester(); + +ruleTester.run("no-invalid-this", rule, { + valid: extractPatterns(patterns, "valid"), + invalid: extractPatterns(patterns, "invalid") +}); From c7d8d991a8024edf819969310077e9a01ff12077 Mon Sep 17 00:00:00 2001 From: Plusb Preco Date: Fri, 18 Nov 2016 05:21:46 +0900 Subject: [PATCH 514/569] Drop support of Node < 4 (babel/eslint-plugin-babel#113) * Drop support Node < 4 * Add missing changes * Update `.travis.yml` --- eslint/babel-eslint-plugin/.travis.yml | 2 -- eslint/babel-eslint-plugin/package.json | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/eslint/babel-eslint-plugin/.travis.yml b/eslint/babel-eslint-plugin/.travis.yml index 2d156dd6d5e0..a3fd2dd36664 100644 --- a/eslint/babel-eslint-plugin/.travis.yml +++ b/eslint/babel-eslint-plugin/.travis.yml @@ -4,8 +4,6 @@ git: sudo: false language: node_js node_js: - - '0.10' - - '0.12' - '4' - '5' - '6' diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index 69228e6099ff..8950f6bf05e8 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -19,12 +19,15 @@ ], "author": "Jason Quense @monasticpanic", "license": "MIT", + "engines": { + "node": ">=4" + }, "bugs": { "url": "https://github.com/babel/eslint-plugin-babel/issues" }, "homepage": "https://github.com/babel/eslint-plugin-babel#readme", "peerDependencies": { - "eslint": ">=1.0.0" + "eslint": ">=3.0.0" }, "devDependencies": { "babel-eslint": "^6.1.0", From 5b5f8e32a0418982e1c930780fbfebcd087d3a51 Mon Sep 17 00:00:00 2001 From: Mathieu M-Gosselin Date: Thu, 17 Nov 2016 15:23:23 -0500 Subject: [PATCH 515/569] Updated Node versions to test against in the Travis configuration. (babel/eslint-plugin-babel#110) --- eslint/babel-eslint-plugin/.travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/.travis.yml b/eslint/babel-eslint-plugin/.travis.yml index a3fd2dd36664..6dbd2e233605 100644 --- a/eslint/babel-eslint-plugin/.travis.yml +++ b/eslint/babel-eslint-plugin/.travis.yml @@ -5,5 +5,5 @@ sudo: false language: node_js node_js: - '4' - - '5' - '6' + - '7' From 48010c551bf50db3c9e5513dbc9bbcbad82376d8 Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Thu, 17 Nov 2016 15:23:38 -0500 Subject: [PATCH 516/569] chore(package): update dependencies (babel/eslint-plugin-babel#109) https://greenkeeper.io/ --- eslint/babel-eslint-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index 8950f6bf05e8..f372bd09cf1c 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -30,7 +30,7 @@ "eslint": ">=3.0.0" }, "devDependencies": { - "babel-eslint": "^6.1.0", + "babel-eslint": "^7.1.0", "eslint": "^3.0.0", "lodash.clonedeep": "^4.5.0", "mocha": "^3.0.0" From d38551cc23292f30cef5d61c6eef95510205684f Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 17 Nov 2016 16:39:04 -0500 Subject: [PATCH 517/569] Breaking: Deprecate built-in rules (babel/eslint-plugin-babel#115) * Deprecate built-in rules * fix update to babel-eslint 7 with awaitexpression * deprecate flow-object-type --- eslint/babel-eslint-plugin/README.md | 22 +- .../rules/array-bracket-spacing.js | 205 +-- .../babel-eslint-plugin/rules/arrow-parens.js | 70 +- .../rules/flow-object-type.js | 57 +- .../rules/func-params-comma-dangle.js | 139 +- .../rules/generator-star-spacing.js | 97 +- .../rules/no-await-in-loop.js | 74 +- .../rules/object-shorthand.js | 82 +- .../tests/rules/array-bracket-spacing.js | 733 ---------- .../tests/rules/arrow-parens.js | 187 --- .../tests/rules/flow-object-type.js | 69 - .../tests/rules/func-params-comma-dangle.js | 278 ---- .../tests/rules/generator-star-spacing.js | 1176 ----------------- .../tests/rules/object-shorthand.js | 108 -- 14 files changed, 122 insertions(+), 3175 deletions(-) delete mode 100644 eslint/babel-eslint-plugin/tests/rules/array-bracket-spacing.js delete mode 100644 eslint/babel-eslint-plugin/tests/rules/arrow-parens.js delete mode 100644 eslint/babel-eslint-plugin/tests/rules/flow-object-type.js delete mode 100644 eslint/babel-eslint-plugin/tests/rules/func-params-comma-dangle.js delete mode 100644 eslint/babel-eslint-plugin/tests/rules/generator-star-spacing.js delete mode 100644 eslint/babel-eslint-plugin/tests/rules/object-shorthand.js diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md index 171a4083fa5c..5a84afbabe8f 100644 --- a/eslint/babel-eslint-plugin/README.md +++ b/eslint/babel-eslint-plugin/README.md @@ -26,15 +26,10 @@ original ones as well!). ```json { "rules": { - "babel/generator-star-spacing": 1, "babel/new-cap": 1, - "babel/array-bracket-spacing": 1, "babel/object-curly-spacing": 1, - "babel/object-shorthand": 1, - "babel/arrow-parens": 1, "babel/no-await-in-loop": 1, "babel/flow-object-type": 1, - "babel/func-params-comma-dangle": 1, "babel/no-invalid-this": 1 } } @@ -45,19 +40,20 @@ Each rule corresponds to a core `eslint` rule, and has the same options. 🛠 : means it's autofixable with `--fix`. -- `babel/generator-star-spacing`: Handles async/await functions correctly - `babel/new-cap`: Ignores capitalized decorators (`@Decorator`) -- `babel/array-bracket-spacing`: Handles destructuring arrays with flow type in function parameters (🛠 ) - `babel/object-curly-spacing`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` (🛠 ) -- `babel/object-shorthand`: doesn't fail when using object spread (`...obj`) -- `babel/arrow-parens`: Handles async functions correctly (🛠 ) - `babel/no-invalid-this`: doesn't fail when inside class properties (`class A { a = this.b; }`) The following rules are not in `eslint`, but are relevant only to syntax that is not specified by the current JavaScript standard or supported by `eslint`. - `babel/no-await-in-loop`: guard against awaiting async functions inside of a loop -- `babel/flow-object-type`: Require a particular separator between properties in Flow object types. (🛠 ) - - Use the option `semicolon` to require semicolons (e.g. `type Foo = { bar: number; baz: string }`). - - Use the option `comma` to require commas (e.g. `type Foo = { bar: number, baz: string }`). -- `babel/func-params-comma-dangle`: Require or forbid trailing commas for function paramater lists. Behaves like, and takes the same options as, `eslint`'s [`comma-dangle`](http://eslint.org/docs/rules/comma-dangle). (🛠 ) + +#### Deprecated + +- `babel/generator-star-spacing`: Use [`generator-star-spacing`](http://eslint.org/docs/rules/generator-star-spacing). +- `babel/object-shorthand`: Use [`object-shorthand`](http://eslint.org/docs/rules/object-shorthand). +- `babel/arrow-parens`: Use [`arrow-parens`](http://eslint.org/docs/rules/arrow-parens). +- `babel/func-params-comma-dangle`: Use [`comma-dangle`](http://eslint.org/docs/rules/comma-dangle). +- `babel/array-bracket-spacing`: Use [`array-bracket-spacing`](http://eslint.org/docs/rules/array-bracket-spacing). +- `babel/flow-object-type`: Use [`flowtype/object-type-delimiter`](https://github.com/gajus/eslint-plugin-flowtype#eslint-plugin-flowtype-rules-object-type-delimiter). diff --git a/eslint/babel-eslint-plugin/rules/array-bracket-spacing.js b/eslint/babel-eslint-plugin/rules/array-bracket-spacing.js index b67fbe92fbce..a7da50b78573 100644 --- a/eslint/babel-eslint-plugin/rules/array-bracket-spacing.js +++ b/eslint/babel-eslint-plugin/rules/array-bracket-spacing.js @@ -1,203 +1,20 @@ -/** - * @fileoverview Disallows or enforces spaces inside of array brackets. - * @author Jamund Ferguson - * @copyright 2015 Jamund Ferguson. All rights reserved. - * @copyright 2014 Brandyn Bennett. All rights reserved. - * @copyright 2014 Michael Ficarra. No rights reserved. - * @copyright 2014 Vignesh Anand. All rights reserved. - */ "use strict"; -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -module.exports = function(context) { - var spaced = context.options[0] === "always", - sourceCode = context.getSourceCode(); - - /** - * Determines whether an option is set, relative to the spacing option. - * If spaced is "always", then check whether option is set to false. - * If spaced is "never", then check whether option is set to true. - * @param {Object} option - The option to exclude. - * @returns {boolean} Whether or not the property is excluded. - */ - function isOptionSet(option) { - return context.options[1] ? context.options[1][option] === !spaced : false; - } - - var options = { - spaced: spaced, - singleElementException: isOptionSet("singleValue"), - objectsInArraysException: isOptionSet("objectsInArrays"), - arraysInArraysException: isOptionSet("arraysInArrays") - }; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Determines whether two adjacent tokens are on the same line. - * @param {Object} left - The left token object. - * @param {Object} right - The right token object. - * @returns {boolean} Whether or not the tokens are on the same line. - */ - function isSameLine(left, right) { - return left.loc.start.line === right.loc.start.line; - } - - /** - * Reports that there shouldn't be a space after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @returns {void} - */ - function reportNoBeginningSpace(node, token) { - context.report({ - node: node, - loc: token.loc.start, - message: "There should be no space after '" + token.value + "'", - fix: function(fixer) { - var nextToken = sourceCode.getTokenAfter(token); - return fixer.removeRange([token.range[1], nextToken.range[0]]); - } - }); - } - - /** - * Reports that there shouldn't be a space before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @returns {void} - */ - function reportNoEndingSpace(node, token) { - context.report({ - node: node, - loc: token.loc.start, - message: "There should be no space before '" + token.value + "'", - fix: function(fixer) { - var previousToken = sourceCode.getTokenBefore(token); - return fixer.removeRange([previousToken.range[1], token.range[0]]); - } - }); - } - - /** - * Reports that there should be a space after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @returns {void} - */ - function reportRequiredBeginningSpace(node, token) { - context.report({ - node: node, - loc: token.loc.start, - message: "A space is required after '" + token.value + "'", - fix: function(fixer) { - return fixer.insertTextAfter(token, " "); - } - }); - } - - /** - * Reports that there should be a space before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @returns {void} - */ - function reportRequiredEndingSpace(node, token) { - context.report({ - node: node, - loc: token.loc.start, - message: "A space is required before '" + token.value + "'", - fix: function(fixer) { - return fixer.insertTextBefore(token, " "); - } - }); - } - - /** - * Determines if a node is an object type - * @param {ASTNode} node - The node to check. - * @returns {boolean} Whether or not the node is an object type. - */ - function isObjectType(node) { - return node && (node.type === "ObjectExpression" || node.type === "ObjectPattern"); - } - - /** - * Determines if a node is an array type - * @param {ASTNode} node - The node to check. - * @returns {boolean} Whether or not the node is an array type. - */ - function isArrayType(node) { - return node && (node.type === "ArrayExpression" || node.type === "ArrayPattern"); - } - - /** - * Validates the spacing around array brackets - * @param {ASTNode} node - The node we're checking for spacing - * @returns {void} - */ - function validateArraySpacing(node) { - if (options.spaced && node.elements.length === 0) { - return; - } - - var first = sourceCode.getFirstToken(node), - second = sourceCode.getFirstToken(node, 1), - last = sourceCode.getLastToken(node), - firstElement = node.elements[0], - lastElement = node.elements[node.elements.length - 1]; - - while (last.type !== "Punctuation" && last.value !== "]") { - last = sourceCode.getTokenBefore(last); - } - - var penultimate = sourceCode.getTokenBefore(last); - - var openingBracketMustBeSpaced = - options.objectsInArraysException && isObjectType(firstElement) || - options.arraysInArraysException && isArrayType(firstElement) || - options.singleElementException && node.elements.length === 1 - ? !options.spaced : options.spaced; - - var closingBracketMustBeSpaced = - options.objectsInArraysException && isObjectType(lastElement) || - options.arraysInArraysException && isArrayType(lastElement) || - options.singleElementException && node.elements.length === 1 - ? !options.spaced : options.spaced; - - if (isSameLine(first, second)) { - if (openingBracketMustBeSpaced && !sourceCode.isSpaceBetweenTokens(first, second)) { - reportRequiredBeginningSpace(node, first); - } - if (!openingBracketMustBeSpaced && sourceCode.isSpaceBetweenTokens(first, second)) { - reportNoBeginningSpace(node, first); +var isWarnedForDeprecation = false; +module.exports = function() { + return { + Program() { + if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { + return; } - } - if (first !== penultimate && isSameLine(penultimate, last)) { - if (closingBracketMustBeSpaced && !sourceCode.isSpaceBetweenTokens(penultimate, last)) { - reportRequiredEndingSpace(node, last); - } - if (!closingBracketMustBeSpaced && sourceCode.isSpaceBetweenTokens(penultimate, last)) { - reportNoEndingSpace(node, last); - } + /* eslint-disable no-console */ + console.log('The babel/array-bracket-spacing rule is deprecated. Please ' + + 'use the built in array-bracket-spacing rule instead.'); + /* eslint-enable no-console */ + isWarnedForDeprecation = true; } - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - ArrayPattern: validateArraySpacing, - ArrayExpression: validateArraySpacing }; - }; module.exports.schema = [ diff --git a/eslint/babel-eslint-plugin/rules/arrow-parens.js b/eslint/babel-eslint-plugin/rules/arrow-parens.js index 6ca3ffc776bf..03f50dcfd07c 100644 --- a/eslint/babel-eslint-plugin/rules/arrow-parens.js +++ b/eslint/babel-eslint-plugin/rules/arrow-parens.js @@ -1,67 +1,19 @@ -/** - * @fileoverview Rule to require parens in arrow function arguments. - * @author Jxck - * @copyright 2015 Jxck. All rights reserved. - */ "use strict"; -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -module.exports = function(context) { - var message = "Expected parentheses around arrow function argument."; - var asNeededMessage = "Unexpected parentheses around single function argument"; - var asNeeded = context.options[0] === "as-needed"; - - /** - * Determines whether a arrow function argument end with `)` - * @param {ASTNode} node The arrow function node. - * @returns {void} - */ - function parens(node) { - var token = context.getFirstToken(node); - if (node.async) token = context.getTokenAfter(token); - - // as-needed: x => x - if (asNeeded && node.params.length === 1 - && node.params[0].type === "Identifier" - && node.params[0].typeAnnotation === undefined) { - if (token.type === "Punctuator" && token.value === "(") { - context.report({ - node: node, - message: asNeededMessage, - fix: function(fixer) { - var paramToken = context.getTokenAfter(token); - var closingParenToken = context.getTokenAfter(paramToken); - return fixer.replaceTextRange([ - token.range[0], - closingParenToken.range[1] - ], paramToken.value); - } - }); +var isWarnedForDeprecation = false; +module.exports = function() { + return { + Program() { + if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { + return; } - return; - } - if (token.type === "Identifier") { - var after = context.getTokenAfter(token); - - // (x) => x - if (after.value !== ")") { - context.report({ - node: node, - message: message, - fix: function(fixer) { - return fixer.replaceText(token, '(' + token.value + ')'); - } - }); - } + /* eslint-disable no-console */ + console.log('The babel/arrow-parens rule is deprecated. Please ' + + 'use the built in arrow-parens rule instead.'); + /* eslint-enable no-console */ + isWarnedForDeprecation = true; } - } - - return { - "ArrowFunctionExpression": parens }; }; diff --git a/eslint/babel-eslint-plugin/rules/flow-object-type.js b/eslint/babel-eslint-plugin/rules/flow-object-type.js index f452832d6bf4..530efb8d653d 100644 --- a/eslint/babel-eslint-plugin/rules/flow-object-type.js +++ b/eslint/babel-eslint-plugin/rules/flow-object-type.js @@ -1,48 +1,21 @@ -/** - * @fileoverview Enforces a choice between semicolons and commas in Flow object and class types. - * @author Nat Mote - */ "use strict"; -var SEMICOLON = { - char: ';', - name: 'semicolon', -} +var isWarnedForDeprecation = false; +module.exports = function() { + return { + Program() { + if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { + return; + } -var COMMA = { - char: ',', - name: 'comma', -}; - -module.exports = function(context) { - var GOOD; - var BAD; - if (context.options[0] === undefined || context.options[0] === SEMICOLON.name) { - GOOD = SEMICOLON; - BAD = COMMA; - } else { - GOOD = COMMA; - BAD = SEMICOLON; - } - function requireProperPunctuation(node) { - var tokens = context.getSourceCode().getTokens(node); - var lastToken = tokens[tokens.length - 1]; - if (lastToken.type === 'Punctuator') { - if (lastToken.value === BAD.char) { - context.report({ - message: 'Prefer ' + GOOD.name + 's to ' + BAD.name + 's in object and class types', - node: lastToken, - fix: function(fixer) { - return fixer.replaceText(lastToken, GOOD.char); - }, - }); - } - } - } - - return { - ObjectTypeProperty: requireProperPunctuation, - }; + /* eslint-disable no-console */ + console.log('The babel/flow-object-type rule is deprecated. Please ' + + 'use the flowtype/object-type-delimiter rule instead.\n' + + 'Check out https://github.com/gajus/eslint-plugin-flowtype#eslint-plugin-flowtype-rules-object-type-delimiter'); + /* eslint-enable no-console */ + isWarnedForDeprecation = true; + } + }; }; module.exports.schema = [ diff --git a/eslint/babel-eslint-plugin/rules/func-params-comma-dangle.js b/eslint/babel-eslint-plugin/rules/func-params-comma-dangle.js index d750323d392a..bf5c1eee5c3d 100644 --- a/eslint/babel-eslint-plugin/rules/func-params-comma-dangle.js +++ b/eslint/babel-eslint-plugin/rules/func-params-comma-dangle.js @@ -1,135 +1,22 @@ 'use strict'; -// Based on https://github.com/eslint/eslint/blob/v2.11.1/lib/rules/comma-dangle.js - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -function last(arr) { - return arr.length !== 0 ? arr[arr.length - 1] : undefined; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -module.exports = function(context) { - var mode = context.options[0]; - var UNEXPECTED_MESSAGE = 'Unexpected trailing comma.'; - var MISSING_MESSAGE = 'Missing trailing comma.'; - - function isMultiline(node) { - var lastItem = last(node.params || node.arguments); - - if (!lastItem) { - return false; - } - - var sourceCode = context.getSourceCode(); - var penultimateToken = sourceCode.getLastToken(lastItem); - var lastToken = sourceCode.getTokenAfter(penultimateToken); - - if (lastToken.value === ',') { - penultimateToken = lastToken; - lastToken = sourceCode.getTokenAfter(lastToken); - } - - return lastToken.loc.end.line !== penultimateToken.loc.end.line; - } - - function forbidTrailingComma(node) { - var lastItem = last(node.params || node.arguments); - - if (!lastItem) { - return; - } - - var sourceCode = context.getSourceCode(); - var trailingToken = sourceCode.getTokenAfter(lastItem); - - if (trailingToken.value === ',') { - context.report({ - node: lastItem, - loc: trailingToken.loc.start, - message: UNEXPECTED_MESSAGE, - fix: function(fixer) { - return fixer.remove(trailingToken); - } - }); - } - } - - function forceTrailingComma(node) { - var lastItem = last(node.params || node.arguments); - - if (!lastItem) { - return; - } - - // `f(...a,)` is ok, but `function f(...a,) {}` is invalid syntax. - if (lastItem.type === 'RestElement') { - return; - } - - var sourceCode = context.getSourceCode(); - var penultimateToken = lastItem; - var trailingToken = sourceCode.getTokenAfter(lastItem); - - // `f = a, => {}` is invalid syntax. - if (node.type === 'ArrowFunctionExpression' && - node.params.length === 1 && - sourceCode.getTokenBefore(lastItem).value !== '(') { - return; - } - - if (trailingToken.value !== ',') { - context.report({ - node: lastItem, - loc: lastItem.loc.end, - message: MISSING_MESSAGE, - fix: function(fixer) { - return fixer.insertTextAfter(penultimateToken, ','); - } - }); - } - } - - function forceTrailingCommaIfMultiline(node) { - if (isMultiline(node)) { - forceTrailingComma(node); - } else { - forbidTrailingComma(node); - } - } - - function allowTrailingCommaIfMultiline(node) { - if (!isMultiline(node)) { - forbidTrailingComma(node); - } - } - - var checkForTrailingComma; - if (mode === 'always') { - checkForTrailingComma = forceTrailingComma; - } else if (mode === 'always-multiline') { - checkForTrailingComma = forceTrailingCommaIfMultiline; - } else if (mode === 'only-multiline') { - checkForTrailingComma = allowTrailingCommaIfMultiline; - } else { - checkForTrailingComma = forbidTrailingComma; - } - +var isWarnedForDeprecation = false; +module.exports = function() { return { - ArrowFunctionExpression: checkForTrailingComma, - FunctionDeclaration: checkForTrailingComma, - FunctionExpression: checkForTrailingComma, - CallExpression: checkForTrailingComma, - NewExpression: checkForTrailingComma, + Program() { + if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { + return; + } + + /* eslint-disable no-console */ + console.log('The babel/func-params-comma-dangle rule is deprecated. Please ' + + 'use the built in comma-dangle rule instead.'); + /* eslint-enable no-console */ + isWarnedForDeprecation = true; + } }; }; -module.exports.fixable = 'code'; module.exports.schema = [ { enum: ['always', 'always-multiline', 'only-multiline', 'never'] diff --git a/eslint/babel-eslint-plugin/rules/generator-star-spacing.js b/eslint/babel-eslint-plugin/rules/generator-star-spacing.js index 416efff8e2e1..38d586c6e365 100644 --- a/eslint/babel-eslint-plugin/rules/generator-star-spacing.js +++ b/eslint/babel-eslint-plugin/rules/generator-star-spacing.js @@ -1,93 +1,20 @@ -/** - * @fileoverview Rule to check the spacing around the * in generator functions. - * @author Jamund Ferguson - * @copyright 2015 Brandon Mills. All rights reserved. - * @copyright 2014 Jamund Ferguson. All rights reserved. - */ - "use strict"; -module.exports = function(context) { - - var mode = (function(option) { - if (option == null || typeof option === "string") { - return { - before: { before: true, after: false }, - after: { before: false, after: true }, - both: { before: true, after: true }, - neither: { before: false, after: false } - }[option || "before"]; - } - return option; - }(context.options[0])); - - function isAsyncGenerator(node){ - return context.getFirstToken(node, 2).value === '*' - } - - /** - * Checks the spacing between two tokens before or after the star token. - * @param {string} side Either "before" or "after". - * @param {Token} leftToken `function` keyword token if side is "before", or - * star token if side is "after". - * @param {Token} rightToken Star token if side is "before", or identifier - * token if side is "after". - * @returns {void} - */ - function checkSpacing(side, leftToken, rightToken) { - if (!!(rightToken.range[0] - leftToken.range[1]) !== mode[side]) { - context.report( - leftToken.value === "*" ? leftToken : rightToken, - "{{type}} space {{side}} *.", - { - type: mode[side] ? "Missing" : "Unexpected", - side: side - } - ); - } - } - - /** - * Enforces the spacing around the star if node is a generator function. - * @param {ASTNode} node A function expression or declaration node. - * @returns {void} - */ - function checkFunction(node) { - var first = context.getFirstToken(node) - , isMethod = node.parent.method || node.parent.type === "MethodDefinition" - , isAsync = first.value === 'async'; - - var prevToken, starToken, nextToken; - - - if ( !node.generator || (isAsync && !isAsyncGenerator(node))) { - return; - } - - if (isMethod) { - starToken = context.getTokenBefore(node, 1); - } else { - starToken = context.getFirstToken(node, isAsync ? 2 : 1); - } - - // Only check before when preceded by `function` keyword - prevToken = context.getTokenBefore(starToken); - if (prevToken.value === "function" || prevToken.value === "static") { - checkSpacing("before", prevToken, starToken); - } +var isWarnedForDeprecation = false; +module.exports = function() { + return { + Program() { + if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { + return; + } - // Only check after when followed by an identifier - nextToken = context.getTokenAfter(starToken); - if (nextToken.type === "Identifier") { - checkSpacing("after", starToken, nextToken); + /* eslint-disable no-console */ + console.log('The babel/generator-star-spacing rule is deprecated. Please ' + + 'use the built in generator-star-spacing rule instead.'); + /* eslint-enable no-console */ + isWarnedForDeprecation = true; } - } - - return { - "FunctionDeclaration": checkFunction, - "FunctionExpression": checkFunction }; - }; module.exports.schema = [ diff --git a/eslint/babel-eslint-plugin/rules/no-await-in-loop.js b/eslint/babel-eslint-plugin/rules/no-await-in-loop.js index cc3bb91af4f0..037f29be74c9 100644 --- a/eslint/babel-eslint-plugin/rules/no-await-in-loop.js +++ b/eslint/babel-eslint-plugin/rules/no-await-in-loop.js @@ -23,48 +23,44 @@ var boundaryTypes = { module.exports = function(context) { return { - // babel-eslint transpiles AwaitExpressions to YieldExpressions, but the actual node kind is - // still available in _babelType. - YieldExpression: function(node) { - if (node._babelType === 'AwaitExpression') { - var ancestors = context.getAncestors(); - // Reverse so that we can traverse from the deepest node upwards. - ancestors.reverse(); - // Create a set of all the ancestors plus this node so that we can check - // if this use of await appears in the body of the loop as opposed to - // the right-hand side of a for...of, for example. - // - // Implement the set with an Array since there are likely to be very few - // elements. An Object would not be appropriate since the elements are - // not strings. - var ancestorSet = [].concat(ancestors, [node]); - var ancestorSetHas = function(element) { - return ancestorSet.indexOf(element) !== -1; + AwaitExpression(node) { + var ancestors = context.getAncestors(); + // Reverse so that we can traverse from the deepest node upwards. + ancestors.reverse(); + // Create a set of all the ancestors plus this node so that we can check + // if this use of await appears in the body of the loop as opposed to + // the right-hand side of a for...of, for example. + // + // Implement the set with an Array since there are likely to be very few + // elements. An Object would not be appropriate since the elements are + // not strings. + var ancestorSet = [].concat(ancestors, [node]); + var ancestorSetHas = function(element) { + return ancestorSet.indexOf(element) !== -1; + } + for (var i = 0; i < ancestors.length; i++) { + var ancestor = ancestors[i]; + if (boundaryTypes.hasOwnProperty(ancestor.type)) { + // Short-circuit out if we encounter a boundary type. Loops above + // this do not matter. + return; } - for (var i = 0; i < ancestors.length; i++) { - var ancestor = ancestors[i]; - if (boundaryTypes.hasOwnProperty(ancestor.type)) { - // Short-circuit out if we encounter a boundary type. Loops above - // this do not matter. + if (loopTypes.hasOwnProperty(ancestor.type)) { + // Only report if we are actually in the body or another part that gets executed on + // every iteration. + if ( + ancestorSetHas(ancestor.body) || + ancestorSetHas(ancestor.test) || + ancestorSetHas(ancestor.update) + ) { + context.report( + node, + 'Avoid using await inside a loop. Consider refactoring to use Promise.all. If ' + + 'you are sure you want to do this, add `// eslint-disable-line ' + + context.id + '` at the end of this line.' + ); return; } - if (loopTypes.hasOwnProperty(ancestor.type)) { - // Only report if we are actually in the body or another part that gets executed on - // every iteration. - if ( - ancestorSetHas(ancestor.body) || - ancestorSetHas(ancestor.test) || - ancestorSetHas(ancestor.update) - ) { - context.report( - node, - 'Avoid using await inside a loop. Consider refactoring to use Promise.all. If ' + - 'you are sure you want to do this, add `// eslint-disable-line ' + - context.id + '` at the end of this line.' - ); - return; - } - } } } }, diff --git a/eslint/babel-eslint-plugin/rules/object-shorthand.js b/eslint/babel-eslint-plugin/rules/object-shorthand.js index 4bed9e832164..eaf24a1803ed 100644 --- a/eslint/babel-eslint-plugin/rules/object-shorthand.js +++ b/eslint/babel-eslint-plugin/rules/object-shorthand.js @@ -1,70 +1,20 @@ - -/** - * @fileoverview Rule to enforce concise object methods and properties. - * @author Jamund Ferguson - * @copyright 2015 Jamund Ferguson. All rights reserved. - */ - -'use strict'; - -var OPTIONS = { - always: 'always', - never: 'never', - methods: 'methods', - properties: 'properties' +"use strict"; + +var isWarnedForDeprecation = false; +module.exports = function() { + return { + Program() { + if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { + return; + } + + /* eslint-disable no-console */ + console.log('The babel/object-shorthand rule is deprecated. Please ' + + 'use the built in object-shorthand rule instead.'); + /* eslint-enable no-console */ + isWarnedForDeprecation = true; + } }; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -module.exports = function(context) { - - var APPLY = context.options[0] || OPTIONS.always; - var APPLY_TO_METHODS = APPLY === OPTIONS.methods || APPLY === OPTIONS.always; - var APPLY_TO_PROPS = APPLY === OPTIONS.properties || APPLY === OPTIONS.always; - var APPLY_NEVER = APPLY === OPTIONS.never; - - return { - Property: function(node) { - var isConciseProperty = node.method || node.shorthand - , isSpreadProperty = !!this.getSource(node).match(/^\.\.\./) - , type; - - // if we're 'never' and concise we should warn now - if (APPLY_NEVER && isConciseProperty) { - type = node.method ? 'method' : 'property'; - context.report(node, 'Expected longform ' + type + ' syntax.'); - } - - // at this point if we're concise or if we're 'never' we can leave - if (APPLY_NEVER || isConciseProperty) { - return; - } - - // getters, setters and computed properties are ignored - if (node.kind === "get" || node.kind === "set" || node.computed) { - return; - } - - if (isSpreadProperty) { - return; - } - - if (node.value.type === 'FunctionExpression' && node.value.id == null && APPLY_TO_METHODS) { - // {x: function(){}} should be written as {x() {}} - context.report(node, 'Expected method shorthand.'); - } - else if (node.value.type === 'Identifier' && node.key.name === node.value.name && APPLY_TO_PROPS) { - // {x: x} should be written as {x} - context.report(node, 'Expected property shorthand.'); - } - else if (node.value.type === 'Identifier' && node.key.type === 'Literal' && node.key.value === node.value.name && APPLY_TO_PROPS) { - // {'x': x} should be written as {x} - context.report(node, 'Expected property shorthand.'); - } - } - }; }; module.exports.schema = [ diff --git a/eslint/babel-eslint-plugin/tests/rules/array-bracket-spacing.js b/eslint/babel-eslint-plugin/tests/rules/array-bracket-spacing.js deleted file mode 100644 index ea5aa2f45875..000000000000 --- a/eslint/babel-eslint-plugin/tests/rules/array-bracket-spacing.js +++ /dev/null @@ -1,733 +0,0 @@ -/** - * @fileoverview Disallows or enforces spaces inside of brackets. - * @author Ian Christian Myers - * @copyright 2014 Vignesh Anand. All rights reserved. - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -var rule = require('../../rules/array-bracket-spacing'), - RuleTester = require('../RuleTester'); - -//------------------------------------------------------------------------------ -// Tests -//------------------------------------------------------------------------------ - -var ruleTester = new RuleTester(); -ruleTester.run("array-bracket-spacing", rule, { - - valid: [ - { code: "var foo = obj[ 1 ]", options: ["always"] }, - { code: "var foo = obj[ 'foo' ];", options: ["always"] }, - { code: "var foo = obj[ [ 1, 1 ] ];", options: ["always"] }, - - // always - singleValue - { code: "var foo = ['foo']", options: ["always", {singleValue: false}] }, - { code: "var foo = [2]", options: ["always", {singleValue: false}] }, - { code: "var foo = [[ 1, 1 ]]", options: ["always", {singleValue: false}] }, - { code: "var foo = [{ 'foo': 'bar' }]", options: ["always", {singleValue: false}] }, - { code: "var foo = [bar]", options: ["always", {singleValue: false}] }, - - // always - objectsInArrays - { code: "var foo = [{ 'bar': 'baz' }, 1, 5 ];", options: ["always", {objectsInArrays: false}] }, - { code: "var foo = [ 1, 5, { 'bar': 'baz' }];", options: ["always", {objectsInArrays: false}] }, - { code: "var foo = [{\n'bar': 'baz', \n'qux': [{ 'bar': 'baz' }], \n'quxx': 1 \n}]", options: ["always", {objectsInArrays: false}] }, - { code: "var foo = [{ 'bar': 'baz' }]", options: ["always", {objectsInArrays: false}] }, - { code: "var foo = [{ 'bar': 'baz' }, 1, { 'bar': 'baz' }];", options: ["always", {objectsInArrays: false}] }, - { code: "var foo = [ 1, { 'bar': 'baz' }, 5 ];", options: ["always", {objectsInArrays: false}] }, - { code: "var foo = [ 1, { 'bar': 'baz' }, [{ 'bar': 'baz' }] ];", options: ["always", {objectsInArrays: false}] }, - { code: "var foo = [ function(){} ];", options: ["always", {objectsInArrays: false}] }, - - // always - arraysInArrays - { code: "var arr = [[ 1, 2 ], 2, 3, 4 ];", options: ["always", {"arraysInArrays": false}] }, - { code: "var arr = [[ 1, 2 ], [[[ 1 ]]], 3, 4 ];", options: ["always", {"arraysInArrays": false}] }, - { code: "var foo = [ arr[i], arr[j] ];", options: ["always", {"arraysInArrays": false}] }, - - // always - arraysInArrays, objectsInArrays - { code: "var arr = [[ 1, 2 ], 2, 3, { 'foo': 'bar' }];", options: ["always", {"arraysInArrays": false, objectsInArrays: false}] }, - - // always - arraysInArrays, objectsInArrays, singleValue - { code: "var arr = [[ 1, 2 ], [2], 3, { 'foo': 'bar' }];", options: ["always", {"arraysInArrays": false, objectsInArrays: false, singleValue: false}] }, - - // always - { code: "obj[ foo ]", options: ["always"] }, - { code: "obj[\nfoo\n]", options: ["always"] }, - { code: "obj[ 'foo' ]", options: ["always"] }, - { code: "obj[ 'foo' + 'bar' ]", options: ["always"] }, - { code: "obj[ obj2[ foo ] ]", options: ["always"] }, - { code: "obj.map(function(item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["always"] }, - { code: "obj[ 'map' ](function(item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["always"] }, - { code: "obj[ 'for' + 'Each' ](function(item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["always"] }, - - { code: "var arr = [ 1, 2, 3, 4 ];", options: ["always"] }, - { code: "var arr = [ [ 1, 2 ], 2, 3, 4 ];", options: ["always"] }, - { code: "var arr = [\n1, 2, 3, 4\n];", options: ["always"] }, - { code: "var foo = [];", options: ["always"] }, - - // singleValue: false, objectsInArrays: true, arraysInArrays - { code: "this.db.mappings.insert([\n { alias: 'a', url: 'http://www.amazon.de' },\n { alias: 'g', url: 'http://www.google.de' }\n], function() {});", options: ["always", {singleValue: false, objectsInArrays: true, arraysInArrays: true}] }, - - // always - destructuring assignment - { code: "var [ x, y ] = z", ecmaFeatures: { destructuring: true }, options: ["always"] }, - { code: "var [ x,y ] = z", ecmaFeatures: { destructuring: true }, options: ["always"] }, - { code: "var [ x, y\n] = z", ecmaFeatures: { destructuring: true }, options: ["always"] }, - { code: "var [\nx, y ] = z", ecmaFeatures: { destructuring: true }, options: ["always"] }, - { code: "var [\nx, y\n] = z", ecmaFeatures: { destructuring: true }, options: ["always"] }, - { code: "var [\nx, y\n] = z", ecmaFeatures: { destructuring: true }, options: ["always"] }, - { code: "var [\nx,,,\n] = z", ecmaFeatures: { destructuring: true }, options: ["always"] }, - { code: "var [ ,x, ] = z", ecmaFeatures: { destructuring: true }, options: ["always"] }, - { code: "var [\nx, ...y\n] = z", ecmaFeatures: { destructuring: true, spread:true }, options: ["always"] }, - { code: "var [\nx, ...y ] = z", ecmaFeatures: { destructuring: true, spread:true }, options: ["always"] }, - { code: "var [[ x, y ], z ] = arr;", ecmaFeatures: { destructuring: true }, options: ["always", {"arraysInArrays": false}] }, - { code: "var [ x, [ y, z ]] = arr;", ecmaFeatures: { destructuring: true }, options: ["always", {"arraysInArrays": false}] }, - { code: "[{ x, y }, z ] = arr;", ecmaFeatures: { destructuring: true }, options: ["always", {objectsInArrays: false}] }, - { code: "[ x, { y, z }] = arr;", ecmaFeatures: { destructuring: true }, options: ["always", {objectsInArrays: false}] }, - - // never - { code: "obj[foo]", options: ["never"] }, - { code: "obj['foo']", options: ["never"] }, - { code: "obj['foo' + 'bar']", options: ["never"] }, - { code: "obj['foo'+'bar']", options: ["never"] }, - { code: "obj[obj2[foo]]", options: ["never"] }, - { code: "obj.map(function(item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["never"] }, - { code: "obj['map'](function(item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["never"] }, - { code: "obj['for' + 'Each'](function(item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["never"] }, - { code: "obj['for' + 'Each'](function(item) { return [\n1,\n2,\n3,\n4\n]; })", options: ["never"] }, - { code: "var arr = [1, 2, 3, 4];", options: ["never"] }, - { code: "var arr = [[1, 2], 2, 3, 4];", options: ["never"] }, - { code: "var arr = [\n1, 2, 3, 4\n];", options: ["never"] }, - { code: "obj[\nfoo]", options: ["never"] }, - { code: "obj[foo\n]", options: ["never"] }, - { code: "var arr = [1,\n2,\n3,\n4\n];", options: ["never"] }, - { code: "var arr = [\n1,\n2,\n3,\n4];", options: ["never"] }, - - // never - destructuring assignment - { code: "var [x, y] = z", ecmaFeatures: { destructuring: true }, options: ["never"] }, - { code: "var [x,y] = z", ecmaFeatures: { destructuring: true }, options: ["never"] }, - { code: "var [x, y\n] = z", ecmaFeatures: { destructuring: true }, options: ["never"] }, - { code: "var [\nx, y] = z", ecmaFeatures: { destructuring: true }, options: ["never"] }, - { code: "var [\nx, y\n] = z", ecmaFeatures: { destructuring: true }, options: ["never"] }, - { code: "var [\nx, y\n] = z", ecmaFeatures: { destructuring: true }, options: ["never"] }, - { code: "var [\nx,,,\n] = z", ecmaFeatures: { destructuring: true }, options: ["never"] }, - { code: "var [,x,] = z", ecmaFeatures: { destructuring: true }, options: ["never"] }, - { code: "var [\nx, ...y\n] = z", ecmaFeatures: { destructuring: true, spread:true }, options: ["never"] }, - { code: "var [\nx, ...y] = z", ecmaFeatures: { destructuring: true, spread:true }, options: ["never"] }, - { code: "var [ [x, y], z] = arr;", ecmaFeatures: { destructuring: true }, options: ["never", {"arraysInArrays": true}] }, - { code: "var [x, [y, z] ] = arr;", ecmaFeatures: { destructuring: true }, options: ["never", {"arraysInArrays": true}] }, - { code: "[ { x, y }, z] = arr;", ecmaFeatures: { destructuring: true }, options: ["never", {objectsInArrays: true}] }, - { code: "[x, { y, z } ] = arr;", ecmaFeatures: { destructuring: true }, options: ["never", {objectsInArrays: true}] }, - - // never - singleValue - { code: "var foo = [ 'foo' ]", options: ["never", {singleValue: true}] }, - { code: "var foo = [ 2 ]", options: ["never", {singleValue: true}] }, - { code: "var foo = [ [1, 1] ]", options: ["never", {singleValue: true}] }, - { code: "var foo = [ {'foo': 'bar'} ]", options: ["never", {singleValue: true}] }, - { code: "var foo = [ bar ]", options: ["never", {singleValue: true}] }, - - // never - objectsInArrays - { code: "var foo = [ {'bar': 'baz'}, 1, 5];", options: ["never", {objectsInArrays: true}] }, - { code: "var foo = [1, 5, {'bar': 'baz'} ];", options: ["never", {objectsInArrays: true}] }, - { code: "var foo = [ {\n'bar': 'baz', \n'qux': [ {'bar': 'baz'} ], \n'quxx': 1 \n} ]", options: ["never", {objectsInArrays: true}] }, - { code: "var foo = [ {'bar': 'baz'} ]", options: ["never", {objectsInArrays: true}] }, - { code: "var foo = [ {'bar': 'baz'}, 1, {'bar': 'baz'} ];", options: ["never", {objectsInArrays: true}] }, - { code: "var foo = [1, {'bar': 'baz'} , 5];", options: ["never", {objectsInArrays: true}] }, - { code: "var foo = [1, {'bar': 'baz'}, [ {'bar': 'baz'} ]];", options: ["never", {objectsInArrays: true}] }, - { code: "var foo = [function(){}];", options: ["never", {objectsInArrays: true}] }, - { code: "var foo = [];", options: ["never", {objectsInArrays: true}] }, - - // never - arraysInArrays - { code: "var arr = [ [1, 2], 2, 3, 4];", options: ["never", {"arraysInArrays": true}] }, - { code: "var foo = [arr[i], arr[j]];", options: ["never", {"arraysInArrays": true}] }, - { code: "var foo = [];", options: ["never", {"arraysInArrays": true}] }, - - // never - arraysInArrays, singleValue - { code: "var arr = [ [1, 2], [ [ [ 1 ] ] ], 3, 4];", options: ["never", {"arraysInArrays": true, singleValue: true}] }, - - // never - arraysInArrays, objectsInArrays - { code: "var arr = [ [1, 2], 2, 3, {'foo': 'bar'} ];", options: ["never", {"arraysInArrays": true, objectsInArrays: true}] }, - - // should not warn - { code: "var foo = {};", options: ["never"] }, - { code: "var foo = [];", options: ["never"] }, - - { code: "var foo = [{'bar':'baz'}, 1, {'bar': 'baz'}];", options: ["never"] }, - { code: "var foo = [{'bar': 'baz'}];", options: ["never"] }, - { code: "var foo = [{\n'bar': 'baz', \n'qux': [{'bar': 'baz'}], \n'quxx': 1 \n}]", options: ["never"] }, - { code: "var foo = [1, {'bar': 'baz'}, 5];", options: ["never"] }, - { code: "var foo = [{'bar': 'baz'}, 1, 5];", options: ["never"] }, - { code: "var foo = [1, 5, {'bar': 'baz'}];", options: ["never"] }, - { code: "var obj = {'foo': [1, 2]}", options: ["never"] }, - - // Babel test cases. - // always - destructuring typed array param - { code: "function fn([ a,b ]: Array){}", options: ["always"], parser: "babel-eslint", ecmaFeatures: { destructuring: true } }, - - // never - destructuring typed array param - { code: "function fn([a,b]: Array){}", options: ["never"], parser: "babel-eslint", ecmaFeatures: { destructuring: true } }, - - ], - - invalid: [ - { - code: "var foo = [ ]", - output: "var foo = []", - options: ["never"], - errors: [ - { - message: "There should be no space after '['", - type: "ArrayExpression", - line: 1, - column: 11 - } - ] - }, - // objectsInArrays - { - code: "var foo = [ { 'bar': 'baz' }, 1, 5];", - output: "var foo = [{ 'bar': 'baz' }, 1, 5 ];", - options: ["always", {objectsInArrays: false}], - errors: [ - { - message: "There should be no space after '['", - type: "ArrayExpression", - line: 1, - column: 11 - }, - { - message: "A space is required before ']'", - type: "ArrayExpression", - line: 1, - column: 36 - } - ] - }, - { - code: "var foo = [1, 5, { 'bar': 'baz' } ];", - output: "var foo = [ 1, 5, { 'bar': 'baz' }];", - options: ["always", {objectsInArrays: false}], - errors: [ - { - message: "A space is required after '['", - type: "ArrayExpression", - line: 1, - column: 11 - }, - { - message: "There should be no space before ']'", - type: "ArrayExpression", - line: 1, - column: 35 - } - ] - }, - { - code: "var foo = [ { 'bar':'baz' }, 1, { 'bar': 'baz' } ];", - output: "var foo = [{ 'bar':'baz' }, 1, { 'bar': 'baz' }];", - options: ["always", {objectsInArrays: false}], - errors: [ - { - message: "There should be no space after '['", - type: "ArrayExpression", - line: 1, - column: 11 - }, - { - message: "There should be no space before ']'", - type: "ArrayExpression", - line: 1, - column: 50 - } - ] - }, - - // singleValue - { - code: "var obj = [ 'foo' ];", - output: "var obj = ['foo'];", - options: ["always", {singleValue: false}], - errors: [ - { - message: "There should be no space after '['", - type: "ArrayExpression", - line: 1, - column: 11 - }, - { - message: "There should be no space before ']'", - type: "ArrayExpression", - line: 1, - column: 19 - } - ] - }, - { - code: "var obj = ['foo' ];", - output: "var obj = ['foo'];", - options: ["always", {singleValue: false}], - errors: [ - { - message: "There should be no space before ']'", - type: "ArrayExpression", - line: 1, - column: 18 - } - ] - }, - { - code: "var obj = ['foo'];", - output: "var obj = [ 'foo' ];", - options: ["never", {singleValue: true}], - errors: [ - { - message: "A space is required after '['", - type: "ArrayExpression", - line: 1, - column: 11 - }, - { - message: "A space is required before ']'", - type: "ArrayExpression", - line: 1, - column: 17 - } - ] - }, - - // always - arraysInArrays - { - code: "var arr = [ [ 1, 2 ], 2, 3, 4 ];", - output: "var arr = [[ 1, 2 ], 2, 3, 4 ];", - options: ["always", {"arraysInArrays": false}], - errors: [ - { - message: "There should be no space after '['", - type: "ArrayExpression", - line: 1, - column: 11 - } - ] - }, - { - code: "var arr = [ 1, 2, 2, [ 3, 4 ] ];", - output: "var arr = [ 1, 2, 2, [ 3, 4 ]];", - options: ["always", {"arraysInArrays": false}], - errors: [ - { - message: "There should be no space before ']'", - type: "ArrayExpression", - line: 1, - column: 31 - } - ] - }, - { - code: "var arr = [[ 1, 2 ], 2, [ 3, 4 ] ];", - output: "var arr = [[ 1, 2 ], 2, [ 3, 4 ]];", - options: ["always", {"arraysInArrays": false}], - errors: [ - { - message: "There should be no space before ']'", - type: "ArrayExpression", - line: 1, - column: 34 - } - ] - }, - { - code: "var arr = [ [ 1, 2 ], 2, [ 3, 4 ]];", - output: "var arr = [[ 1, 2 ], 2, [ 3, 4 ]];", - options: ["always", {"arraysInArrays": false}], - errors: [ - { - message: "There should be no space after '['", - type: "ArrayExpression", - line: 1, - column: 11 - } - ] - }, - { - code: "var arr = [ [ 1, 2 ], 2, [ 3, 4 ] ];", - output: "var arr = [[ 1, 2 ], 2, [ 3, 4 ]];", - options: ["always", {"arraysInArrays": false}], - errors: [ - { - message: "There should be no space after '['", - type: "ArrayExpression", - line: 1, - column: 11 - }, - { - message: "There should be no space before ']'", - type: "ArrayExpression", - line: 1, - column: 35 - } - ] - }, - - // always - destructuring - { - code: "var [x,y] = y", - output: "var [ x,y ] = y", - options: ["always"], - ecmaFeatures: { destructuring: true }, - errors: [{ - message: "A space is required after '['", - type: "ArrayPattern", - line: 1, - column: 5 - }, - { - message: "A space is required before ']'", - type: "ArrayPattern", - line: 1, - column: 9 - }] - }, - { - code: "var [x,y ] = y", - output: "var [ x,y ] = y", - options: ["always"], - ecmaFeatures: { destructuring: true }, - errors: [{ - message: "A space is required after '['", - type: "ArrayPattern", - line: 1, - column: 5 - }] - }, - { - code: "var [,,,x,,] = y", - output: "var [ ,,,x,, ] = y", - options: ["always"], - ecmaFeatures: { destructuring: true }, - errors: [{ - message: "A space is required after '['", - type: "ArrayPattern", - line: 1, - column: 5 - }, - { - message: "A space is required before ']'", - type: "ArrayPattern", - line: 1, - column: 12 - }] - }, - { - code: "var [ ,,,x,,] = y", - output: "var [ ,,,x,, ] = y", - options: ["always"], - ecmaFeatures: { destructuring: true }, - errors: [{ - message: "A space is required before ']'", - type: "ArrayPattern", - line: 1, - column: 13 - }] - }, - { - code: "var [...horse] = y", - output: "var [ ...horse ] = y", - options: ["always"], - ecmaFeatures: { destructuring: true, spread:true }, - errors: [{ - message: "A space is required after '['", - type: "ArrayPattern", - line: 1, - column: 5 - }, - { - message: "A space is required before ']'", - type: "ArrayPattern", - line: 1, - column: 14 - }] - }, - { - code: "var [...horse ] = y", - output: "var [ ...horse ] = y", - options: ["always"], - ecmaFeatures: { destructuring: true, spread:true }, - errors: [{ - message: "A space is required after '['", - type: "ArrayPattern", - line: 1, - column: 5 - }] - }, - { - code: "var [ [ x, y ], z ] = arr;", - output: "var [[ x, y ], z ] = arr;", - options: ["always", {"arraysInArrays": false}], - ecmaFeatures: { destructuring: true }, - errors: [{ - message: "There should be no space after '['", - type: "ArrayPattern", - line: 1, - column: 5 - }] - }, - { - code: "[ { x, y }, z ] = arr;", - output: "[{ x, y }, z ] = arr;", - options: ["always", {"objectsInArrays": false}], - ecmaFeatures: { destructuring: true }, - errors: [{ - message: "There should be no space after '['", - type: "ArrayPattern", - line: 1, - column: 1 - }] - }, - { - code: "[ x, { y, z } ] = arr;", - output: "[ x, { y, z }] = arr;", - options: ["always", {"objectsInArrays": false}], - ecmaFeatures: { destructuring: true }, - errors: [{ - message: "There should be no space before ']'", - type: "ArrayPattern", - line: 1, - column: 15 - }] - }, - - // never - arraysInArrays - { - code: "var arr = [[1, 2], 2, [3, 4]];", - output: "var arr = [ [1, 2], 2, [3, 4] ];", - options: ["never", {"arraysInArrays": true}], - errors: [ - { - message: "A space is required after '['", - type: "ArrayExpression", - line: 1, - column: 11 - }, - { - message: "A space is required before ']'", - type: "ArrayExpression", - line: 1, - column: 29 - } - ] - }, - { - code: "var arr = [ ];", - output: "var arr = [];", - options: ["never", {"arraysInArrays": true}], - errors: [ - { - message: "There should be no space after '['", - type: "ArrayExpression", - line: 1, - column: 11 - } - ] - }, - - // never - objectsInArrays - { - code: "var arr = [ ];", - output: "var arr = [];", - options: ["never", {"objectsInArrays": true}], - errors: [ - { - message: "There should be no space after '['", - type: "ArrayExpression", - line: 1, - column: 11 - } - ] - }, - - // always - { - code: "var arr = [1, 2, 3, 4];", - output: "var arr = [ 1, 2, 3, 4 ];", - options: ["always"], - errors: [ - { - message: "A space is required after '['", - type: "ArrayExpression", - line: 1, - column: 11 - }, - { - message: "A space is required before ']'", - type: "ArrayExpression", - line: 1, - column: 22 - } - ] - }, - { - code: "var arr = [1, 2, 3, 4 ];", - output: "var arr = [ 1, 2, 3, 4 ];", - options: ["always"], - errors: [ - { - message: "A space is required after '['", - type: "ArrayExpression", - line: 1, - column: 11 - } - ] - }, - { - code: "var arr = [ 1, 2, 3, 4];", - output: "var arr = [ 1, 2, 3, 4 ];", - options: ["always"], - errors: [ - { - message: "A space is required before ']'", - type: "ArrayExpression", - line: 1, - column: 23 - } - ] - }, - - // never - { - code: "var arr = [ 1, 2, 3, 4 ];", - output: "var arr = [1, 2, 3, 4];", - options: ["never"], - errors: [ - { - message: "There should be no space after '['", - type: "ArrayExpression", - line: 1, - column: 11 - }, - { - message: "There should be no space before ']'", - type: "ArrayExpression", - line: 1, - column: 24 - } - ] - }, - { - code: "var arr = [1, 2, 3, 4 ];", - output: "var arr = [1, 2, 3, 4];", - options: ["never"], - errors: [ - { - message: "There should be no space before ']'", - type: "ArrayExpression", - line: 1, - column: 23 - } - ] - }, - { - code: "var arr = [ 1, 2, 3, 4];", - output: "var arr = [1, 2, 3, 4];", - options: ["never"], - errors: [ - { - message: "There should be no space after '['", - type: "ArrayExpression", - line: 1, - column: 11 - } - ] - }, - { - code: "var arr = [ [ 1], 2, 3, 4];", - output: "var arr = [[1], 2, 3, 4];", - options: ["never"], - errors: [ - { - message: "There should be no space after '['", - type: "ArrayExpression", - line: 1, - column: 11 - }, - { - message: "There should be no space after '['", - type: "ArrayExpression", - line: 1, - column: 13 - } - ] - }, - { - code: "var arr = [[1 ], 2, 3, 4 ];", - output: "var arr = [[1], 2, 3, 4];", - options: ["never"], - errors: [ - { - message: "There should be no space before ']'", - type: "ArrayExpression", - line: 1, - column: 15 - }, - { - message: "There should be no space before ']'", - type: "ArrayExpression", - line: 1, - column: 26 - } - ] - }, - - // Babel test cases. - - // always - destructuring typed array param - { - code: "function fn([a,b]: Array){}", - output: "function fn([ a,b ]: Array){}", - options: ["always"], - parser: "babel-eslint", - ecmaFeatures: { - destructuring: true - }, - errors: [ - { - message: "A space is required after '['", - type: "ArrayPattern", - line: 1, - column: 13 - }, - { - message: "A space is required before ']'", - type: "ArrayPattern", - line: 1, - column: 17 - } - ] - }, - - // never - destructuring typed array param - { - code: "function fn([ a,b ]: Array){}", - output: "function fn([a,b]: Array){}", - options: ["never"], - parser: "babel-eslint", - ecmaFeatures: { - destructuring: true - }, - errors: [ - { - message: "There should be no space after '['", - type: "ArrayPattern", - line: 1, - column: 13 - }, - { - message: "There should be no space before ']'", - type: "ArrayPattern", - line: 1, - column: 19 - } - ] - } - ] -}); diff --git a/eslint/babel-eslint-plugin/tests/rules/arrow-parens.js b/eslint/babel-eslint-plugin/tests/rules/arrow-parens.js deleted file mode 100644 index 1962be7b8891..000000000000 --- a/eslint/babel-eslint-plugin/tests/rules/arrow-parens.js +++ /dev/null @@ -1,187 +0,0 @@ -/* eslint-disable */ - -/** - * @fileoverview Tests for arrow-parens - * @author Jxck - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -var rule = require("../../rules/arrow-parens"), - RuleTester = require('../RuleTester'); - -function ok(code, args){ - return { code: code, options: args, parser: 'babel-eslint' } -} - -function err(code, output, errors, args){ - var e = ok(code, args) - e.errors = errors - e.output = output - return e -} - -//------------------------------------------------------------------------------ -// Tests -//------------------------------------------------------------------------------ -var ruleTester = new RuleTester(); - -var valid = [ - { code: "() => {}", ecmaFeatures: { arrowFunctions: true } }, - { code: "(a) => {}", ecmaFeatures: { arrowFunctions: true } }, - { code: "(a) => a", ecmaFeatures: { arrowFunctions: true } }, - { code: "(a) => {\n}", ecmaFeatures: { arrowFunctions: true } }, - { code: "a.then((foo) => {});", ecmaFeatures: { arrowFunctions: true } }, - { code: "a.then((foo) => { if (true) {}; });", ecmaFeatures: { arrowFunctions: true } }, - - // // as-needed - { code: "() => {}", options: ["as-needed"], ecmaFeatures: { arrowFunctions: true } }, - { code: "a => {}", options: ["as-needed"], ecmaFeatures: { arrowFunctions: true } }, - { code: "a => a", options: ["as-needed"], ecmaFeatures: { arrowFunctions: true } }, - { code: "([a, b]) => {}", options: ["as-needed"], ecmaFeatures: { arrowFunctions: true, destructuring: true } }, - { code: "({ a, b }) => {}", options: ["as-needed"], ecmaFeatures: { arrowFunctions: true, destructuring: true } }, - { code: "(a = 10) => {}", options: ["as-needed"], ecmaFeatures: { arrowFunctions: true, destructuring: true, defaultParams: true } }, - { code: "(...a) => a[0]", options: ["as-needed"], ecmaFeatures: { arrowFunctions: true, restParams: true } }, - { code: "(a, b) => {}", options: ["as-needed"], ecmaFeatures: { arrowFunctions: true } }, - ok("(a: string) => a", ["as-needed"]), - - // async - ok("async () => {}"), - ok("async (a) => {}"), - ok("async (a) => a"), - ok("async (a) => {\n}"), - ok("a.then(async (foo) => {});"), - ok("a.then((foo) => { if (true) {}; })"), - - ok("async () => {}", ["as-needed"]), - ok("async a => {}", ["as-needed"]), - ok("async a => a", ["as-needed"]), - ok("async ([a, b]) => {}", ["as-needed"]), - ok("async ({ a, b }) => {}", ["as-needed"]), - ok("async (a = 10) => {}", ["as-needed"]), - ok("async (...a) => a[0]", ["as-needed"]), - ok("async (a, b) => {}", ["as-needed"]), - -]; - -var message = message; -var asNeededMessage = asNeededMessage; -var type = type; - -var invalid = [ - { - code: "a => {}", - output: "(a) => {}", - ecmaFeatures: { arrowFunctions: true }, - errors: [{ - line: 1, - column: 1, - message: message, - type: type - }] - }, - { - code: "a => a", - output: "(a) => a", - ecmaFeatures: { arrowFunctions: true }, - errors: [{ - line: 1, - column: 1, - message: message, - type: type - }] - }, - { - code: "a => {\n}", - output: "(a) => {\n}", - ecmaFeatures: { arrowFunctions: true }, - errors: [{ - line: 1, - column: 1, - message: message, - type: type - }] - }, - { - code: "a.then(foo => {});", - output: "a.then((foo) => {});", - ecmaFeatures: { arrowFunctions: true }, - errors: [{ - line: 1, - column: 8, - message: message, - type: type - }] - }, - { - code: "a.then(foo => a);", - output: "a.then((foo) => a);", - ecmaFeatures: { arrowFunctions: true }, - errors: [{ - line: 1, - column: 8, - message: message, - type: type - }] - }, - { - code: "a(foo => { if (true) {}; });", - output: "a((foo) => { if (true) {}; });", - ecmaFeatures: { arrowFunctions: true }, - errors: [{ - line: 1, - column: 3, - message: message, - type: type - }] - }, - - // as-needed - { - code: "(a) => a", - output: "a => a", - options: ["as-needed"], - ecmaFeatures: { arrowFunctions: true }, - errors: [{ - line: 1, - column: 1, - message: asNeededMessage, - type: type - }] - }, - { - code: "(b) => b", - output: "b => b", - options: ["as-needed"], - ecmaFeatures: { arrowFunctions: true }, - errors: [{ - line: 1, - column: 1, - message: asNeededMessage, - type: type - }] - }, - - // async - err('async a => {}', 'async (a) => {}', [ - { message: 'Expected parentheses around arrow function argument.' }, - ]), - - err('async a => a', 'async (a) => a', [ - { message: 'Expected parentheses around arrow function argument.' }, - ]), - - err('async (a) => a', 'async a => a', [ - { message: 'Unexpected parentheses around single function argument' }, - ], - ["as-needed"]) -]; - -ruleTester.run("arrow-parens", rule, { - valid: valid, - invalid: invalid -}); diff --git a/eslint/babel-eslint-plugin/tests/rules/flow-object-type.js b/eslint/babel-eslint-plugin/tests/rules/flow-object-type.js deleted file mode 100644 index 9d34036b0f68..000000000000 --- a/eslint/babel-eslint-plugin/tests/rules/flow-object-type.js +++ /dev/null @@ -1,69 +0,0 @@ -/** - * @fileoverview Tests for flow-object-type. - * @author Nat Mote - */ - -"use strict"; - -var rule = require("../../rules/flow-object-type"), - RuleTester = require('../RuleTester'); - -var features = { -}; - -function test(code, options, errors, output){ - var result = { - code: code, - parser: 'babel-eslint', - ecmaFeatures: features, - }; - if (options != null) { - result.options = options; - } - if (errors != null) { - result.errors = errors; - } - if (output != null) { - result.output = output; - } - return result; -} - -var commaMessage = 'Prefer commas to semicolons in object and class types'; -var semiMessage = 'Prefer semicolons to commas in object and class types'; - -function ok(code, commaOrSemi) { - return test(code, [commaOrSemi]); -} - -function err(code, commaOrSemi, errorMessage, output) { - return test(code, [commaOrSemi], [errorMessage], output); -} - -var cases = [ - ok('type Foo = { a: Foo; b: Bar }', 'semicolon'), - err('type Foo = { a: Foo, b: Bar }', 'semicolon', semiMessage, 'type Foo = { a: Foo; b: Bar }'), - - ok('type Foo = { a: Foo, b: Bar }', 'comma'), - err('type Foo = { a: Foo; b: Bar }', 'comma', commaMessage, 'type Foo = { a: Foo, b: Bar }'), - - ok('declare class Foo { a: Foo; }', 'semicolon'), - err('declare class Foo { a: Foo, }', 'semicolon', semiMessage, 'declare class Foo { a: Foo; }'), - - ok('declare class Foo { a: Foo, }', 'comma'), - err('declare class Foo { a: Foo; }', 'comma', commaMessage, 'declare class Foo { a: Foo, }'), -]; - -function hasError(testCase) { - return testCase.errors != null && testCase.errors.length > 0; -} - -function hasNoError(testCase) { - return !hasError(testCase); -} - -var ruleTester = new RuleTester(); -ruleTester.run('flow-object-type', rule, { - valid: cases.filter(hasNoError), - invalid: cases.filter(hasError), -}); diff --git a/eslint/babel-eslint-plugin/tests/rules/func-params-comma-dangle.js b/eslint/babel-eslint-plugin/tests/rules/func-params-comma-dangle.js deleted file mode 100644 index a1676e4fc4b1..000000000000 --- a/eslint/babel-eslint-plugin/tests/rules/func-params-comma-dangle.js +++ /dev/null @@ -1,278 +0,0 @@ -'use strict'; - -var rule = require('../../rules/func-params-comma-dangle'); -var RuleTester = require('../RuleTester'); - -var MISSING_I = [{message: 'Missing trailing comma.', type: 'Identifier'}]; -var MISSING_AP = [{message: 'Missing trailing comma.', type: 'AssignmentPattern'}]; -var MISSING_SE = [{message: 'Missing trailing comma.', type: 'SpreadElement'}]; -var UNEXPECTED_I = [{message: 'Unexpected trailing comma.', type: 'Identifier'}]; -var UNEXPECTED_AP = [{message: 'Unexpected trailing comma.', type: 'AssignmentPattern'}]; -var UNEXPECTED_SE = [{message: 'Unexpected trailing comma.', type: 'SpreadElement'}]; - -var ruleTester = new RuleTester({parser: 'babel-eslint'}); -ruleTester.run('func-params-comma-dangle', rule, { - valid: [ - {code: 'function f() {}'}, - {code: 'function f(\n) {}'}, - {code: 'function f(...a) {}'}, - {code: 'function f(...a\n) {}'}, - - {code: 'f()'}, - {code: 'f(\n)'}, - - {code: 'new F()'}, - {code: 'new F(\n)'}, - - // FunctionDeclaration - {code: 'function f(a) {}', options: ['always-multiline']}, - {code: 'function f(a) {}', options: ['never']}, - {code: 'function f(a) {}', options: ['only-multiline']}, - {code: 'function f(a,) {}', options: ['always']}, - {code: 'function f(a,\n) {}', options: ['always']}, - {code: 'function f(a,\n) {}', options: ['always-multiline']}, - {code: 'function f(a,\n) {}', options: ['only-multiline']}, - {code: 'function f(a\n) {}', options: ['never']}, - {code: 'function f(a\n) {}', options: ['only-multiline']}, - - {code: 'function f(a=1) {}', options: ['always-multiline']}, - {code: 'function f(a=1) {}', options: ['never']}, - {code: 'function f(a=1) {}', options: ['only-multiline']}, - {code: 'function f(a=1,) {}', options: ['always']}, - {code: 'function f(a=1,\n) {}', options: ['always']}, - {code: 'function f(a=1,\n) {}', options: ['always-multiline']}, - {code: 'function f(a=1,\n) {}', options: ['only-multiline']}, - {code: 'function f(a=1\n) {}', options: ['never']}, - {code: 'function f(a=1\n) {}', options: ['only-multiline']}, - - {code: 'function f(a:T) {}', options: ['always-multiline']}, - {code: 'function f(a:T) {}', options: ['never']}, - {code: 'function f(a:T) {}', options: ['only-multiline']}, - {code: 'function f(a:T,) {}', options: ['always']}, - {code: 'function f(a:T,\n) {}', options: ['always']}, - {code: 'function f(a:T,\n) {}', options: ['always-multiline']}, - {code: 'function f(a:T,\n) {}', options: ['only-multiline']}, - {code: 'function f(a:T\n) {}', options: ['never']}, - {code: 'function f(a:T\n) {}', options: ['only-multiline']}, - - // FunctionExpression - {code: 'f = function(a) {}', options: ['always-multiline']}, - {code: 'f = function(a) {}', options: ['never']}, - {code: 'f = function(a) {}', options: ['only-multiline']}, - {code: 'f = function(a,) {}', options: ['always']}, - {code: 'f = function(a,\n) {}', options: ['always']}, - {code: 'f = function(a,\n) {}', options: ['always-multiline']}, - {code: 'f = function(a,\n) {}', options: ['only-multiline']}, - {code: 'f = function(a\n) {}', options: ['never']}, - {code: 'f = function(a\n) {}', options: ['only-multiline']}, - - {code: 'f = function(a=1) {}', options: ['always-multiline']}, - {code: 'f = function(a=1) {}', options: ['never']}, - {code: 'f = function(a=1) {}', options: ['only-multiline']}, - {code: 'f = function(a=1,) {}', options: ['always']}, - {code: 'f = function(a=1,\n) {}', options: ['always']}, - {code: 'f = function(a=1,\n) {}', options: ['always-multiline']}, - {code: 'f = function(a=1,\n) {}', options: ['only-multiline']}, - {code: 'f = function(a=1\n) {}', options: ['never']}, - {code: 'f = function(a=1\n) {}', options: ['only-multiline']}, - - {code: 'f = function(a:T) {}', options: ['always-multiline']}, - {code: 'f = function(a:T) {}', options: ['never']}, - {code: 'f = function(a:T) {}', options: ['only-multiline']}, - {code: 'f = function(a:T,) {}', options: ['always']}, - {code: 'f = function(a:T,\n) {}', options: ['always']}, - {code: 'f = function(a:T,\n) {}', options: ['always-multiline']}, - {code: 'f = function(a:T,\n) {}', options: ['only-multiline']}, - {code: 'f = function(a:T\n) {}', options: ['never']}, - {code: 'f = function(a:T\n) {}', options: ['only-multiline']}, - - // ArrowFunctionExpression - {code: 'f = (a) => {}', options: ['always-multiline']}, - {code: 'f = (a) => {}', options: ['never']}, - {code: 'f = (a) => {}', options: ['only-multiline']}, - {code: 'f = (a,) => {}', options: ['always']}, - {code: 'f = (a,\n) => {}', options: ['always']}, - {code: 'f = (a,\n) => {}', options: ['always-multiline']}, - {code: 'f = (a,\n) => {}', options: ['only-multiline']}, - {code: 'f = (a\n) => {}', options: ['never']}, - {code: 'f = (a\n) => {}', options: ['only-multiline']}, - - {code: 'f = a => {}', options: ['always-multiline']}, - {code: 'f = a => {}', options: ['never']}, - {code: 'f = a => {}', options: ['only-multiline']}, - {code: 'f = a => {}', options: ['always']}, - - {code: 'f = (a=1) => {}', options: ['always-multiline']}, - {code: 'f = (a=1) => {}', options: ['never']}, - {code: 'f = (a=1) => {}', options: ['only-multiline']}, - {code: 'f = (a=1,) => {}', options: ['always']}, - {code: 'f = (a=1,\n) => {}', options: ['always']}, - {code: 'f = (a=1,\n) => {}', options: ['always-multiline']}, - {code: 'f = (a=1,\n) => {}', options: ['only-multiline']}, - {code: 'f = (a=1\n) => {}', options: ['never']}, - {code: 'f = (a=1\n) => {}', options: ['only-multiline']}, - - {code: 'f = (a:T) => {}', options: ['always-multiline']}, - {code: 'f = (a:T) => {}', options: ['never']}, - {code: 'f = (a:T) => {}', options: ['only-multiline']}, - // Arrow functions with flow types aren't getting the correct loc. - // {code: 'f = (a:T,) => {}', options: ['always']}, - // {code: 'f = (a:T,\n) => {}', options: ['always']}, - {code: 'f = (a:T,\n) => {}', options: ['always-multiline']}, - {code: 'f = (a:T,\n) => {}', options: ['only-multiline']}, - {code: 'f = (a:T\n) => {}', options: ['never']}, - {code: 'f = (a:T\n) => {}', options: ['only-multiline']}, - - // CallExpression - {code: 'f(a)', options: ['always-multiline']}, - {code: 'f(a)', options: ['never']}, - {code: 'f(a)', options: ['only-multiline']}, - {code: 'f(a,)', options: ['always']}, - {code: 'f(a,\n)', options: ['always']}, - {code: 'f(a,\n)', options: ['always-multiline']}, - {code: 'f(a,\n)', options: ['only-multiline']}, - {code: 'f(a\n)', options: ['never']}, - {code: 'f(a\n)', options: ['only-multiline']}, - {code: 'f(...a)', options: ['always-multiline']}, - {code: 'f(...a)', options: ['never']}, - {code: 'f(...a)', options: ['only-multiline']}, - {code: 'f(...a,)', options: ['always']}, - {code: 'f(...a,\n)', options: ['always']}, - {code: 'f(...a,\n)', options: ['always-multiline']}, - {code: 'f(...a,\n)', options: ['only-multiline']}, - {code: 'f(...a\n)', options: ['never']}, - {code: 'f(...a\n)', options: ['only-multiline']}, - - // NewExpression - {code: 'new F(a)', options: ['always-multiline']}, - {code: 'new F(a)', options: ['never']}, - {code: 'new F(a)', options: ['only-multiline']}, - {code: 'new F(a,)', options: ['always']}, - {code: 'new F(a,\n)', options: ['always']}, - {code: 'new F(a,\n)', options: ['always-multiline']}, - {code: 'new F(a,\n)', options: ['only-multiline']}, - {code: 'new F(a\n)', options: ['never']}, - {code: 'new F(a\n)', options: ['only-multiline']}, - {code: 'new F(...a)', options: ['always-multiline']}, - {code: 'new F(...a)', options: ['never']}, - {code: 'new F(...a)', options: ['only-multiline']}, - {code: 'new F(...a,)', options: ['always']}, - {code: 'new F(...a,\n)', options: ['always']}, - {code: 'new F(...a,\n)', options: ['always-multiline']}, - {code: 'new F(...a,\n)', options: ['only-multiline']}, - {code: 'new F(...a\n)', options: ['never']}, - {code: 'new F(...a\n)', options: ['only-multiline']}, - ], - invalid: [ - // FunctionDeclaration - {code: 'function f(a) {}', output: 'function f(a,) {}', options: ['always'], errors: MISSING_I}, - {code: 'function f(a,) {}', output: 'function f(a) {}', options: ['always-multiline'], errors: UNEXPECTED_I}, - {code: 'function f(a,) {}', output: 'function f(a) {}', options: ['only-multiline'], errors: UNEXPECTED_I}, - {code: 'function f(a,) {}', output: 'function f(a) {}', options: ['never'], errors: UNEXPECTED_I}, - {code: 'function f(a,\n) {}', output: 'function f(a\n) {}', options: ['never'], errors: UNEXPECTED_I}, - {code: 'function f(a\n) {}', output: 'function f(a,\n) {}', options: ['always'], errors: MISSING_I}, - {code: 'function f(a\n) {}', output: 'function f(a,\n) {}', options: ['always-multiline'], errors: MISSING_I}, - - {code: 'function f(a=1) {}', output: 'function f(a=1,) {}', options: ['always'], errors: MISSING_AP}, - {code: 'function f(a=1,) {}', output: 'function f(a=1) {}', options: ['always-multiline'], errors: UNEXPECTED_AP}, - {code: 'function f(a=1,) {}', output: 'function f(a=1) {}', options: ['always-multiline'], errors: UNEXPECTED_AP}, - {code: 'function f(a=1,) {}', output: 'function f(a=1) {}', options: ['only-multiline'], errors: UNEXPECTED_AP}, - {code: 'function f(a=1,) {}', output: 'function f(a=1) {}', options: ['never'], errors: UNEXPECTED_AP}, - {code: 'function f(a=1,\n) {}', output: 'function f(a=1\n) {}', options: ['never'], errors: UNEXPECTED_AP}, - {code: 'function f(a=1\n) {}', output: 'function f(a=1,\n) {}', options: ['always'], errors: MISSING_AP}, - {code: 'function f(a=1\n) {}', output: 'function f(a=1,\n) {}', options: ['always-multiline'], errors: MISSING_AP}, - - {code: 'function f(a:T) {}', output: 'function f(a:T,) {}', options: ['always'], errors: MISSING_I}, - {code: 'function f(a:T,) {}', output: 'function f(a:T) {}', options: ['always-multiline'], errors: UNEXPECTED_I}, - {code: 'function f(a:T,) {}', output: 'function f(a:T) {}', options: ['only-multiline'], errors: UNEXPECTED_I}, - {code: 'function f(a:T,) {}', output: 'function f(a:T) {}', options: ['never'], errors: UNEXPECTED_I}, - {code: 'function f(a:T,\n) {}', output: 'function f(a:T\n) {}', options: ['never'], errors: UNEXPECTED_I}, - {code: 'function f(a:T\n) {}', output: 'function f(a:T,\n) {}', options: ['always'], errors: MISSING_I}, - {code: 'function f(a:T\n) {}', output: 'function f(a:T,\n) {}', options: ['always-multiline'], errors: MISSING_I}, - - // FunctionExpression - {code: 'f = function f(a) {}', output: 'f = function f(a,) {}', options: ['always'], errors: MISSING_I}, - {code: 'f = function f(a,) {}', output: 'f = function f(a) {}', options: ['always-multiline'], errors: UNEXPECTED_I}, - {code: 'f = function f(a,) {}', output: 'f = function f(a) {}', options: ['only-multiline'], errors: UNEXPECTED_I}, - {code: 'f = function f(a,) {}', output: 'f = function f(a) {}', options: ['never'], errors: UNEXPECTED_I}, - {code: 'f = function f(a,\n) {}', output: 'f = function f(a\n) {}', options: ['never'], errors: UNEXPECTED_I}, - {code: 'f = function f(a\n) {}', output: 'f = function f(a,\n) {}', options: ['always'], errors: MISSING_I}, - {code: 'f = function f(a\n) {}', output: 'f = function f(a,\n) {}', options: ['always-multiline'], errors: MISSING_I}, - - {code: 'f = function f(a=1) {}', output: 'f = function f(a=1,) {}', options: ['always'], errors: MISSING_AP}, - {code: 'f = function f(a=1,) {}', output: 'f = function f(a=1) {}', options: ['always-multiline'], errors: UNEXPECTED_AP}, - {code: 'f = function f(a=1,) {}', output: 'f = function f(a=1) {}', options: ['only-multiline'], errors: UNEXPECTED_AP}, - {code: 'f = function f(a=1,) {}', output: 'f = function f(a=1) {}', options: ['never'], errors: UNEXPECTED_AP}, - {code: 'f = function f(a=1,\n) {}', output: 'f = function f(a=1\n) {}', options: ['never'], errors: UNEXPECTED_AP}, - {code: 'f = function f(a=1\n) {}', output: 'f = function f(a=1,\n) {}', options: ['always'], errors: MISSING_AP}, - {code: 'f = function f(a=1\n) {}', output: 'f = function f(a=1,\n) {}', options: ['always-multiline'], errors: MISSING_AP}, - - {code: 'f = function f(a:T) {}', output: 'f = function f(a:T,) {}', options: ['always'], errors: MISSING_I}, - {code: 'f = function f(a:T,) {}', output: 'f = function f(a:T) {}', options: ['always-multiline'], errors: UNEXPECTED_I}, - {code: 'f = function f(a:T,) {}', output: 'f = function f(a:T) {}', options: ['only-multiline'], errors: UNEXPECTED_I}, - {code: 'f = function f(a:T,) {}', output: 'f = function f(a:T) {}', options: ['never'], errors: UNEXPECTED_I}, - {code: 'f = function f(a:T,\n) {}', output: 'f = function f(a:T\n) {}', options: ['never'], errors: UNEXPECTED_I}, - {code: 'f = function f(a:T\n) {}', output: 'f = function f(a:T,\n) {}', options: ['always'], errors: MISSING_I}, - {code: 'f = function f(a:T\n) {}', output: 'f = function f(a:T,\n) {}', options: ['always-multiline'], errors: MISSING_I}, - - // ArrowFunctionExpression - {code: 'f = (a) => {}', output: 'f = (a,) => {}', options: ['always'], errors: MISSING_I}, - {code: 'f = (a,) => {}', output: 'f = (a) => {}', options: ['always-multiline'], errors: UNEXPECTED_I}, - {code: 'f = (a,) => {}', output: 'f = (a) => {}', options: ['only-multiline'], errors: UNEXPECTED_I}, - {code: 'f = (a,) => {}', output: 'f = (a) => {}', options: ['never'], errors: UNEXPECTED_I}, - {code: 'f = (a,\n) => {}', output: 'f = (a\n) => {}', options: ['never'], errors: UNEXPECTED_I}, - {code: 'f = (a\n) => {}', output: 'f = (a,\n) => {}', options: ['always'], errors: MISSING_I}, - {code: 'f = (a\n) => {}', output: 'f = (a,\n) => {}', options: ['always-multiline'], errors: MISSING_I}, - - {code: 'f = (a=1) => {}', output: 'f = (a=1,) => {}', options: ['always'], errors: MISSING_AP}, - {code: 'f = (a=1,) => {}', output: 'f = (a=1) => {}', options: ['always-multiline'], errors: UNEXPECTED_AP}, - {code: 'f = (a=1,) => {}', output: 'f = (a=1) => {}', options: ['only-multiline'], errors: UNEXPECTED_AP}, - {code: 'f = (a=1,) => {}', output: 'f = (a=1) => {}', options: ['never'], errors: UNEXPECTED_AP}, - {code: 'f = (a=1,\n) => {}', output: 'f = (a=1\n) => {}', options: ['never'], errors: UNEXPECTED_AP}, - {code: 'f = (a=1\n) => {}', output: 'f = (a=1,\n) => {}', options: ['always'], errors: MISSING_AP}, - {code: 'f = (a=1\n) => {}', output: 'f = (a=1,\n) => {}', options: ['always-multiline'], errors: MISSING_AP}, - - // Arrow functions with flow types aren't getting the correct loc. - // {code: 'f = (a:T) => {}', output: 'f = (a:T,) => {}', options: ['always'], errors: MISSING_I}, - // {code: 'f = (a:T,) => {}', output: 'f = (a:T) => {}', options: ['always-multiline'], errors: UNEXPECTED_I}, - // {code: 'f = (a:T,) => {}', output: 'f = (a:T) => {}', options: ['only-multiline'], errors: UNEXPECTED_I}, - // {code: 'f = (a:T,) => {}', output: 'f = (a:T) => {}', options: ['never'], errors: UNEXPECTED_I}, - // {code: 'f = (a:T,\n) => {}', output: 'f = (a:T\n) => {}', options: ['never'], errors: UNEXPECTED_I}, - // {code: 'f = (a:T\n) => {}', output: 'f = (a:T,\n) => {}', options: ['always'], errors: MISSING_I}, - // {code: 'f = (a:T\n) => {}', output: 'f = (a:T,\n) => {}', options: ['always-multiline'], errors: MISSING_I}, - - // CallExpression - {code: 'f(a)', output: 'f(a,)', options: ['always'], errors: MISSING_I}, - {code: 'f(a,)', output: 'f(a)', options: ['always-multiline'], errors: UNEXPECTED_I}, - {code: 'f(a,)', output: 'f(a)', options: ['only-multiline'], errors: UNEXPECTED_I}, - {code: 'f(a,)', output: 'f(a)', options: ['never'], errors: UNEXPECTED_I}, - {code: 'f(a,\n)', output: 'f(a\n)', options: ['never'], errors: UNEXPECTED_I}, - {code: 'f(a\n)', output: 'f(a,\n)', options: ['always'], errors: MISSING_I}, - {code: 'f(a\n)', output: 'f(a,\n)', options: ['always-multiline'], errors: MISSING_I}, - - {code: 'f(...a)', output: 'f(...a,)', options: ['always'], errors: MISSING_SE}, - {code: 'f(...a,)', output: 'f(...a)', options: ['always-multiline'], errors: UNEXPECTED_SE}, - {code: 'f(...a,)', output: 'f(...a)', options: ['only-multiline'], errors: UNEXPECTED_SE}, - {code: 'f(...a,)', output: 'f(...a)', options: ['never'], errors: UNEXPECTED_SE}, - {code: 'f(...a,\n)', output: 'f(...a\n)', options: ['never'], errors: UNEXPECTED_SE}, - {code: 'f(...a\n)', output: 'f(...a,\n)', options: ['always'], errors: MISSING_SE}, - {code: 'f(...a\n)', output: 'f(...a,\n)', options: ['always-multiline'], errors: MISSING_SE}, - - // NewExpression - {code: 'new F(a)', output: 'new F(a,)', options: ['always'], errors: MISSING_I}, - {code: 'new F(a,)', output: 'new F(a)', options: ['always-multiline'], errors: UNEXPECTED_I}, - {code: 'new F(a,)', output: 'new F(a)', options: ['only-multiline'], errors: UNEXPECTED_I}, - {code: 'new F(a,)', output: 'new F(a)', options: ['never'], errors: UNEXPECTED_I}, - {code: 'new F(a,\n)', output: 'new F(a\n)', options: ['never'], errors: UNEXPECTED_I}, - {code: 'new F(a\n)', output: 'new F(a,\n)', options: ['always'], errors: MISSING_I}, - {code: 'new F(a\n)', output: 'new F(a,\n)', options: ['always-multiline'], errors: MISSING_I}, - - {code: 'new F(...a)', output: 'new F(...a,)', options: ['always'], errors: MISSING_SE}, - {code: 'new F(...a,)', output: 'new F(...a)', options: ['always-multiline'], errors: UNEXPECTED_SE}, - {code: 'new F(...a,)', output: 'new F(...a)', options: ['only-multiline'], errors: UNEXPECTED_SE}, - {code: 'new F(...a,)', output: 'new F(...a)', options: ['never'], errors: UNEXPECTED_SE}, - {code: 'new F(...a,\n)', output: 'new F(...a\n)', options: ['never'], errors: UNEXPECTED_SE}, - {code: 'new F(...a\n)', output: 'new F(...a,\n)', options: ['always'], errors: MISSING_SE}, - {code: 'new F(...a\n)', output: 'new F(...a,\n)', options: ['always-multiline'], errors: MISSING_SE}, - ], -}); diff --git a/eslint/babel-eslint-plugin/tests/rules/generator-star-spacing.js b/eslint/babel-eslint-plugin/tests/rules/generator-star-spacing.js deleted file mode 100644 index 86438a940c7f..000000000000 --- a/eslint/babel-eslint-plugin/tests/rules/generator-star-spacing.js +++ /dev/null @@ -1,1176 +0,0 @@ -/* eslint-disable */ -var rule = require('../../rules/generator-star-spacing'), - RuleTester = require('../RuleTester'); - -var features = { - generators: true -}; - -function ok(code, args){ - return { code: code, options: args, parser: 'babel-eslint', ecmaFeatures: features } -} - -function err(code, errors, args){ - var e = ok(code, args) - e.errors = errors - return e -} - -var ruleTester = new RuleTester(); -ruleTester.run('babel/generator-star-spacing', rule, { - valid: [ - // Default ("before") - { - code: "function foo(){}" - }, - { - code: "function *foo(){}", - ecmaFeatures: { generators: true } - }, - { - code: "function *foo(arg1, arg2){}", - ecmaFeatures: { generators: true } - }, - { - code: "var foo = function *foo(){};", - ecmaFeatures: { generators: true } - }, - { - code: "var foo = function *(){};", - ecmaFeatures: { generators: true } - }, - { - code: "var foo = function * (){};", - ecmaFeatures: { generators: true } - }, - { - code: "var foo = { *foo(){} };", - ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } - }, - { - code: "var foo = {*foo(){} };", - ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } - }, - { - code: "class Foo { *foo(){} }", - ecmaFeatures: { classes: true, generators: true } - }, - { - code: "class Foo {*foo(){} }", - ecmaFeatures: { classes: true, generators: true } - }, - { - code: "class Foo { static *foo(){} }", - ecmaFeatures: { classes: true, generators: true } - }, - - // "before" - { - code: "function foo(){}", - options: ["before"] - }, - { - code: "function *foo(){}", - options: ["before"], - ecmaFeatures: { generators: true } - }, - { - code: "function *foo(arg1, arg2){}", - options: ["before"], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = function *foo(){};", - options: ["before"], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = function *(){};", - options: ["before"], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = function * (){};", - options: ["before"], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = { *foo(){} };", - options: ["before"], - ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } - }, - { - code: "var foo = {*foo(){} };", - options: ["before"], - ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } - }, - { - code: "class Foo { *foo(){} }", - options: ["before"], - ecmaFeatures: { classes: true, generators: true } - }, - { - code: "class Foo {*foo(){} }", - options: ["before"], - ecmaFeatures: { classes: true, generators: true } - }, - { - code: "class Foo { static *foo(){} }", - options: ["before"], - ecmaFeatures: { classes: true, generators: true } - }, - - // "after" - { - code: "function foo(){}", - options: ["after"] - }, - { - code: "function* foo(){}", - options: ["after"], - ecmaFeatures: { generators: true } - }, - { - code: "function* foo(arg1, arg2){}", - options: ["after"], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = function* foo(){};", - options: ["after"], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = function* (){};", - options: ["after"], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = function*(){};", - options: ["after"], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = {* foo(){} };", - options: ["after"], - ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } - }, - { - code: "var foo = { * foo(){} };", - options: ["after"], - ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } - }, - { - code: "class Foo {* foo(){} }", - options: ["after"], - ecmaFeatures: { classes: true, generators: true } - }, - { - code: "class Foo { * foo(){} }", - options: ["after"], - ecmaFeatures: { classes: true, generators: true } - }, - { - code: "class Foo { static* foo(){} }", - options: ["after"], - ecmaFeatures: { classes: true, generators: true } - }, - - // "both" - { - code: "function foo(){}", - options: ["both"] - }, - { - code: "function * foo(){}", - options: ["both"], - ecmaFeatures: { generators: true } - }, - { - code: "function * foo(arg1, arg2){}", - options: ["both"], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = function * foo(){};", - options: ["both"], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = function * (){};", - options: ["both"], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = function *(){};", - options: ["both"], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = { * foo(){} };", - options: ["both"], - ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } - }, - { - code: "var foo = {* foo(){} };", - options: ["both"], - ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } - }, - { - code: "class Foo { * foo(){} }", - options: ["both"], - ecmaFeatures: { classes: true, generators: true } - }, - { - code: "class Foo {* foo(){} }", - options: ["both"], - ecmaFeatures: { classes: true, generators: true } - }, - { - code: "class Foo { static * foo(){} }", - options: ["both"], - ecmaFeatures: { classes: true, generators: true } - }, - - // "neither" - { - code: "function foo(){}", - options: ["neither"] - }, - { - code: "function*foo(){}", - options: ["neither"], - ecmaFeatures: { generators: true } - }, - { - code: "function*foo(arg1, arg2){}", - options: ["neither"], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = function*foo(){};", - options: ["neither"], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = function*(){};", - options: ["neither"], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = function* (){};", - options: ["neither"], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = {*foo(){} };", - options: ["neither"], - ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } - }, - { - code: "var foo = { *foo(){} };", - options: ["neither"], - ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } - }, - { - code: "class Foo {*foo(){} }", - options: ["neither"], - ecmaFeatures: { classes: true, generators: true } - }, - { - code: "class Foo { *foo(){} }", - options: ["neither"], - ecmaFeatures: { classes: true, generators: true } - }, - { - code: "class Foo { static*foo(){} }", - options: ["neither"], - ecmaFeatures: { classes: true, generators: true } - }, - - // {"before": true, "after": false} - { - code: "function foo(){}", - options: [{"before": true, "after": false}] - }, - { - code: "function *foo(){}", - options: [{"before": true, "after": false}], - ecmaFeatures: { generators: true } - }, - { - code: "function *foo(arg1, arg2){}", - options: [{"before": true, "after": false}], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = function *foo(){};", - options: [{"before": true, "after": false}], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = function *(){};", - options: [{"before": true, "after": false}], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = function * (){};", - options: [{"before": true, "after": false}], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = { *foo(){} };", - options: [{"before": true, "after": false}], - ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } - }, - { - code: "var foo = {*foo(){} };", - options: [{"before": true, "after": false}], - ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } - }, - { - code: "class Foo { *foo(){} }", - options: [{"before": true, "after": false}], - ecmaFeatures: { classes: true, generators: true } - }, - { - code: "class Foo {*foo(){} }", - options: [{"before": true, "after": false}], - ecmaFeatures: { classes: true, generators: true } - }, - { - code: "class Foo { static *foo(){} }", - options: [{"before": true, "after": false}], - ecmaFeatures: { classes: true, generators: true } - }, - - // {"before": false, "after": true} - { - code: "function foo(){}", - options: [{"before": false, "after": true}] - }, - { - code: "function* foo(){}", - options: [{"before": false, "after": true}], - ecmaFeatures: { generators: true } - }, - { - code: "function* foo(arg1, arg2){}", - options: [{"before": false, "after": true}], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = function* foo(){};", - options: [{"before": false, "after": true}], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = function* (){};", - options: [{"before": false, "after": true}], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = function*(){};", - options: [{"before": false, "after": true}], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = {* foo(){} };", - options: [{"before": false, "after": true}], - ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } - }, - { - code: "var foo = { * foo(){} };", - options: [{"before": false, "after": true}], - ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } - }, - { - code: "class Foo {* foo(){} }", - options: [{"before": false, "after": true}], - ecmaFeatures: { classes: true, generators: true } - }, - { - code: "class Foo { * foo(){} }", - options: [{"before": false, "after": true}], - ecmaFeatures: { classes: true, generators: true } - }, - { - code: "class Foo { static* foo(){} }", - options: [{"before": false, "after": true}], - ecmaFeatures: { classes: true, generators: true } - }, - - // {"before": true, "after": true} - { - code: "function foo(){}", - options: [{"before": true, "after": true}] - }, - { - code: "function * foo(){}", - options: [{"before": true, "after": true}], - ecmaFeatures: { generators: true } - }, - { - code: "function * foo(arg1, arg2){}", - options: [{"before": true, "after": true}], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = function * foo(){};", - options: [{"before": true, "after": true}], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = function * (){};", - options: [{"before": true, "after": true}], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = function *(){};", - options: [{"before": true, "after": true}], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = { * foo(){} };", - options: [{"before": true, "after": true}], - ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } - }, - { - code: "var foo = {* foo(){} };", - options: [{"before": true, "after": true}], - ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } - }, - { - code: "class Foo { * foo(){} }", - options: [{"before": true, "after": true}], - ecmaFeatures: { classes: true, generators: true } - }, - { - code: "class Foo {* foo(){} }", - options: [{"before": true, "after": true}], - ecmaFeatures: { classes: true, generators: true } - }, - { - code: "class Foo { static * foo(){} }", - options: [{"before": true, "after": true}], - ecmaFeatures: { classes: true, generators: true } - }, - - // {"before": false, "after": false} - { - code: "function foo(){}", - options: [{"before": false, "after": false}] - }, - { - code: "function*foo(){}", - options: [{"before": false, "after": false}], - ecmaFeatures: { generators: true } - }, - { - code: "function*foo(arg1, arg2){}", - options: [{"before": false, "after": false}], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = function*foo(){};", - options: [{"before": false, "after": false}], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = function*(){};", - options: [{"before": false, "after": false}], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = function* (){};", - options: [{"before": false, "after": false}], - ecmaFeatures: { generators: true } - }, - { - code: "var foo = {*foo(){} };", - options: [{"before": false, "after": false}], - ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } - }, - { - code: "var foo = { *foo(){} };", - options: [{"before": false, "after": false}], - ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true } - }, - { - code: "class Foo {*foo(){} }", - options: [{"before": false, "after": false}], - ecmaFeatures: { classes: true, generators: true } - }, - { - code: "class Foo { *foo(){} }", - options: [{"before": false, "after": false}], - ecmaFeatures: { classes: true, generators: true } - }, - { - code: "class Foo { static*foo(){} }", - options: [{"before": false, "after": false}], - ecmaFeatures: { classes: true, generators: true } - }, - - ok('var test = async function(){}'), - ok('async function test(){}'), - ok('var test = async function *(){}'), - ok('async function *test(){}', ["before"]) , - ok('async function* test(){}', ["after"]), - ok('async function * test(){}', ["both"]), - ok('async function*test(){}', ["neither"]), - ], - - invalid: [ - // Default ("before") - { - code: "function*foo(){}", - ecmaFeatures: { generators: true }, - errors: [{ - message: "Missing space before *.", - type: "Punctuator" - }] - }, - { - code: "function* foo(arg1, arg2){}", - ecmaFeatures: { generators: true }, - errors: [{ - message: "Missing space before *.", - type: "Punctuator" - }, { - message: "Unexpected space after *.", - type: "Punctuator" - }] - }, - { - code: "var foo = function*foo(){};", - ecmaFeatures: { generators: true }, - errors: [{ - message: "Missing space before *.", - type: "Punctuator" - }] - }, - { - code: "var foo = function* (){};", - ecmaFeatures: { generators: true }, - errors: [{ - message: "Missing space before *.", - type: "Punctuator" - }] - }, - { - code: "var foo = {* foo(){} };", - ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true }, - errors: [{ - message: "Unexpected space after *.", - type: "Punctuator" - }] - }, - { - code: "class Foo {* foo(){} }", - ecmaFeatures: { classes: true, generators: true }, - errors: [{ - message: "Unexpected space after *.", - type: "Punctuator" - }] - }, - { - code: "class Foo { static* foo(){} }", - ecmaFeatures: { classes: true, generators: true }, - errors: [{ - message: "Missing space before *.", - type: "Punctuator" - }, { - message: "Unexpected space after *.", - type: "Punctuator" - }] - }, - - // "before" - { - code: "function*foo(){}", - options: ["before"], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Missing space before *.", - type: "Punctuator" - }] - }, - { - code: "function* foo(arg1, arg2){}", - options: ["before"], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Missing space before *.", - type: "Punctuator" - }, { - message: "Unexpected space after *.", - type: "Punctuator" - }] - }, - { - code: "var foo = function*foo(){};", - options: ["before"], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Missing space before *.", - type: "Punctuator" - }] - }, - { - code: "var foo = function* (){};", - options: ["before"], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Missing space before *.", - type: "Punctuator" - }] - }, - { - code: "var foo = {* foo(){} };", - options: ["before"], - ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true }, - errors: [{ - message: "Unexpected space after *.", - type: "Punctuator" - }] - }, - { - code: "class Foo {* foo(){} }", - options: ["before"], - ecmaFeatures: { classes: true, generators: true }, - errors: [{ - message: "Unexpected space after *.", - type: "Punctuator" - }] - }, - - // "after" - { - code: "function*foo(){}", - options: ["after"], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Missing space after *.", - type: "Punctuator" - }] - }, - { - code: "function *foo(arg1, arg2){}", - options: ["after"], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Unexpected space before *.", - type: "Punctuator" - }, { - message: "Missing space after *.", - type: "Punctuator" - }] - }, - { - code: "var foo = function *foo(){};", - options: ["after"], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Unexpected space before *.", - type: "Punctuator" - }, { - message: "Missing space after *.", - type: "Punctuator" - }] - }, - { - code: "var foo = function *(){};", - options: ["after"], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Unexpected space before *.", - type: "Punctuator" - }] - }, - { - code: "var foo = { *foo(){} };", - options: ["after"], - ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true }, - errors: [{ - message: "Missing space after *.", - type: "Punctuator" - }] - }, - { - code: "class Foo { *foo(){} }", - options: ["after"], - ecmaFeatures: { classes: true, generators: true }, - errors: [{ - message: "Missing space after *.", - type: "Punctuator" - }] - }, - { - code: "class Foo { static *foo(){} }", - options: ["after"], - ecmaFeatures: { classes: true, generators: true }, - errors: [{ - message: "Unexpected space before *.", - type: "Punctuator" - }, { - message: "Missing space after *.", - type: "Punctuator" - }] - }, - - // "both" - { - code: "function*foo(){}", - options: ["both"], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Missing space before *.", - type: "Punctuator" - }, { - message: "Missing space after *.", - type: "Punctuator" - }] - }, - { - code: "function*foo(arg1, arg2){}", - options: ["both"], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Missing space before *.", - type: "Punctuator" - }, { - message: "Missing space after *.", - type: "Punctuator" - }] - }, - { - code: "var foo = function*foo(){};", - options: ["both"], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Missing space before *.", - type: "Punctuator" - }, { - message: "Missing space after *.", - type: "Punctuator" - }] - }, - { - code: "var foo = function*(){};", - options: ["both"], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Missing space before *.", - type: "Punctuator" - }] - }, - { - code: "var foo = {*foo(){} };", - options: ["both"], - ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true }, - errors: [{ - message: "Missing space after *.", - type: "Punctuator" - }] - }, - { - code: "class Foo {*foo(){} }", - options: ["both"], - ecmaFeatures: { classes: true, generators: true }, - errors: [{ - message: "Missing space after *.", - type: "Punctuator" - }] - }, - { - code: "class Foo { static*foo(){} }", - options: ["both"], - ecmaFeatures: { classes: true, generators: true }, - errors: [{ - message: "Missing space before *.", - type: "Punctuator" - }, { - message: "Missing space after *.", - type: "Punctuator" - }] - }, - - // "neither" - { - code: "function * foo(){}", - options: ["neither"], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Unexpected space before *.", - type: "Punctuator" - }, { - message: "Unexpected space after *.", - type: "Punctuator" - }] - }, - { - code: "function * foo(arg1, arg2){}", - options: ["neither"], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Unexpected space before *.", - type: "Punctuator" - }, { - message: "Unexpected space after *.", - type: "Punctuator" - }] - }, - { - code: "var foo = function * foo(){};", - options: ["neither"], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Unexpected space before *.", - type: "Punctuator" - }, { - message: "Unexpected space after *.", - type: "Punctuator" - }] - }, - { - code: "var foo = function * (){};", - options: ["neither"], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Unexpected space before *.", - type: "Punctuator" - }] - }, - { - code: "var foo = { * foo(){} };", - options: ["neither"], - ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true }, - errors: [{ - message: "Unexpected space after *.", - type: "Punctuator" - }] - }, - { - code: "class Foo { * foo(){} }", - options: ["neither"], - ecmaFeatures: { classes: true, generators: true }, - errors: [{ - message: "Unexpected space after *.", - type: "Punctuator" - }] - }, - { - code: "class Foo { static * foo(){} }", - options: ["neither"], - ecmaFeatures: { classes: true, generators: true }, - errors: [{ - message: "Unexpected space before *.", - type: "Punctuator" - }, { - message: "Unexpected space after *.", - type: "Punctuator" - }] - }, - - // {"before": true, "after": false} - { - code: "function*foo(){}", - options: [{"before": true, "after": false}], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Missing space before *.", - type: "Punctuator" - }] - }, - { - code: "function* foo(arg1, arg2){}", - options: [{"before": true, "after": false}], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Missing space before *.", - type: "Punctuator" - }, { - message: "Unexpected space after *.", - type: "Punctuator" - }] - }, - { - code: "var foo = function*foo(){};", - options: [{"before": true, "after": false}], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Missing space before *.", - type: "Punctuator" - }] - }, - { - code: "var foo = function* (){};", - options: [{"before": true, "after": false}], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Missing space before *.", - type: "Punctuator" - }] - }, - { - code: "var foo = {* foo(){} };", - options: [{"before": true, "after": false}], - ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true }, - errors: [{ - message: "Unexpected space after *.", - type: "Punctuator" - }] - }, - { - code: "class Foo {* foo(){} }", - options: [{"before": true, "after": false}], - ecmaFeatures: { classes: true, generators: true }, - errors: [{ - message: "Unexpected space after *.", - type: "Punctuator" - }] - }, - - // {"before": false, "after": true} - { - code: "function*foo(){}", - options: [{"before": false, "after": true}], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Missing space after *.", - type: "Punctuator" - }] - }, - { - code: "function *foo(arg1, arg2){}", - options: [{"before": false, "after": true}], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Unexpected space before *.", - type: "Punctuator" - }, { - message: "Missing space after *.", - type: "Punctuator" - }] - }, - { - code: "var foo = function *foo(){};", - options: [{"before": false, "after": true}], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Unexpected space before *.", - type: "Punctuator" - }, { - message: "Missing space after *.", - type: "Punctuator" - }] - }, - { - code: "var foo = function *(){};", - options: [{"before": false, "after": true}], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Unexpected space before *.", - type: "Punctuator" - }] - }, - { - code: "var foo = { *foo(){} };", - options: [{"before": false, "after": true}], - ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true }, - errors: [{ - message: "Missing space after *.", - type: "Punctuator" - }] - }, - { - code: "class Foo { *foo(){} }", - options: [{"before": false, "after": true}], - ecmaFeatures: { classes: true, generators: true }, - errors: [{ - message: "Missing space after *.", - type: "Punctuator" - }] - }, - { - code: "class Foo { static *foo(){} }", - options: [{"before": false, "after": true}], - ecmaFeatures: { classes: true, generators: true }, - errors: [{ - message: "Unexpected space before *.", - type: "Punctuator" - }, { - message: "Missing space after *.", - type: "Punctuator" - }] - }, - - // {"before": true, "after": true} - { - code: "function*foo(){}", - options: [{"before": true, "after": true}], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Missing space before *.", - type: "Punctuator" - }, { - message: "Missing space after *.", - type: "Punctuator" - }] - }, - { - code: "function*foo(arg1, arg2){}", - options: [{"before": true, "after": true}], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Missing space before *.", - type: "Punctuator" - }, { - message: "Missing space after *.", - type: "Punctuator" - }] - }, - { - code: "var foo = function*foo(){};", - options: [{"before": true, "after": true}], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Missing space before *.", - type: "Punctuator" - }, { - message: "Missing space after *.", - type: "Punctuator" - }] - }, - { - code: "var foo = function*(){};", - options: [{"before": true, "after": true}], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Missing space before *.", - type: "Punctuator" - }] - }, - { - code: "var foo = {*foo(){} };", - options: [{"before": true, "after": true}], - ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true }, - errors: [{ - message: "Missing space after *.", - type: "Punctuator" - }] - }, - { - code: "class Foo {*foo(){} }", - options: [{"before": true, "after": true}], - ecmaFeatures: { classes: true, generators: true }, - errors: [{ - message: "Missing space after *.", - type: "Punctuator" - }] - }, - { - code: "class Foo { static*foo(){} }", - options: [{"before": true, "after": true}], - ecmaFeatures: { classes: true, generators: true }, - errors: [{ - message: "Missing space before *.", - type: "Punctuator" - }, { - message: "Missing space after *.", - type: "Punctuator" - }] - }, - - // {"before": false, "after": false} - { - code: "function * foo(){}", - options: [{"before": false, "after": false}], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Unexpected space before *.", - type: "Punctuator" - }, { - message: "Unexpected space after *.", - type: "Punctuator" - }] - }, - { - code: "function * foo(arg1, arg2){}", - options: [{"before": false, "after": false}], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Unexpected space before *.", - type: "Punctuator" - }, { - message: "Unexpected space after *.", - type: "Punctuator" - }] - }, - { - code: "var foo = function * foo(){};", - options: [{"before": false, "after": false}], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Unexpected space before *.", - type: "Punctuator" - }, { - message: "Unexpected space after *.", - type: "Punctuator" - }] - }, - { - code: "var foo = function * (){};", - options: [{"before": false, "after": false}], - ecmaFeatures: { generators: true }, - errors: [{ - message: "Unexpected space before *.", - type: "Punctuator" - }] - }, - { - code: "var foo = { * foo(){} };", - options: [{"before": false, "after": false}], - ecmaFeatures: { generators: true, objectLiteralShorthandMethods: true }, - errors: [{ - message: "Unexpected space after *.", - type: "Punctuator" - }] - }, - { - code: "class Foo { * foo(){} }", - options: [{"before": false, "after": false}], - ecmaFeatures: { classes: true, generators: true }, - errors: [{ - message: "Unexpected space after *.", - type: "Punctuator" - }] - }, - { - code: "class Foo { static * foo(){} }", - options: [{"before": false, "after": false}], - ecmaFeatures: { classes: true, generators: true }, - errors: [{ - message: "Unexpected space before *.", - type: "Punctuator" - }, { - message: "Unexpected space after *.", - type: "Punctuator" - }] - }, - err('async function*test(){}', [ - { message: 'Missing space before *.' }, - ]), - err('async function* test(){}', [ - { - message: "Missing space before *.", - type: "Punctuator" - }, { - message: "Unexpected space after *.", - type: "Punctuator" - } - ]), - - ] -}); diff --git a/eslint/babel-eslint-plugin/tests/rules/object-shorthand.js b/eslint/babel-eslint-plugin/tests/rules/object-shorthand.js deleted file mode 100644 index c35c086b51a1..000000000000 --- a/eslint/babel-eslint-plugin/tests/rules/object-shorthand.js +++ /dev/null @@ -1,108 +0,0 @@ -/* eslint-disable */ -var rule = require('../../rules/object-shorthand'), - RuleTester = require('../RuleTester'); - -var features = { - objectLiteralShorthandMethods: true, - objectLiteralComputedProperties: true, - objectLiteralShorthandProperties: true, - arrowFunctions: true, - destructuring: true, - generators: true -}; - -function ok(code, args){ - return { code: code, parser: 'babel-eslint', ecmaFeatures: features} -} - - -var ruleTester = new RuleTester(); -ruleTester.run('babel/object-shorthand', rule, { - valid: [ - //original test cases - { code: "var x = {y() {}}", ecmaFeatures: features }, - { code: "var x = {y}", ecmaFeatures: features }, - { code: "var x = {a: b}", ecmaFeatures: features }, - { code: "var x = {a: 'a'}", ecmaFeatures: features }, - { code: "var x = {'a': 'a'}", ecmaFeatures: features }, - { code: "var x = {'a': b}", ecmaFeatures: features }, - { code: "var x = {y(x) {}}", ecmaFeatures: features }, - { code: "var {x,y,z} = x", ecmaFeatures: features }, - { code: "var {x: {y}} = z", ecmaFeatures: features }, - { code: "var x = {*x() {}}", ecmaFeatures: features }, - { code: "var x = {x: y}", ecmaFeatures: features }, - { code: "var x = {x: y, y: z}", ecmaFeatures: features}, - { code: "var x = {x: y, y: z, z: 'z'}", ecmaFeatures: features}, - { code: "var x = {x() {}, y: z, l(){}}", ecmaFeatures: features}, - { code: "var x = {x: y, y: z, a: b}", ecmaFeatures: features}, - { code: "var x = {x: y, y: z, 'a': b}", ecmaFeatures: features}, - { code: "var x = {x: y, y() {}, z: a}", ecmaFeatures: features}, - { code: "doSomething({x: y})", ecmaFeatures: features}, - { code: "doSomething({'x': y})", ecmaFeatures: features}, - { code: "doSomething({x: 'x'})", ecmaFeatures: features}, - { code: "doSomething({'x': 'x'})", ecmaFeatures: features}, - { code: "doSomething({y() {}})", ecmaFeatures: features}, - { code: "doSomething({x: y, y() {}})", ecmaFeatures: features}, - { code: "doSomething({y() {}, z: a})", ecmaFeatures: features}, - { code: "!{ a: function a(){} };", ecmaFeatures: features }, - - // arrows functions are still alright - { code: "var x = {y: (x)=>x}", ecmaFeatures: features }, - { code: "doSomething({y: (x)=>x})", ecmaFeatures: features }, - { code: "var x = {y: (x)=>x, y: a}", ecmaFeatures: features }, - { code: "doSomething({x, y: (x)=>x})", ecmaFeatures: features }, - - // getters and setters are ok - { code: "var x = {get y() {}}", ecmaFeatures: features }, - { code: "var x = {set y(z) {}}", ecmaFeatures: features }, - { code: "var x = {get y() {}, set y(z) {}}", ecmaFeatures: features }, - { code: "doSomething({get y() {}})", ecmaFeatures: features }, - { code: "doSomething({set y(z) {}})", ecmaFeatures: features }, - { code: "doSomething({get y() {}, set y(z) {}})", ecmaFeatures: features }, - - // object literal computed properties - { code: "var x = {[y]: y}", ecmaFeatures: features, options: ["properties"] }, - { code: "var x = {['y']: 'y'}", ecmaFeatures: features, options: ["properties"] }, - { code: "var x = {['y']: y}", ecmaFeatures: features, options: ["properties"] }, - - // options - { code: "var x = {y() {}}", ecmaFeatures: features, options: ["methods"] }, - { code: "var x = {x, y() {}, a:b}", ecmaFeatures: features, options: ["methods"] }, - { code: "var x = {y}", ecmaFeatures: features, options: ["properties"] }, - { code: "var x = {y: {b}}", ecmaFeatures: features, options: ["properties"] }, - { code: "var x = {a: n, c: d, f: g}", ecmaFeatures: features, options: ["never"] }, - { code: "var x = {a: function(){}, b: {c: d}}", ecmaFeatures: features, options: ["never"] }, - - // Babel test cases. - ok('let { ...spread } = obj'), - ok('let { ...spread } = obj', [2, 'never']), - ], - - invalid: [ - { code: "var x = {x: x}", ecmaFeatures: features, errors: [{ message: "Expected property shorthand.", type: "Property" }] }, - { code: "var x = {'x': x}", ecmaFeatures: features, errors: [{ message: "Expected property shorthand.", type: "Property" }] }, - { code: "var x = {y: y, x: x}", ecmaFeatures: features, errors: [{ message: "Expected property shorthand.", type: "Property" }, { message: "Expected property shorthand.", type: "Property" }] }, - { code: "var x = {y: z, x: x, a: b}", ecmaFeatures: features, errors: [{ message: "Expected property shorthand.", type: "Property" }] }, - { code: "var x = {y: function() {}}", ecmaFeatures: features, errors: [{ message: "Expected method shorthand.", type: "Property" }] }, - { code: "var x = {y: function*() {}}", ecmaFeatures: features, errors: [{ message: "Expected method shorthand.", type: "Property" }] }, - { code: "var x = {x: y, y: z, a: a}", ecmaFeatures: features, errors: [{ message: "Expected property shorthand.", type: "Property" }] }, - { code: "var x = {x: y, y: z, a: function(){}, b() {}}", ecmaFeatures: features, errors: [{ message: "Expected method shorthand.", type: "Property" }] }, - { code: "var x = {x: x, y: function() {}}", ecmaFeatures: features, errors: [{ message: "Expected property shorthand.", type: "Property" }, { message: "Expected method shorthand.", type: "Property" }]}, - { code: "doSomething({x: x})", ecmaFeatures: features, errors: [{ message: "Expected property shorthand.", type: "Property" }] }, - { code: "doSomething({'x': x})", ecmaFeatures: features, errors: [{ message: "Expected property shorthand.", type: "Property" }] }, - { code: "doSomething({a: 'a', 'x': x})", ecmaFeatures: features, errors: [{ message: "Expected property shorthand.", type: "Property" }] }, - { code: "doSomething({y: function() {}})", ecmaFeatures: features, errors: [{ message: "Expected method shorthand.", type: "Property" }] }, - - // options - { code: "var x = {y: function() {}}", ecmaFeatures: features, errors: [{ message: "Expected method shorthand.", type: "Property" }], options: ["methods"] }, - { code: "var x = {x, y() {}, z: function() {}}", ecmaFeatures: features, errors: [{ message: "Expected method shorthand.", type: "Property" }], options: ["methods"] }, - { code: "var x = {x: x}", ecmaFeatures: features, errors: [{ message: "Expected property shorthand.", type: "Property" }], options: ["properties"] }, - { code: "var x = {a, b, c(){}, x: x}", ecmaFeatures: features, errors: [{ message: "Expected property shorthand.", type: "Property" }], options: ["properties"] }, - { code: "var x = {y() {}}", ecmaFeatures: features, errors: [{ message: "Expected longform method syntax.", type: "Property" }], options: ["never"] }, - { code: "var x = {*y() {}}", ecmaFeatures: features, errors: [{ message: "Expected longform method syntax.", type: "Property" }], options: ["never"] }, - { code: "var x = {y}", ecmaFeatures: features, errors: [{ message: "Expected longform property syntax.", type: "Property" }], options: ["never"]}, - { code: "var x = {y, a: b, *x(){}}", ecmaFeatures: features, errors: [{ message: "Expected longform property syntax.", type: "Property" }, { message: "Expected longform method syntax.", type: "Property" }], options: ["never"]}, - { code: "var x = {y: {x}}", ecmaFeatures: features, errors: [{ message: "Expected longform property syntax.", type: "Property" }], options: ["never"]} - - ] -}); From 9c9bff745ced370e84bf949f4d0fb3bd754199e9 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 17 Nov 2016 16:45:47 -0500 Subject: [PATCH 518/569] readme: drop node < 4 [skip ci] --- eslint/babel-eslint-plugin/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md index 5a84afbabe8f..157bd2d79ce7 100644 --- a/eslint/babel-eslint-plugin/README.md +++ b/eslint/babel-eslint-plugin/README.md @@ -4,6 +4,8 @@ An `eslint` plugin companion to `babel-eslint`. `babel-eslint` does a great job for use with Babel, but it can't change the built in rules to support experimental features. `eslint-plugin-babel` re-implements problematic rules so they do not give false positives or negatives. +> Requires Node 4 or greater + ### Install ```sh From 3855f28ebb4f59b9c7e1f60120a5f9b3b23083c7 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 17 Nov 2016 16:46:29 -0500 Subject: [PATCH 519/569] 4.0.0 --- eslint/babel-eslint-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index f372bd09cf1c..61dca492c1c9 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-babel", - "version": "3.3.0", + "version": "4.0.0", "description": "an eslint rule plugin companion to babel-eslint", "main": "index.js", "scripts": { From 7f94d5f75fd60ed81650d798c2d52ed4741216c2 Mon Sep 17 00:00:00 2001 From: Matthew Wagerfield Date: Wed, 18 Jan 2017 23:01:31 +0000 Subject: [PATCH 520/569] Updated rules to new format, added deprecated flag (babel/eslint-plugin-babel#119) --- .../rules/array-bracket-spacing.js | 68 ++++++++++--------- .../babel-eslint-plugin/rules/arrow-parens.js | 40 ++++++----- .../rules/flow-object-type.js | 42 ++++++------ .../rules/func-params-comma-dangle.js | 40 ++++++----- .../rules/generator-star-spacing.js | 62 +++++++++-------- .../rules/object-shorthand.js | 40 ++++++----- 6 files changed, 158 insertions(+), 134 deletions(-) diff --git a/eslint/babel-eslint-plugin/rules/array-bracket-spacing.js b/eslint/babel-eslint-plugin/rules/array-bracket-spacing.js index a7da50b78573..0a9ba375216b 100644 --- a/eslint/babel-eslint-plugin/rules/array-bracket-spacing.js +++ b/eslint/babel-eslint-plugin/rules/array-bracket-spacing.js @@ -1,39 +1,43 @@ "use strict"; var isWarnedForDeprecation = false; -module.exports = function() { - return { - Program() { - if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { - return; +module.exports = { + meta: { + deprecated: true, + schema: [ + { + "enum": ["always", "never"] + }, + { + "type": "object", + "properties": { + "singleValue": { + "type": "boolean" + }, + "objectsInArrays": { + "type": "boolean" + }, + "arraysInArrays": { + "type": "boolean" + } + }, + "additionalProperties": false } - - /* eslint-disable no-console */ - console.log('The babel/array-bracket-spacing rule is deprecated. Please ' + - 'use the built in array-bracket-spacing rule instead.'); - /* eslint-enable no-console */ - isWarnedForDeprecation = true; - } - }; -}; - -module.exports.schema = [ - { - "enum": ["always", "never"] + ] }, - { - "type": "object", - "properties": { - "singleValue": { - "type": "boolean" - }, - "objectsInArrays": { - "type": "boolean" - }, - "arraysInArrays": { - "type": "boolean" + create: function() { + return { + Program: function() { + if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { + return; + } + + /* eslint-disable no-console */ + console.log('The babel/array-bracket-spacing rule is deprecated. Please ' + + 'use the built in array-bracket-spacing rule instead.'); + /* eslint-enable no-console */ + isWarnedForDeprecation = true; } - }, - "additionalProperties": false + }; } -]; +}; diff --git a/eslint/babel-eslint-plugin/rules/arrow-parens.js b/eslint/babel-eslint-plugin/rules/arrow-parens.js index 03f50dcfd07c..13d9c8ffe01b 100644 --- a/eslint/babel-eslint-plugin/rules/arrow-parens.js +++ b/eslint/babel-eslint-plugin/rules/arrow-parens.js @@ -1,24 +1,28 @@ "use strict"; var isWarnedForDeprecation = false; -module.exports = function() { - return { - Program() { - if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { - return; +module.exports = { + meta: { + deprecated: true, + schema: [ + { + "enum": ["always", "as-needed"] } + ] + }, + create: function() { + return { + Program: function() { + if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { + return; + } - /* eslint-disable no-console */ - console.log('The babel/arrow-parens rule is deprecated. Please ' + - 'use the built in arrow-parens rule instead.'); - /* eslint-enable no-console */ - isWarnedForDeprecation = true; - } - }; -}; - -module.exports.schema = [ - { - "enum": ["always", "as-needed"] + /* eslint-disable no-console */ + console.log('The babel/arrow-parens rule is deprecated. Please ' + + 'use the built in arrow-parens rule instead.'); + /* eslint-enable no-console */ + isWarnedForDeprecation = true; + } + }; } -]; +}; diff --git a/eslint/babel-eslint-plugin/rules/flow-object-type.js b/eslint/babel-eslint-plugin/rules/flow-object-type.js index 530efb8d653d..73cd3ed17a47 100644 --- a/eslint/babel-eslint-plugin/rules/flow-object-type.js +++ b/eslint/babel-eslint-plugin/rules/flow-object-type.js @@ -1,25 +1,29 @@ "use strict"; var isWarnedForDeprecation = false; -module.exports = function() { - return { - Program() { - if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { - return; +module.exports = { + meta: { + deprecated: true, + schema: [ + { + "enum": ["semicolon", "comma"], } + ] + }, + create: function() { + return { + Program: function() { + if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { + return; + } - /* eslint-disable no-console */ - console.log('The babel/flow-object-type rule is deprecated. Please ' + - 'use the flowtype/object-type-delimiter rule instead.\n' + - 'Check out https://github.com/gajus/eslint-plugin-flowtype#eslint-plugin-flowtype-rules-object-type-delimiter'); - /* eslint-enable no-console */ - isWarnedForDeprecation = true; - } - }; + /* eslint-disable no-console */ + console.log('The babel/flow-object-type rule is deprecated. Please ' + + 'use the flowtype/object-type-delimiter rule instead.\n' + + 'Check out https://github.com/gajus/eslint-plugin-flowtype#eslint-plugin-flowtype-rules-object-type-delimiter'); + /* eslint-enable no-console */ + isWarnedForDeprecation = true; + } + }; + } }; - -module.exports.schema = [ - { - 'enum': ['semicolon', 'comma'], - } -]; diff --git a/eslint/babel-eslint-plugin/rules/func-params-comma-dangle.js b/eslint/babel-eslint-plugin/rules/func-params-comma-dangle.js index bf5c1eee5c3d..0290d81323d4 100644 --- a/eslint/babel-eslint-plugin/rules/func-params-comma-dangle.js +++ b/eslint/babel-eslint-plugin/rules/func-params-comma-dangle.js @@ -1,24 +1,28 @@ 'use strict'; var isWarnedForDeprecation = false; -module.exports = function() { - return { - Program() { - if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { - return; +module.exports = { + meta: { + deprecated: true, + schema: [ + { + "enum": ["always", "always-multiline", "only-multiline", "never"] } + ] + }, + create: function() { + return { + Program: function() { + if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { + return; + } - /* eslint-disable no-console */ - console.log('The babel/func-params-comma-dangle rule is deprecated. Please ' + - 'use the built in comma-dangle rule instead.'); - /* eslint-enable no-console */ - isWarnedForDeprecation = true; - } - }; + /* eslint-disable no-console */ + console.log('The babel/func-params-comma-dangle rule is deprecated. Please ' + + 'use the built in comma-dangle rule instead.'); + /* eslint-enable no-console */ + isWarnedForDeprecation = true; + } + }; + } }; - -module.exports.schema = [ - { - enum: ['always', 'always-multiline', 'only-multiline', 'never'] - } -]; diff --git a/eslint/babel-eslint-plugin/rules/generator-star-spacing.js b/eslint/babel-eslint-plugin/rules/generator-star-spacing.js index 38d586c6e365..64186ffe680f 100644 --- a/eslint/babel-eslint-plugin/rules/generator-star-spacing.js +++ b/eslint/babel-eslint-plugin/rules/generator-star-spacing.js @@ -1,36 +1,40 @@ "use strict"; var isWarnedForDeprecation = false; -module.exports = function() { - return { - Program() { - if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { - return; - } - - /* eslint-disable no-console */ - console.log('The babel/generator-star-spacing rule is deprecated. Please ' + - 'use the built in generator-star-spacing rule instead.'); - /* eslint-enable no-console */ - isWarnedForDeprecation = true; - } - }; -}; - -module.exports.schema = [ - { - "oneOf": [ +module.exports = { + meta: { + deprecated: true, + schema: [ { - "enum": ["before", "after", "both", "neither"] - }, - { - "type": "object", - "properties": { - "before": {"type": "boolean"}, - "after": {"type": "boolean"} - }, - "additionalProperties": false + "oneOf": [ + { + "enum": ["before", "after", "both", "neither"] + }, + { + "type": "object", + "properties": { + "before": {"type": "boolean"}, + "after": {"type": "boolean"} + }, + "additionalProperties": false + } + ] } ] + }, + create: function() { + return { + Program: function() { + if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { + return; + } + + /* eslint-disable no-console */ + console.log('The babel/generator-star-spacing rule is deprecated. Please ' + + 'use the built in generator-star-spacing rule instead.'); + /* eslint-enable no-console */ + isWarnedForDeprecation = true; + } + }; } -]; +}; diff --git a/eslint/babel-eslint-plugin/rules/object-shorthand.js b/eslint/babel-eslint-plugin/rules/object-shorthand.js index eaf24a1803ed..73ce1365ba40 100644 --- a/eslint/babel-eslint-plugin/rules/object-shorthand.js +++ b/eslint/babel-eslint-plugin/rules/object-shorthand.js @@ -1,24 +1,28 @@ "use strict"; var isWarnedForDeprecation = false; -module.exports = function() { - return { - Program() { - if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { - return; +module.exports = { + meta: { + deprecated: true, + schema: [ + { + "enum": ["always", "methods", "properties", "never"] } + ] + }, + create: function() { + return { + Program: function() { + if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { + return; + } - /* eslint-disable no-console */ - console.log('The babel/object-shorthand rule is deprecated. Please ' + - 'use the built in object-shorthand rule instead.'); - /* eslint-enable no-console */ - isWarnedForDeprecation = true; - } - }; + /* eslint-disable no-console */ + console.log('The babel/object-shorthand rule is deprecated. Please ' + + 'use the built in object-shorthand rule instead.'); + /* eslint-enable no-console */ + isWarnedForDeprecation = true; + } + }; + } }; - -module.exports.schema = [ - { - 'enum': ['always', 'methods', 'properties', 'never'] - } -]; From 4b52a4c70711206c7e6023a3e3964c064436e992 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 18 Jan 2017 18:03:24 -0500 Subject: [PATCH 521/569] 4.0.1 --- eslint/babel-eslint-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index 61dca492c1c9..f5c621e31361 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-babel", - "version": "4.0.0", + "version": "4.0.1", "description": "an eslint rule plugin companion to babel-eslint", "main": "index.js", "scripts": { From 71202609b57a1a51f317cee9eba5da55b78872e7 Mon Sep 17 00:00:00 2001 From: Aaron Jensen Date: Mon, 27 Feb 2017 11:58:50 -0800 Subject: [PATCH 522/569] Add babel semi (babel/eslint-plugin-babel#121) * Add semi from eslint * Add ClassProperty support to semi rule Fixes babel/eslint-plugin-babel#43 --- eslint/babel-eslint-plugin/README.md | 4 +- eslint/babel-eslint-plugin/index.js | 2 + eslint/babel-eslint-plugin/rules/semi.js | 225 ++++++++++++++++++ .../babel-eslint-plugin/tests/rules/semi.js | 191 +++++++++++++++ 4 files changed, 421 insertions(+), 1 deletion(-) create mode 100644 eslint/babel-eslint-plugin/rules/semi.js create mode 100644 eslint/babel-eslint-plugin/tests/rules/semi.js diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md index 157bd2d79ce7..9444f93f9ced 100644 --- a/eslint/babel-eslint-plugin/README.md +++ b/eslint/babel-eslint-plugin/README.md @@ -32,7 +32,8 @@ original ones as well!). "babel/object-curly-spacing": 1, "babel/no-await-in-loop": 1, "babel/flow-object-type": 1, - "babel/no-invalid-this": 1 + "babel/no-invalid-this": 1, + "babel/semi": 1 } } ``` @@ -45,6 +46,7 @@ Each rule corresponds to a core `eslint` rule, and has the same options. - `babel/new-cap`: Ignores capitalized decorators (`@Decorator`) - `babel/object-curly-spacing`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` (🛠 ) - `babel/no-invalid-this`: doesn't fail when inside class properties (`class A { a = this.b; }`) +- `babel/semi`: Includes class properties (🛠 ) The following rules are not in `eslint`, but are relevant only to syntax that is not specified by the current JavaScript standard or supported by `eslint`. diff --git a/eslint/babel-eslint-plugin/index.js b/eslint/babel-eslint-plugin/index.js index efba7b74eb37..ffc2cf994a93 100644 --- a/eslint/babel-eslint-plugin/index.js +++ b/eslint/babel-eslint-plugin/index.js @@ -12,6 +12,7 @@ module.exports = { 'flow-object-type': require('./rules/flow-object-type'), 'func-params-comma-dangle': require('./rules/func-params-comma-dangle'), 'no-invalid-this': require('./rules/no-invalid-this'), + 'semi': require('./rules/semi'), }, rulesConfig: { 'generator-star-spacing': 0, @@ -24,5 +25,6 @@ module.exports = { 'flow-object-type': 0, 'func-params-comma-dangle': 0, 'no-invalid-this': 0, + 'semi': 0, } }; diff --git a/eslint/babel-eslint-plugin/rules/semi.js b/eslint/babel-eslint-plugin/rules/semi.js new file mode 100644 index 000000000000..48bbb7e49673 --- /dev/null +++ b/eslint/babel-eslint-plugin/rules/semi.js @@ -0,0 +1,225 @@ +/** + * @fileoverview Rule to flag missing semicolons. + * @author Nicholas C. Zakas + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = { + meta: { + docs: { + description: "require or disallow semicolons instead of ASI", + category: "Stylistic Issues", + recommended: false + }, + + fixable: "code", + + schema: { + anyOf: [ + { + type: "array", + items: [ + { + enum: ["never"] + } + ], + minItems: 0, + maxItems: 1 + }, + { + type: "array", + items: [ + { + enum: ["always"] + }, + { + type: "object", + properties: { + omitLastInOneLineBlock: { type: "boolean" } + }, + additionalProperties: false + } + ], + minItems: 0, + maxItems: 2 + } + ] + } + }, + + create(context) { + + const OPT_OUT_PATTERN = /^[-[(/+`]/; // One of [(/+-` + const options = context.options[1]; + const never = context.options[0] === "never", + exceptOneLine = options && options.omitLastInOneLineBlock === true, + sourceCode = context.getSourceCode(); + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + /** + * Reports a semicolon error with appropriate location and message. + * @param {ASTNode} node The node with an extra or missing semicolon. + * @param {boolean} missing True if the semicolon is missing. + * @returns {void} + */ + function report(node, missing) { + const lastToken = sourceCode.getLastToken(node); + let message, + fix, + loc = lastToken.loc; + + if (!missing) { + message = "Missing semicolon."; + loc = loc.end; + fix = function(fixer) { + return fixer.insertTextAfter(lastToken, ";"); + }; + } else { + message = "Extra semicolon."; + loc = loc.start; + fix = function(fixer) { + return fixer.remove(lastToken); + }; + } + + context.report({ + node, + loc, + message, + fix + }); + + } + + /** + * Checks whether a token is a semicolon punctuator. + * @param {Token} token The token. + * @returns {boolean} True if token is a semicolon punctuator. + */ + function isSemicolon(token) { + return (token.type === "Punctuator" && token.value === ";"); + } + + /** + * Check if a semicolon is unnecessary, only true if: + * - next token is on a new line and is not one of the opt-out tokens + * - next token is a valid statement divider + * @param {Token} lastToken last token of current node. + * @returns {boolean} whether the semicolon is unnecessary. + */ + function isUnnecessarySemicolon(lastToken) { + if (!isSemicolon(lastToken)) { + return false; + } + + const nextToken = sourceCode.getTokenAfter(lastToken); + + if (!nextToken) { + return true; + } + + const lastTokenLine = lastToken.loc.end.line; + const nextTokenLine = nextToken.loc.start.line; + const isOptOutToken = OPT_OUT_PATTERN.test(nextToken.value) && nextToken.value !== "++" && nextToken.value !== "--"; + const isDivider = (nextToken.value === "}" || nextToken.value === ";"); + + return (lastTokenLine !== nextTokenLine && !isOptOutToken) || isDivider; + } + + /** + * Checks a node to see if it's in a one-liner block statement. + * @param {ASTNode} node The node to check. + * @returns {boolean} whether the node is in a one-liner block statement. + */ + function isOneLinerBlock(node) { + const nextToken = sourceCode.getTokenAfter(node); + + if (!nextToken || nextToken.value !== "}") { + return false; + } + + const parent = node.parent; + + return parent && parent.type === "BlockStatement" && + parent.loc.start.line === parent.loc.end.line; + } + + /** + * Checks a node to see if it's followed by a semicolon. + * @param {ASTNode} node The node to check. + * @returns {void} + */ + function checkForSemicolon(node) { + const lastToken = sourceCode.getLastToken(node); + + if (never) { + if (isUnnecessarySemicolon(lastToken)) { + report(node, true); + } + } else { + if (!isSemicolon(lastToken)) { + if (!exceptOneLine || !isOneLinerBlock(node)) { + report(node); + } + } else { + if (exceptOneLine && isOneLinerBlock(node)) { + report(node, true); + } + } + } + } + + /** + * Checks to see if there's a semicolon after a variable declaration. + * @param {ASTNode} node The node to check. + * @returns {void} + */ + function checkForSemicolonForVariableDeclaration(node) { + const ancestors = context.getAncestors(), + parentIndex = ancestors.length - 1, + parent = ancestors[parentIndex]; + + if ((parent.type !== "ForStatement" || parent.init !== node) && + (!/^For(?:In|Of)Statement/.test(parent.type) || parent.left !== node) + ) { + checkForSemicolon(node); + } + } + + //-------------------------------------------------------------------------- + // Public API + //-------------------------------------------------------------------------- + + return { + VariableDeclaration: checkForSemicolonForVariableDeclaration, + ExpressionStatement: checkForSemicolon, + ReturnStatement: checkForSemicolon, + ThrowStatement: checkForSemicolon, + DoWhileStatement: checkForSemicolon, + DebuggerStatement: checkForSemicolon, + BreakStatement: checkForSemicolon, + ContinueStatement: checkForSemicolon, + ImportDeclaration: checkForSemicolon, + ExportAllDeclaration: checkForSemicolon, + ClassProperty: checkForSemicolon, + ExportNamedDeclaration(node) { + if (!node.declaration) { + checkForSemicolon(node); + } + }, + ExportDefaultDeclaration(node) { + if (!/(?:Class|Function)Declaration/.test(node.declaration.type)) { + checkForSemicolon(node); + } + } + }; + + } +}; diff --git a/eslint/babel-eslint-plugin/tests/rules/semi.js b/eslint/babel-eslint-plugin/tests/rules/semi.js new file mode 100644 index 000000000000..3d146a1b8d04 --- /dev/null +++ b/eslint/babel-eslint-plugin/tests/rules/semi.js @@ -0,0 +1,191 @@ +/* eslnit-disable */ +/** + * @fileoverview Tests for semi rule. + * @author Nicholas C. Zakas + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const rule = require("../../rules/semi"), + RuleTester = require("../RuleTester"); + +const ruleTester = new RuleTester(); + +ruleTester.run("semi", rule, { + valid: [ + "var x = 5;", + "var x =5, y;", + "foo();", + "x = foo();", + "setTimeout(function() {foo = \"bar\"; });", + "setTimeout(function() {foo = \"bar\";});", + "for (var a in b){}", + "for (var i;;){}", + "if (true) {}\n;[global, extended].forEach(function(){});", + "throw new Error('foo');", + { code: "throw new Error('foo')", options: ["never"] }, + { code: "var x = 5", options: ["never"] }, + { code: "var x =5, y", options: ["never"] }, + { code: "foo()", options: ["never"] }, + { code: "debugger", options: ["never"] }, + { code: "for (var a in b){}", options: ["never"] }, + { code: "for (var i;;){}", options: ["never"] }, + { code: "x = foo()", options: ["never"] }, + { code: "if (true) {}\n;[global, extended].forEach(function(){})", options: ["never"] }, + { code: "(function bar() {})\n;(function foo(){})", options: ["never"] }, + { code: ";/foo/.test('bar')", options: ["never"] }, + { code: ";+5", options: ["never"] }, + { code: ";-foo()", options: ["never"] }, + { code: "a++\nb++", options: ["never"] }, + { code: "a++; b++", options: ["never"] }, + { code: "for (let thing of {}) {\n console.log(thing);\n}", parserOptions: { ecmaVersion: 6 } }, + { code: "do{}while(true)", options: ["never"] }, + { code: "do{}while(true);", options: ["always"] }, + + { code: "if (foo) { bar() }", options: ["always", { omitLastInOneLineBlock: true }] }, + { code: "if (foo) { bar(); baz() }", options: ["always", { omitLastInOneLineBlock: true }] }, + + + // method definitions don't have a semicolon. + { code: "class A { a() {} b() {} }", parserOptions: { ecmaVersion: 6 } }, + { code: "var A = class { a() {} b() {} };", parserOptions: { ecmaVersion: 6 } }, + + { code: "import theDefault, { named1, named2 } from 'src/mylib';", parserOptions: { sourceType: "module" } }, + { code: "import theDefault, { named1, named2 } from 'src/mylib'", options: ["never"], parserOptions: { sourceType: "module" } }, + + // exports, "always" + { code: "export * from 'foo';", parserOptions: { sourceType: "module" } }, + { code: "export { foo } from 'foo';", parserOptions: { sourceType: "module" } }, + { code: "export { foo };", parserOptions: { sourceType: "module" } }, + { code: "export var foo;", parserOptions: { sourceType: "module" } }, + { code: "export function foo () { }", parserOptions: { sourceType: "module" } }, + { code: "export function* foo () { }", parserOptions: { sourceType: "module" } }, + { code: "export class Foo { }", parserOptions: { sourceType: "module" } }, + { code: "export let foo;", parserOptions: { sourceType: "module" } }, + { code: "export const FOO = 42;", parserOptions: { sourceType: "module" } }, + { code: "export default function() { }", parserOptions: { sourceType: "module" } }, + { code: "export default function* () { }", parserOptions: { sourceType: "module" } }, + { code: "export default class { }", parserOptions: { sourceType: "module" } }, + { code: "export default foo || bar;", parserOptions: { sourceType: "module" } }, + { code: "export default (foo) => foo.bar();", parserOptions: { sourceType: "module" } }, + { code: "export default foo = 42;", parserOptions: { sourceType: "module" } }, + { code: "export default foo += 42;", parserOptions: { sourceType: "module" } }, + + // exports, "never" + { code: "export * from 'foo'", options: ["never"], parserOptions: { sourceType: "module" } }, + { code: "export { foo } from 'foo'", options: ["never"], parserOptions: { sourceType: "module" } }, + { code: "export { foo }", options: ["never"], parserOptions: { sourceType: "module" } }, + { code: "export var foo", options: ["never"], parserOptions: { sourceType: "module" } }, + { code: "export function foo () { }", options: ["never"], parserOptions: { sourceType: "module" } }, + { code: "export function* foo () { }", options: ["never"], parserOptions: { sourceType: "module" } }, + { code: "export class Foo { }", options: ["never"], parserOptions: { sourceType: "module" } }, + { code: "export let foo", options: ["never"], parserOptions: { sourceType: "module" } }, + { code: "export const FOO = 42", options: ["never"], parserOptions: { sourceType: "module" } }, + { code: "export default function() { }", options: ["never"], parserOptions: { sourceType: "module" } }, + { code: "export default function* () { }", options: ["never"], parserOptions: { sourceType: "module" } }, + { code: "export default class { }", options: ["never"], parserOptions: { sourceType: "module" } }, + { code: "export default foo || bar", options: ["never"], parserOptions: { sourceType: "module" } }, + { code: "export default (foo) => foo.bar()", options: ["never"], parserOptions: { sourceType: "module" } }, + { code: "export default foo = 42", options: ["never"], parserOptions: { sourceType: "module" } }, + { code: "export default foo += 42", options: ["never"], parserOptions: { sourceType: "module" } }, + { code: "++\nfoo;", options: ["always"] }, + { code: "var a = b;\n+ c", options: ["never"] }, + + // https://github.com/eslint/eslint/issues/7782 + { code: "var a = b;\n/foo/.test(c)", options: ["never"] }, + { code: "var a = b;\n`foo`", options: ["never"], parserOptions: { ecmaVersion: 6 } }, + + // babel + "class Foo { bar = 'example'; }", + "class Foo { static bar = 'example'; }", + + // babel, "never" + { code: "class Foo { bar = 'example' }", options: ["never"] }, + { code: "class Foo { static bar = 'example' }", options: ["never"] } + ], + invalid: [ + { code: "import * as utils from './utils'", output: "import * as utils from './utils';", parserOptions: { sourceType: "module" }, errors: [{ message: "Missing semicolon.", type: "ImportDeclaration", column: 33 }] }, + { code: "import { square, diag } from 'lib'", output: "import { square, diag } from 'lib';", parserOptions: { sourceType: "module" }, errors: [{ message: "Missing semicolon.", type: "ImportDeclaration" }] }, + { code: "import { default as foo } from 'lib'", output: "import { default as foo } from 'lib';", parserOptions: { sourceType: "module" }, errors: [{ message: "Missing semicolon.", type: "ImportDeclaration" }] }, + { code: "import 'src/mylib'", output: "import 'src/mylib';", parserOptions: { sourceType: "module" }, errors: [{ message: "Missing semicolon.", type: "ImportDeclaration" }] }, + { code: "import theDefault, { named1, named2 } from 'src/mylib'", output: "import theDefault, { named1, named2 } from 'src/mylib';", parserOptions: { sourceType: "module" }, errors: [{ message: "Missing semicolon.", type: "ImportDeclaration" }] }, + { code: "function foo() { return [] }", output: "function foo() { return []; }", errors: [{ message: "Missing semicolon.", type: "ReturnStatement" }] }, + { code: "while(true) { break }", output: "while(true) { break; }", errors: [{ message: "Missing semicolon.", type: "BreakStatement" }] }, + { code: "while(true) { continue }", output: "while(true) { continue; }", errors: [{ message: "Missing semicolon.", type: "ContinueStatement" }] }, + { code: "let x = 5", output: "let x = 5;", parserOptions: { ecmaVersion: 6 }, errors: [{ message: "Missing semicolon.", type: "VariableDeclaration" }] }, + { code: "var x = 5", output: "var x = 5;", errors: [{ message: "Missing semicolon.", type: "VariableDeclaration" }] }, + { code: "var x = 5, y", output: "var x = 5, y;", errors: [{ message: "Missing semicolon.", type: "VariableDeclaration" }] }, + { code: "debugger", output: "debugger;", errors: [{ message: "Missing semicolon.", type: "DebuggerStatement" }] }, + { code: "foo()", output: "foo();", errors: [{ message: "Missing semicolon.", type: "ExpressionStatement" }] }, + { code: "var x = 5, y", output: "var x = 5, y;", errors: [{ message: "Missing semicolon.", type: "VariableDeclaration" }] }, + { code: "for (var a in b) var i ", output: "for (var a in b) var i; ", errors: [{ message: "Missing semicolon.", type: "VariableDeclaration" }] }, + { code: "for (;;){var i}", output: "for (;;){var i;}", errors: [{ message: "Missing semicolon.", type: "VariableDeclaration" }] }, + { code: "for (;;) var i ", output: "for (;;) var i; ", errors: [{ message: "Missing semicolon.", type: "VariableDeclaration" }] }, + { code: "for (var j;;) {var i}", output: "for (var j;;) {var i;}", errors: [{ message: "Missing semicolon.", type: "VariableDeclaration" }] }, + { code: "var foo = {\n bar: baz\n}", output: "var foo = {\n bar: baz\n};", errors: [{ message: "Missing semicolon.", type: "VariableDeclaration", line: 3 }] }, + { code: "var foo\nvar bar;", output: "var foo;\nvar bar;", errors: [{ message: "Missing semicolon.", type: "VariableDeclaration", line: 1 }] }, + { code: "throw new Error('foo')", output: "throw new Error('foo');", errors: [{ message: "Missing semicolon.", type: "ThrowStatement", line: 1 }] }, + { code: "do{}while(true)", output: "do{}while(true);", errors: [{ message: "Missing semicolon.", type: "DoWhileStatement", line: 1 }] }, + + { code: "throw new Error('foo');", output: "throw new Error('foo')", options: ["never"], errors: [{ message: "Extra semicolon.", type: "ThrowStatement", column: 23 }] }, + { code: "function foo() { return []; }", output: "function foo() { return [] }", options: ["never"], errors: [{ message: "Extra semicolon.", type: "ReturnStatement" }] }, + { code: "while(true) { break; }", output: "while(true) { break }", options: ["never"], errors: [{ message: "Extra semicolon.", type: "BreakStatement" }] }, + { code: "while(true) { continue; }", output: "while(true) { continue }", options: ["never"], errors: [{ message: "Extra semicolon.", type: "ContinueStatement" }] }, + { code: "let x = 5;", output: "let x = 5", parserOptions: { ecmaVersion: 6 }, options: ["never"], errors: [{ message: "Extra semicolon.", type: "VariableDeclaration" }] }, + { code: "var x = 5;", output: "var x = 5", options: ["never"], errors: [{ message: "Extra semicolon.", type: "VariableDeclaration" }] }, + { code: "var x = 5, y;", output: "var x = 5, y", options: ["never"], errors: [{ message: "Extra semicolon.", type: "VariableDeclaration" }] }, + { code: "debugger;", output: "debugger", options: ["never"], errors: [{ message: "Extra semicolon.", type: "DebuggerStatement" }] }, + { code: "foo();", output: "foo()", options: ["never"], errors: [{ message: "Extra semicolon.", type: "ExpressionStatement" }] }, + { code: "var x = 5, y;", output: "var x = 5, y", options: ["never"], errors: [{ message: "Extra semicolon.", type: "VariableDeclaration" }] }, + { code: "for (var a in b) var i; ", output: "for (var a in b) var i ", options: ["never"], errors: [{ message: "Extra semicolon.", type: "VariableDeclaration" }] }, + { code: "for (;;){var i;}", output: "for (;;){var i}", options: ["never"], errors: [{ message: "Extra semicolon.", type: "VariableDeclaration" }] }, + { code: "for (;;) var i; ", output: "for (;;) var i ", options: ["never"], errors: [{ message: "Extra semicolon.", type: "VariableDeclaration" }] }, + { code: "for (var j;;) {var i;}", output: "for (var j;;) {var i}", options: ["never"], errors: [{ message: "Extra semicolon.", type: "VariableDeclaration" }] }, + { code: "var foo = {\n bar: baz\n};", output: "var foo = {\n bar: baz\n}", options: ["never"], errors: [{ message: "Extra semicolon.", type: "VariableDeclaration", line: 3 }] }, + { code: "import theDefault, { named1, named2 } from 'src/mylib';", output: "import theDefault, { named1, named2 } from 'src/mylib'", options: ["never"], parserOptions: { sourceType: "module" }, errors: [{ message: "Extra semicolon.", type: "ImportDeclaration" }] }, + { code: "do{}while(true);", output: "do{}while(true)", options: ["never"], errors: [{ message: "Extra semicolon.", type: "DoWhileStatement", line: 1 }] }, + + { code: "if (foo) { bar()\n }", options: ["always", { omitLastInOneLineBlock: true }], errors: [{ message: "Missing semicolon." }] }, + { code: "if (foo) {\n bar() }", options: ["always", { omitLastInOneLineBlock: true }], errors: [{ message: "Missing semicolon." }] }, + { code: "if (foo) {\n bar(); baz() }", options: ["always", { omitLastInOneLineBlock: true }], errors: [{ message: "Missing semicolon." }] }, + { code: "if (foo) { bar(); }", options: ["always", { omitLastInOneLineBlock: true }], errors: [{ message: "Extra semicolon." }] }, + + + // exports, "always" + { code: "export * from 'foo'", output: "export * from 'foo';", parserOptions: { sourceType: "module" }, errors: [{ message: "Missing semicolon.", type: "ExportAllDeclaration" }] }, + { code: "export { foo } from 'foo'", output: "export { foo } from 'foo';", parserOptions: { sourceType: "module" }, errors: [{ message: "Missing semicolon.", type: "ExportNamedDeclaration" }] }, + { code: "export { foo }", output: "export { foo };", parserOptions: { sourceType: "module" }, errors: [{ message: "Missing semicolon.", type: "ExportNamedDeclaration" }] }, + { code: "export var foo", output: "export var foo;", parserOptions: { sourceType: "module" }, errors: [{ message: "Missing semicolon.", type: "VariableDeclaration" }] }, + { code: "export let foo", output: "export let foo;", parserOptions: { sourceType: "module" }, errors: [{ message: "Missing semicolon.", type: "VariableDeclaration" }] }, + { code: "export const FOO = 42", output: "export const FOO = 42;", parserOptions: { sourceType: "module" }, errors: [{ message: "Missing semicolon.", type: "VariableDeclaration" }] }, + { code: "export default foo || bar", output: "export default foo || bar;", parserOptions: { sourceType: "module" }, errors: [{ message: "Missing semicolon.", type: "ExportDefaultDeclaration" }] }, + { code: "export default (foo) => foo.bar()", output: "export default (foo) => foo.bar();", parserOptions: { sourceType: "module" }, errors: [{ message: "Missing semicolon.", type: "ExportDefaultDeclaration" }] }, + { code: "export default foo = 42", output: "export default foo = 42;", parserOptions: { sourceType: "module" }, errors: [{ message: "Missing semicolon.", type: "ExportDefaultDeclaration" }] }, + { code: "export default foo += 42", output: "export default foo += 42;", parserOptions: { sourceType: "module" }, errors: [{ message: "Missing semicolon.", type: "ExportDefaultDeclaration" }] }, + + // exports, "never" + { code: "export * from 'foo';", output: "export * from 'foo'", options: ["never"], parserOptions: { sourceType: "module" }, errors: [{ message: "Extra semicolon.", type: "ExportAllDeclaration" }] }, + { code: "export { foo } from 'foo';", output: "export { foo } from 'foo'", options: ["never"], parserOptions: { sourceType: "module" }, errors: [{ message: "Extra semicolon.", type: "ExportNamedDeclaration" }] }, + { code: "export { foo };", output: "export { foo }", options: ["never"], parserOptions: { sourceType: "module" }, errors: [{ message: "Extra semicolon.", type: "ExportNamedDeclaration" }] }, + { code: "export var foo;", output: "export var foo", options: ["never"], parserOptions: { sourceType: "module" }, errors: [{ message: "Extra semicolon.", type: "VariableDeclaration" }] }, + { code: "export let foo;", output: "export let foo", options: ["never"], parserOptions: { sourceType: "module" }, errors: [{ message: "Extra semicolon.", type: "VariableDeclaration" }] }, + { code: "export const FOO = 42;", output: "export const FOO = 42", options: ["never"], parserOptions: { sourceType: "module" }, errors: [{ message: "Extra semicolon.", type: "VariableDeclaration" }] }, + { code: "export default foo || bar;", output: "export default foo || bar", options: ["never"], parserOptions: { sourceType: "module" }, errors: [{ message: "Extra semicolon.", type: "ExportDefaultDeclaration" }] }, + { code: "export default (foo) => foo.bar();", output: "export default (foo) => foo.bar()", options: ["never"], parserOptions: { sourceType: "module" }, errors: [{ message: "Extra semicolon.", type: "ExportDefaultDeclaration" }] }, + { code: "export default foo = 42;", output: "export default foo = 42", options: ["never"], parserOptions: { sourceType: "module" }, errors: [{ message: "Extra semicolon.", type: "ExportDefaultDeclaration" }] }, + { code: "export default foo += 42;", output: "export default foo += 42", options: ["never"], parserOptions: { sourceType: "module" }, errors: [{ message: "Extra semicolon.", type: "ExportDefaultDeclaration" }] }, + { code: "a;\n++b", output: "a\n++b", options: ["never"], errors: [{ message: "Extra semicolon." }] }, + + // babel + { code: "class Foo { bar = 'example' }", errors: [{ message: "Missing semicolon." }] }, + { code: "class Foo { static bar = 'example' }", errors: [{ message: "Missing semicolon." }] }, + + // babel, "never" + { code: "class Foo { bar = 'example'; }", options: ["never"], errors: [{ message: "Extra semicolon." }] }, + { code: "class Foo { static bar = 'example'; }", options: ["never"], errors: [{ message: "Extra semicolon." }] } + ] +}); From c548da9d36eae721fa231e4423850befdb7d8336 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 27 Feb 2017 15:00:01 -0500 Subject: [PATCH 523/569] 4.1.0 --- eslint/babel-eslint-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index f5c621e31361..36db612b2492 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-babel", - "version": "4.0.1", + "version": "4.1.0", "description": "an eslint rule plugin companion to babel-eslint", "main": "index.js", "scripts": { From 399c182ab52d2772d30ddc5c4ea0b9b3103a60ce Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Sat, 4 Mar 2017 09:35:33 -0500 Subject: [PATCH 524/569] Merge pull request babel/eslint-plugin-babel#123 from daltones/master Deprecate rule `no-await-in-loop` --- eslint/babel-eslint-plugin/README.md | 14 +-- .../rules/no-await-in-loop.js | 84 ++++---------- .../tests/rules/no-await-in-loop.js | 106 ------------------ 3 files changed, 24 insertions(+), 180 deletions(-) delete mode 100644 eslint/babel-eslint-plugin/tests/rules/no-await-in-loop.js diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md index 9444f93f9ced..82a80d5d42d4 100644 --- a/eslint/babel-eslint-plugin/README.md +++ b/eslint/babel-eslint-plugin/README.md @@ -30,8 +30,6 @@ original ones as well!). "rules": { "babel/new-cap": 1, "babel/object-curly-spacing": 1, - "babel/no-await-in-loop": 1, - "babel/flow-object-type": 1, "babel/no-invalid-this": 1, "babel/semi": 1 } @@ -41,17 +39,12 @@ original ones as well!). Each rule corresponds to a core `eslint` rule, and has the same options. -🛠 : means it's autofixable with `--fix`. +🛠: means it's autofixable with `--fix`. - `babel/new-cap`: Ignores capitalized decorators (`@Decorator`) -- `babel/object-curly-spacing`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` (🛠 ) +- `babel/object-curly-spacing`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` (🛠) - `babel/no-invalid-this`: doesn't fail when inside class properties (`class A { a = this.b; }`) -- `babel/semi`: Includes class properties (🛠 ) - -The following rules are not in `eslint`, but are relevant only to syntax that is not specified by -the current JavaScript standard or supported by `eslint`. - -- `babel/no-await-in-loop`: guard against awaiting async functions inside of a loop +- `babel/semi`: Includes class properties (🛠) #### Deprecated @@ -61,3 +54,4 @@ the current JavaScript standard or supported by `eslint`. - `babel/func-params-comma-dangle`: Use [`comma-dangle`](http://eslint.org/docs/rules/comma-dangle). - `babel/array-bracket-spacing`: Use [`array-bracket-spacing`](http://eslint.org/docs/rules/array-bracket-spacing). - `babel/flow-object-type`: Use [`flowtype/object-type-delimiter`](https://github.com/gajus/eslint-plugin-flowtype#eslint-plugin-flowtype-rules-object-type-delimiter). +- `babel/no-await-in-loop`: Use [`no-await-in-loop`](http://eslint.org/docs/rules/no-await-in-loop). diff --git a/eslint/babel-eslint-plugin/rules/no-await-in-loop.js b/eslint/babel-eslint-plugin/rules/no-await-in-loop.js index 037f29be74c9..8ef295f36fd3 100644 --- a/eslint/babel-eslint-plugin/rules/no-await-in-loop.js +++ b/eslint/babel-eslint-plugin/rules/no-await-in-loop.js @@ -1,68 +1,24 @@ -/** - * @fileoverview Rule to disallow uses of await inside of loops. - * @author Nat Mote - */ "use strict"; -// Node types which are considered loops. -var loopTypes = { - 'ForStatement': true, - 'ForOfStatement': true, - 'ForInStatement': true, - 'WhileStatement': true, - 'DoWhileStatement': true, -}; +var isWarnedForDeprecation = false; +module.exports = { + meta: { + deprecated: true, + schema: [] + }, + create: function() { + return { + Program: function() { + if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { + return; + } -// Node types at which we should stop looking for loops. For example, it is fine to declare an async -// function within a loop, and use await inside of that. -var boundaryTypes = { - 'FunctionDeclaration': true, - 'FunctionExpression': true, - 'ArrowFunctionExpression': true, + /* eslint-disable no-console */ + console.log('The babel/no-await-in-loop rule is deprecated. Please ' + + 'use the built in no-await-in-loop rule instead.'); + /* eslint-enable no-console */ + isWarnedForDeprecation = true; + } + }; + } }; - -module.exports = function(context) { - return { - AwaitExpression(node) { - var ancestors = context.getAncestors(); - // Reverse so that we can traverse from the deepest node upwards. - ancestors.reverse(); - // Create a set of all the ancestors plus this node so that we can check - // if this use of await appears in the body of the loop as opposed to - // the right-hand side of a for...of, for example. - // - // Implement the set with an Array since there are likely to be very few - // elements. An Object would not be appropriate since the elements are - // not strings. - var ancestorSet = [].concat(ancestors, [node]); - var ancestorSetHas = function(element) { - return ancestorSet.indexOf(element) !== -1; - } - for (var i = 0; i < ancestors.length; i++) { - var ancestor = ancestors[i]; - if (boundaryTypes.hasOwnProperty(ancestor.type)) { - // Short-circuit out if we encounter a boundary type. Loops above - // this do not matter. - return; - } - if (loopTypes.hasOwnProperty(ancestor.type)) { - // Only report if we are actually in the body or another part that gets executed on - // every iteration. - if ( - ancestorSetHas(ancestor.body) || - ancestorSetHas(ancestor.test) || - ancestorSetHas(ancestor.update) - ) { - context.report( - node, - 'Avoid using await inside a loop. Consider refactoring to use Promise.all. If ' + - 'you are sure you want to do this, add `// eslint-disable-line ' + - context.id + '` at the end of this line.' - ); - return; - } - } - } - }, - }; -} diff --git a/eslint/babel-eslint-plugin/tests/rules/no-await-in-loop.js b/eslint/babel-eslint-plugin/tests/rules/no-await-in-loop.js deleted file mode 100644 index 97de50fdd940..000000000000 --- a/eslint/babel-eslint-plugin/tests/rules/no-await-in-loop.js +++ /dev/null @@ -1,106 +0,0 @@ -/** - * @fileoverview Tests for no-await-in-loop. - * @author Nat Mote - */ - -"use strict"; - -var rule = require("../../rules/no-await-in-loop"), - RuleTester = require('../RuleTester'); - -var features = { -}; - -function test(code, errors){ - var result = { - code: code, - parser: 'babel-eslint', - ecmaFeatures: features, - }; - if (errors != null) { - result.errors = errors; - } - return result; -} - -var ruleName = 'babel/no-await-in-loop'; - -var message = 'Avoid using await inside a loop. Consider refactoring to use Promise.all. If ' + - 'you are sure you want to do this, add `// eslint-disable-line ' + - ruleName + '` at the end of this line.' - -function ok(code) { - return test(code); -} - -function err(code) { - return test(code, [message]); -} - -// Construct an async function with the given body -function fun(body) { - return "async function foo() { " + body + " }"; -} - -// Construct a loop -function loop(kind, condition, body) { - return kind + " (" + condition + ") { " + body + " }"; -} - -// Construct a class with the given body -function cls(body) { - return "class Foo { " + body + " }"; -} - -var cases = [ - ok(fun("await bar;")), - - // While loops - ok(fun(loop("while", "true", fun("await bar;")))), // Blocked by a function declaration - err(fun(loop("while", "baz", "await bar;"))), - err(fun(loop("while", "await foo()", ""))), - - // For of loops - err(fun(loop("for", "var bar of baz", "await bar;"))), - - // For in loops - err(fun(loop("for", "var bar in baz", "await bar;"))), - - // For loops - ok(fun(loop("for", "var i = await bar; i < n; i++", ""))), - err(fun(loop("for", "var i; i < n; i++", "await bar;"))), - err(fun(loop("for", "var i; await foo(i); i++", ""))), - err(fun(loop("for", "var i; i < n; i = await bar", ""))), - - // Do while loops - ok(fun("do { } while (bar);")), - err(fun("do { await bar; } while (baz);")), - err(fun("do { } while (await bar);")), - - // Blocked by a function expression - ok(fun(loop("while", "true", "var y = async function() { await bar; }"))), - // Blocked by an arrow function - ok(fun(loop("while", "true", "var y = async () => await foo;"))), - ok(fun(loop("while", "true", "var y = async () => { await foo; }"))), - // Blocked by a class method, - ok(fun(loop("while", "true", cls("async foo() { await bar; }")))), - - // Deep in a loop body - err(fun(loop("while", "true", "if (bar) { foo(await bar); }"))), - // Deep in a loop condition - err(fun(loop("while", "xyz || 5 > await x", ""))), -]; - -function hasError(testCase) { - return testCase.errors != null && testCase.errors.length > 0; -} - -function hasNoError(testCase) { - return !hasError(testCase); -} - -var ruleTester = new RuleTester(); -ruleTester.run(ruleName, rule, { - valid: cases.filter(hasNoError), - invalid: cases.filter(hasError), -}); From dc0109ad3d17eaa3a3055e8f9ed59657d79d78ef Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 6 Mar 2017 10:48:48 -0500 Subject: [PATCH 525/569] 4.1.1 --- eslint/babel-eslint-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index 36db612b2492..7d7d3f2e481b 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-babel", - "version": "4.1.0", + "version": "4.1.1", "description": "an eslint rule plugin companion to babel-eslint", "main": "index.js", "scripts": { From da75b8484fdc6ee46ced305f34715a69eb56d295 Mon Sep 17 00:00:00 2001 From: Brandon Kobel Date: Wed, 10 May 2017 12:09:23 -0400 Subject: [PATCH 526/569] Modifying semi rule to support for await (babel/eslint-plugin-babel#126) --- eslint/babel-eslint-plugin/README.md | 2 +- eslint/babel-eslint-plugin/rules/semi.js | 2 +- eslint/babel-eslint-plugin/tests/rules/semi.js | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md index 82a80d5d42d4..a9da5486713d 100644 --- a/eslint/babel-eslint-plugin/README.md +++ b/eslint/babel-eslint-plugin/README.md @@ -44,7 +44,7 @@ Each rule corresponds to a core `eslint` rule, and has the same options. - `babel/new-cap`: Ignores capitalized decorators (`@Decorator`) - `babel/object-curly-spacing`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` (🛠) - `babel/no-invalid-this`: doesn't fail when inside class properties (`class A { a = this.b; }`) -- `babel/semi`: Includes class properties (🛠) +- `babel/semi`: doesn't fail when using `for await (let something of {})`. Includes class properties (🛠) #### Deprecated diff --git a/eslint/babel-eslint-plugin/rules/semi.js b/eslint/babel-eslint-plugin/rules/semi.js index 48bbb7e49673..0f9ef74f4ec0 100644 --- a/eslint/babel-eslint-plugin/rules/semi.js +++ b/eslint/babel-eslint-plugin/rules/semi.js @@ -187,7 +187,7 @@ module.exports = { parent = ancestors[parentIndex]; if ((parent.type !== "ForStatement" || parent.init !== node) && - (!/^For(?:In|Of)Statement/.test(parent.type) || parent.left !== node) + (!/^For(?:In|Of|Await)Statement/.test(parent.type) || parent.left !== node) ) { checkForSemicolon(node); } diff --git a/eslint/babel-eslint-plugin/tests/rules/semi.js b/eslint/babel-eslint-plugin/tests/rules/semi.js index 3d146a1b8d04..b3f4620df919 100644 --- a/eslint/babel-eslint-plugin/tests/rules/semi.js +++ b/eslint/babel-eslint-plugin/tests/rules/semi.js @@ -102,6 +102,7 @@ ruleTester.run("semi", rule, { // babel "class Foo { bar = 'example'; }", "class Foo { static bar = 'example'; }", + { code: "async function foo() { for await (let thing of {}) { console.log(thing); } }", parserOptions: { ecmaVersion: 6 } }, // babel, "never" { code: "class Foo { bar = 'example' }", options: ["never"] }, From 15c5245d55708048b5e7e50a991e3e55da5d3658 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 25 Jul 2017 16:42:26 -0400 Subject: [PATCH 527/569] 4.1.2 --- eslint/babel-eslint-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index 7d7d3f2e481b..ca2cec258ce8 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-babel", - "version": "4.1.1", + "version": "4.1.2", "description": "an eslint rule plugin companion to babel-eslint", "main": "index.js", "scripts": { From b41b3af8797d9d0c562838feed3beee291f50435 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Fri, 30 Mar 2018 08:34:43 -0500 Subject: [PATCH 528/569] Merge pull request babel/eslint-plugin-babel#138 from babel/composer Refactor rules to use eslint-rule-composer --- eslint/babel-eslint-plugin/ast-utils.js | 727 ------------ eslint/babel-eslint-plugin/package.json | 7 +- eslint/babel-eslint-plugin/rules/new-cap.js | 240 +--- .../rules/no-invalid-this.js | 151 +-- .../rules/object-curly-spacing.js | 303 +---- eslint/babel-eslint-plugin/rules/semi.js | 276 ++--- .../tests/rules/no-invalid-this.js | 3 + .../tests/rules/object-curly-spacing.js | 152 +-- eslint/babel-eslint-plugin/yarn.lock | 1023 +++++++++++++++++ 9 files changed, 1234 insertions(+), 1648 deletions(-) delete mode 100644 eslint/babel-eslint-plugin/ast-utils.js create mode 100644 eslint/babel-eslint-plugin/yarn.lock diff --git a/eslint/babel-eslint-plugin/ast-utils.js b/eslint/babel-eslint-plugin/ast-utils.js deleted file mode 100644 index 9f0d91f7edbb..000000000000 --- a/eslint/babel-eslint-plugin/ast-utils.js +++ /dev/null @@ -1,727 +0,0 @@ -/** - * @fileoverview Common utils for AST. - * @author Gyandeep Singh - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const anyFunctionPattern = /^(?:Function(?:Declaration|Expression)|ArrowFunctionExpression)$/; -const anyLoopPattern = /^(?:DoWhile|For|ForIn|ForOf|While)Statement$/; -const arrayOrTypedArrayPattern = /Array$/; -const arrayMethodPattern = /^(?:every|filter|find|findIndex|forEach|map|some)$/; -const bindOrCallOrApplyPattern = /^(?:bind|call|apply)$/; -const breakableTypePattern = /^(?:(?:Do)?While|For(?:In|Of)?|Switch)Statement$/; -const thisTagPattern = /^[\s\*]*@this/m; - -/** - * Checks reference if is non initializer and writable. - * @param {Reference} reference - A reference to check. - * @param {int} index - The index of the reference in the references. - * @param {Reference[]} references - The array that the reference belongs to. - * @returns {boolean} Success/Failure - * @private - */ -function isModifyingReference(reference, index, references) { - const identifier = reference.identifier; - - /* - * Destructuring assignments can have multiple default value, so - * possibly there are multiple writeable references for the same - * identifier. - */ - const modifyingDifferentIdentifier = index === 0 || - references[index - 1].identifier !== identifier; - - return (identifier && - reference.init === false && - reference.isWrite() && - modifyingDifferentIdentifier - ); -} - -/** - * Checks whether the given string starts with uppercase or not. - * - * @param {string} s - The string to check. - * @returns {boolean} `true` if the string starts with uppercase. - */ -function startsWithUpperCase(s) { - return s[0] !== s[0].toLocaleLowerCase(); -} - -/** - * Checks whether or not a node is a constructor. - * @param {ASTNode} node - A function node to check. - * @returns {boolean} Wehether or not a node is a constructor. - */ -function isES5Constructor(node) { - return (node.id && startsWithUpperCase(node.id.name)); -} - -/** - * Finds a function node from ancestors of a node. - * @param {ASTNode} node - A start node to find. - * @returns {Node|null} A found function node. - */ -function getUpperFunction(node) { - while (node) { - if (anyFunctionPattern.test(node.type)) { - return node; - } - node = node.parent; - } - return null; -} - -/** - * Checks whether or not a node is `null` or `undefined`. - * @param {ASTNode} node - A node to check. - * @returns {boolean} Whether or not the node is a `null` or `undefined`. - * @public - */ -function isNullOrUndefined(node) { - return ( - (node.type === "Literal" && node.value === null) || - (node.type === "Identifier" && node.name === "undefined") || - (node.type === "UnaryExpression" && node.operator === "void") - ); -} - -/** - * Checks whether or not a node is callee. - * @param {ASTNode} node - A node to check. - * @returns {boolean} Whether or not the node is callee. - */ -function isCallee(node) { - return node.parent.type === "CallExpression" && node.parent.callee === node; -} - -/** - * Checks whether or not a node is `Reclect.apply`. - * @param {ASTNode} node - A node to check. - * @returns {boolean} Whether or not the node is a `Reclect.apply`. - */ -function isReflectApply(node) { - return ( - node.type === "MemberExpression" && - node.object.type === "Identifier" && - node.object.name === "Reflect" && - node.property.type === "Identifier" && - node.property.name === "apply" && - node.computed === false - ); -} - -/** - * Checks whether or not a node is `Array.from`. - * @param {ASTNode} node - A node to check. - * @returns {boolean} Whether or not the node is a `Array.from`. - */ -function isArrayFromMethod(node) { - return ( - node.type === "MemberExpression" && - node.object.type === "Identifier" && - arrayOrTypedArrayPattern.test(node.object.name) && - node.property.type === "Identifier" && - node.property.name === "from" && - node.computed === false - ); -} - -/** - * Checks whether or not a node is a method which has `thisArg`. - * @param {ASTNode} node - A node to check. - * @returns {boolean} Whether or not the node is a method which has `thisArg`. - */ -function isMethodWhichHasThisArg(node) { - while (node) { - if (node.type === "Identifier") { - return arrayMethodPattern.test(node.name); - } - if (node.type === "MemberExpression" && !node.computed) { - node = node.property; - continue; - } - - break; - } - - return false; -} - -/** - * Checks whether or not a node has a `@this` tag in its comments. - * @param {ASTNode} node - A node to check. - * @param {SourceCode} sourceCode - A SourceCode instance to get comments. - * @returns {boolean} Whether or not the node has a `@this` tag in its comments. - */ -function hasJSDocThisTag(node, sourceCode) { - const jsdocComment = sourceCode.getJSDocComment(node); - - if (jsdocComment && thisTagPattern.test(jsdocComment.value)) { - return true; - } - - // Checks `@this` in its leading comments for callbacks, - // because callbacks don't have its JSDoc comment. - // e.g. - // sinon.test(/* @this sinon.Sandbox */function() { this.spy(); }); - return sourceCode.getComments(node).leading.some(function(comment) { - return thisTagPattern.test(comment.value); - }); -} - -/** - * Determines if a node is surrounded by parentheses. - * @param {SourceCode} sourceCode The ESLint source code object - * @param {ASTNode} node The node to be checked. - * @returns {boolean} True if the node is parenthesised. - * @private - */ -function isParenthesised(sourceCode, node) { - const previousToken = sourceCode.getTokenBefore(node), - nextToken = sourceCode.getTokenAfter(node); - - return Boolean(previousToken && nextToken) && - previousToken.value === "(" && previousToken.range[1] <= node.range[0] && - nextToken.value === ")" && nextToken.range[0] >= node.range[1]; -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -module.exports = { - - /** - * Determines whether two adjacent tokens are on the same line. - * @param {Object} left - The left token object. - * @param {Object} right - The right token object. - * @returns {boolean} Whether or not the tokens are on the same line. - * @public - */ - isTokenOnSameLine(left, right) { - return left.loc.end.line === right.loc.start.line; - }, - - isNullOrUndefined, - isCallee, - isES5Constructor, - getUpperFunction, - isArrayFromMethod, - isParenthesised, - - /** - * Checks whether or not a given node is a string literal. - * @param {ASTNode} node - A node to check. - * @returns {boolean} `true` if the node is a string literal. - */ - isStringLiteral(node) { - return ( - (node.type === "Literal" && typeof node.value === "string") || - node.type === "TemplateLiteral" - ); - }, - - /** - * Checks whether a given node is a breakable statement or not. - * The node is breakable if the node is one of the following type: - * - * - DoWhileStatement - * - ForInStatement - * - ForOfStatement - * - ForStatement - * - SwitchStatement - * - WhileStatement - * - * @param {ASTNode} node - A node to check. - * @returns {boolean} `true` if the node is breakable. - */ - isBreakableStatement(node) { - return breakableTypePattern.test(node.type); - }, - - /** - * Gets the label if the parent node of a given node is a LabeledStatement. - * - * @param {ASTNode} node - A node to get. - * @returns {string|null} The label or `null`. - */ - getLabel(node) { - if (node.parent.type === "LabeledStatement") { - return node.parent.label.name; - } - return null; - }, - - /** - * Gets references which are non initializer and writable. - * @param {Reference[]} references - An array of references. - * @returns {Reference[]} An array of only references which are non initializer and writable. - * @public - */ - getModifyingReferences(references) { - return references.filter(isModifyingReference); - }, - - /** - * Validate that a string passed in is surrounded by the specified character - * @param {string} val The text to check. - * @param {string} character The character to see if it's surrounded by. - * @returns {boolean} True if the text is surrounded by the character, false if not. - * @private - */ - isSurroundedBy(val, character) { - return val[0] === character && val[val.length - 1] === character; - }, - - /** - * Returns whether the provided node is an ESLint directive comment or not - * @param {LineComment|BlockComment} node The node to be checked - * @returns {boolean} `true` if the node is an ESLint directive comment - */ - isDirectiveComment(node) { - const comment = node.value.trim(); - - return ( - node.type === "Line" && comment.indexOf("eslint-") === 0 || - node.type === "Block" && ( - comment.indexOf("global ") === 0 || - comment.indexOf("eslint ") === 0 || - comment.indexOf("eslint-") === 0 - ) - ); - }, - - /** - * Finds the variable by a given name in a given scope and its upper scopes. - * - * @param {escope.Scope} initScope - A scope to start find. - * @param {string} name - A variable name to find. - * @returns {escope.Variable|null} A found variable or `null`. - */ - getVariableByName(initScope, name) { - let scope = initScope; - - while (scope) { - const variable = scope.set.get(name); - - if (variable) { - return variable; - } - - scope = scope.upper; - } - - return null; - }, - - /** - * Checks whether or not a given function node is the default `this` binding. - * - * First, this checks the node: - * - * - The function name does not start with uppercase (it's a constructor). - * - The function does not have a JSDoc comment that has a @this tag. - * - * Next, this checks the location of the node. - * If the location is below, this judges `this` is valid. - * - * - The location is not on an object literal. - * - The location is not assigned to a variable which starts with an uppercase letter. - * - The location is not on an ES2015 class. - * - Its `bind`/`call`/`apply` method is not called directly. - * - The function is not a callback of array methods (such as `.forEach()`) if `thisArg` is given. - * - * @param {ASTNode} node - A function node to check. - * @param {SourceCode} sourceCode - A SourceCode instance to get comments. - * @returns {boolean} The function node is the default `this` binding. - */ - isDefaultThisBinding(node, sourceCode) { - if (isES5Constructor(node) || hasJSDocThisTag(node, sourceCode)) { - return false; - } - const isAnonymous = node.id === null; - - while (node) { - const parent = node.parent; - - switch (parent.type) { - - /* - * Looks up the destination. - * e.g., obj.foo = nativeFoo || function foo() { ... }; - */ - case "LogicalExpression": - case "ConditionalExpression": - node = parent; - break; - - // If the upper function is IIFE, checks the destination of the return value. - // e.g. - // obj.foo = (function() { - // // setup... - // return function foo() { ... }; - // })(); - case "ReturnStatement": { - const func = getUpperFunction(parent); - - if (func === null || !isCallee(func)) { - return true; - } - node = func.parent; - break; - } - - // e.g. - // var obj = { foo() { ... } }; - // var obj = { foo: function() { ... } }; - // class A { constructor() { ... } } - // class A { foo() { ... } } - // class A { get foo() { ... } } - // class A { set foo() { ... } } - // class A { static foo() { ... } } - case "Property": - case "MethodDefinition": - return parent.value !== node; - - // e.g. - // obj.foo = function foo() { ... }; - // Foo = function() { ... }; - // [obj.foo = function foo() { ... }] = a; - // [Foo = function() { ... }] = a; - case "AssignmentExpression": - case "AssignmentPattern": - if (parent.right === node) { - if (parent.left.type === "MemberExpression") { - return false; - } - if (isAnonymous && - parent.left.type === "Identifier" && - startsWithUpperCase(parent.left.name) - ) { - return false; - } - } - return true; - - // e.g. - // var Foo = function() { ... }; - case "VariableDeclarator": - return !( - isAnonymous && - parent.init === node && - parent.id.type === "Identifier" && - startsWithUpperCase(parent.id.name) - ); - - // e.g. - // var foo = function foo() { ... }.bind(obj); - // (function foo() { ... }).call(obj); - // (function foo() { ... }).apply(obj, []); - case "MemberExpression": - return ( - parent.object !== node || - parent.property.type !== "Identifier" || - !bindOrCallOrApplyPattern.test(parent.property.name) || - !isCallee(parent) || - parent.parent.arguments.length === 0 || - isNullOrUndefined(parent.parent.arguments[0]) - ); - - // e.g. - // Reflect.apply(function() {}, obj, []); - // Array.from([], function() {}, obj); - // list.forEach(function() {}, obj); - case "CallExpression": - if (isReflectApply(parent.callee)) { - return ( - parent.arguments.length !== 3 || - parent.arguments[0] !== node || - isNullOrUndefined(parent.arguments[1]) - ); - } - if (isArrayFromMethod(parent.callee)) { - return ( - parent.arguments.length !== 3 || - parent.arguments[1] !== node || - isNullOrUndefined(parent.arguments[2]) - ); - } - if (isMethodWhichHasThisArg(parent.callee)) { - return ( - parent.arguments.length !== 2 || - parent.arguments[0] !== node || - isNullOrUndefined(parent.arguments[1]) - ); - } - return true; - - // Otherwise `this` is default. - default: - return true; - } - } - - /* istanbul ignore next */ - return true; - }, - - /** - * Get the precedence level based on the node type - * @param {ASTNode} node node to evaluate - * @returns {int} precedence level - * @private - */ - getPrecedence(node) { - switch (node.type) { - case "SequenceExpression": - return 0; - - case "AssignmentExpression": - case "ArrowFunctionExpression": - case "YieldExpression": - return 1; - - case "ConditionalExpression": - return 3; - - case "LogicalExpression": - switch (node.operator) { - case "||": - return 4; - case "&&": - return 5; - - // no default - } - - /* falls through */ - - case "BinaryExpression": - - switch (node.operator) { - case "|": - return 6; - case "^": - return 7; - case "&": - return 8; - case "==": - case "!=": - case "===": - case "!==": - return 9; - case "<": - case "<=": - case ">": - case ">=": - case "in": - case "instanceof": - return 10; - case "<<": - case ">>": - case ">>>": - return 11; - case "+": - case "-": - return 12; - case "*": - case "/": - case "%": - return 13; - - // no default - } - - /* falls through */ - - case "UnaryExpression": - case "AwaitExpression": - return 14; - - case "UpdateExpression": - return 15; - - case "CallExpression": - - // IIFE is allowed to have parens in any position (#655) - if (node.callee.type === "FunctionExpression") { - return -1; - } - return 16; - - case "NewExpression": - return 17; - - // no default - } - return 18; - }, - - /** - * Checks whether a given node is a loop node or not. - * The following types are loop nodes: - * - * - DoWhileStatement - * - ForInStatement - * - ForOfStatement - * - ForStatement - * - WhileStatement - * - * @param {ASTNode|null} node - A node to check. - * @returns {boolean} `true` if the node is a loop node. - */ - isLoop(node) { - return Boolean(node && anyLoopPattern.test(node.type)); - }, - - /** - * Checks whether a given node is a function node or not. - * The following types are function nodes: - * - * - ArrowFunctionExpression - * - FunctionDeclaration - * - FunctionExpression - * - * @param {ASTNode|null} node - A node to check. - * @returns {boolean} `true` if the node is a function node. - */ - isFunction(node) { - return Boolean(node && anyFunctionPattern.test(node.type)); - }, - - /** - * Gets the property name of a given node. - * The node can be a MemberExpression, a Property, or a MethodDefinition. - * - * If the name is dynamic, this returns `null`. - * - * For examples: - * - * a.b // => "b" - * a["b"] // => "b" - * a['b'] // => "b" - * a[`b`] // => "b" - * a[100] // => "100" - * a[b] // => null - * a["a" + "b"] // => null - * a[tag`b`] // => null - * a[`${b}`] // => null - * - * let a = {b: 1} // => "b" - * let a = {["b"]: 1} // => "b" - * let a = {['b']: 1} // => "b" - * let a = {[`b`]: 1} // => "b" - * let a = {[100]: 1} // => "100" - * let a = {[b]: 1} // => null - * let a = {["a" + "b"]: 1} // => null - * let a = {[tag`b`]: 1} // => null - * let a = {[`${b}`]: 1} // => null - * - * @param {ASTNode} node - The node to get. - * @returns {string|null} The property name if static. Otherwise, null. - */ - getStaticPropertyName(node) { - let prop; - - switch (node && node.type) { - case "Property": - case "MethodDefinition": - prop = node.key; - break; - - case "MemberExpression": - prop = node.property; - break; - - // no default - } - - switch (prop && prop.type) { - case "Literal": - return String(prop.value); - - case "TemplateLiteral": - if (prop.expressions.length === 0 && prop.quasis.length === 1) { - return prop.quasis[0].value.cooked; - } - break; - - case "Identifier": - if (!node.computed) { - return prop.name; - } - break; - - // no default - } - - return null; - }, - - /** - * Get directives from directive prologue of a Program or Function node. - * @param {ASTNode} node - The node to check. - * @returns {ASTNode[]} The directives found in the directive prologue. - */ - getDirectivePrologue(node) { - const directives = []; - - // Directive prologues only occur at the top of files or functions. - if ( - node.type === "Program" || - node.type === "FunctionDeclaration" || - node.type === "FunctionExpression" || - - // Do not check arrow functions with implicit return. - // `() => "use strict";` returns the string `"use strict"`. - (node.type === "ArrowFunctionExpression" && node.body.type === "BlockStatement") - ) { - const statements = node.type === "Program" ? node.body : node.body.body; - - for (const statement of statements) { - if ( - statement.type === "ExpressionStatement" && - statement.expression.type === "Literal" - ) { - directives.push(statement); - } else { - break; - } - } - } - - return directives; - }, - - - /** - * Determines whether this node is a decimal integer literal. If a node is a decimal integer literal, a dot added - after the node will be parsed as a decimal point, rather than a property-access dot. - * @param {ASTNode} node - The node to check. - * @returns {boolean} `true` if this node is a decimal integer. - * @example - * - * 5 // true - * 5. // false - * 5.0 // false - * 05 // false - * 0x5 // false - * 0b101 // false - * 0o5 // false - * 5e0 // false - * '5' // false - */ - isDecimalInteger(node) { - return node.type === "Literal" && typeof node.value === "number" && /^(0|[1-9]\d*)$/.test(node.raw); - } -}; diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index ca2cec258ce8..8c0b36b7e1b7 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -27,11 +27,14 @@ }, "homepage": "https://github.com/babel/eslint-plugin-babel#readme", "peerDependencies": { - "eslint": ">=3.0.0" + "eslint": ">=4.0.0" + }, + "dependencies": { + "eslint-rule-composer": "^0.1.1" }, "devDependencies": { "babel-eslint": "^7.1.0", - "eslint": "^3.0.0", + "eslint": "^4.19.1", "lodash.clonedeep": "^4.5.0", "mocha": "^3.0.0" } diff --git a/eslint/babel-eslint-plugin/rules/new-cap.js b/eslint/babel-eslint-plugin/rules/new-cap.js index 0e17a9baae58..37ee633bf2d9 100644 --- a/eslint/babel-eslint-plugin/rules/new-cap.js +++ b/eslint/babel-eslint-plugin/rules/new-cap.js @@ -1,235 +1,19 @@ -/** - * @fileoverview Rule to flag use of constructors without capital letters - * @author Nicholas C. Zakas - * @copyright 2014 Jordan Harband. All rights reserved. - * @copyright 2013-2014 Nicholas C. Zakas. All rights reserved. - * @copyright 2015 Mathieu M-Gosselin. All rights reserved. - */ - "use strict"; -var CAPS_ALLOWED = [ - "Array", - "Boolean", - "Date", - "Error", - "Function", - "Number", - "Object", - "RegExp", - "String", - "Symbol" -]; - -/** - * Ensure that if the key is provided, it must be an array. - * @param {Object} obj Object to check with `key`. - * @param {string} key Object key to check on `obj`. - * @param {*} fallback If obj[key] is not present, this will be returned. - * @returns {string[]} Returns obj[key] if it's an Array, otherwise `fallback` - */ -function checkArray(obj, key, fallback) { - /* istanbul ignore if */ - if (Object.prototype.hasOwnProperty.call(obj, key) && !Array.isArray(obj[key])) { - throw new TypeError(key + ", if provided, must be an Array"); - } - return obj[key] || fallback; -} +const ruleComposer = require('eslint-rule-composer'); +const eslint = require('eslint'); +const newCapRule = new eslint.Linter().getRules().get('new-cap'); /** - * A reducer function to invert an array to an Object mapping the string form of the key, to `true`. - * @param {Object} map Accumulator object for the reduce. - * @param {string} key Object key to set to `true`. - * @returns {Object} Returns the updated Object for further reduction. + * Returns whether a node is under a decorator or not. + * @param {ASTNode} node CallExpression node + * @returns {Boolean} Returns true if the node is under a decorator. */ -function invert(map, key) { - map[key] = true; - return map; +function isDecorator(node) { + return node.parent.type === "Decorator"; } -/** - * Creates an object with the cap is new exceptions as its keys and true as their values. - * @param {Object} config Rule configuration - * @returns {Object} Object with cap is new exceptions. - */ -function calculateCapIsNewExceptions(config) { - var capIsNewExceptions = checkArray(config, "capIsNewExceptions", CAPS_ALLOWED); - - if (capIsNewExceptions !== CAPS_ALLOWED) { - capIsNewExceptions = capIsNewExceptions.concat(CAPS_ALLOWED); - } - - return capIsNewExceptions.reduce(invert, {}); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -module.exports = function(context) { - - var config = context.options[0] || {}; - var NEW_IS_CAP = config.newIsCap !== false; - var CAP_IS_NEW = config.capIsNew !== false; - - var newIsCapExceptions = checkArray(config, "newIsCapExceptions", []).reduce(invert, {}); - - var capIsNewExceptions = calculateCapIsNewExceptions(config); - - var listeners = {}; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Get exact callee name from expression - * @param {ASTNode} node CallExpression or NewExpression node - * @returns {string} name - */ - function extractNameFromExpression(node) { - - var name = "", - property; - - if (node.callee.type === "MemberExpression") { - property = node.callee.property; - - if (property.type === "Literal" && (typeof property.value === "string")) { - name = property.value; - } else if (property.type === "Identifier" && !node.callee.computed) { - name = property.name; - } - } else { - name = node.callee.name; - } - return name; - } - - /** - * Returns the capitalization state of the string - - * Whether the first character is uppercase, lowercase, or non-alphabetic - * @param {string} str String - * @returns {string} capitalization state: "non-alpha", "lower", or "upper" - */ - function getCap(str) { - var firstChar = str.charAt(0); - - var firstCharLower = firstChar.toLowerCase(); - var firstCharUpper = firstChar.toUpperCase(); - - if (firstCharLower === firstCharUpper) { - // char has no uppercase variant, so it's non-alphabetic - return "non-alpha"; - } else if (firstChar === firstCharLower) { - return "lower"; - } else { - return "upper"; - } - } - - /** - * Returns whether a node is under a decorator or not. - * @param {ASTNode} node CallExpression node - * @returns {Boolean} Returns true if the node is under a decorator. - */ - function isDecorator(node) { - return node.parent.type === "Decorator"; - } - - /** - * Check if capitalization is allowed for a CallExpression - * @param {Object} allowedMap Object mapping calleeName to a Boolean - * @param {ASTNode} node CallExpression node - * @param {string} calleeName Capitalized callee name from a CallExpression - * @returns {Boolean} Returns true if the callee may be capitalized - */ - function isCapAllowed(allowedMap, node, calleeName) { - if (allowedMap[calleeName] || allowedMap[context.getSource(node.callee)]) { - return true; - } - if (calleeName === "UTC" && node.callee.type === "MemberExpression") { - // allow if callee is Date.UTC - return node.callee.object.type === "Identifier" && - node.callee.object.name === "Date"; - } - return false; - } - - /** - * Reports the given message for the given node. The location will be the start of the property or the callee. - * @param {ASTNode} node CallExpression or NewExpression node. - * @param {string} message The message to report. - * @returns {void} - */ - function report(node, message) { - var callee = node.callee; - - if (callee.type === "MemberExpression") { - callee = callee.property; - } - - context.report(node, callee.loc.start, message); - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - if (NEW_IS_CAP) { - listeners.NewExpression = function(node) { - - var constructorName = extractNameFromExpression(node); - if (constructorName) { - var capitalization = getCap(constructorName); - var isAllowed = capitalization !== "lower" || isCapAllowed(newIsCapExceptions, node, constructorName); - if (!isAllowed) { - report(node, "A constructor name should not start with a lowercase letter."); - } - } - }; - } - - if (CAP_IS_NEW) { - listeners.CallExpression = function(node) { - - var calleeName = extractNameFromExpression(node); - if (calleeName) { - var capitalization = getCap(calleeName); - var isAllowed = capitalization !== "upper" || isDecorator(node) || isCapAllowed(capIsNewExceptions, node, calleeName); - if (!isAllowed) { - report(node, "A function with a name starting with an uppercase letter should only be used as a constructor."); - } - } - }; - } - - return listeners; -}; - -module.exports.schema = [ - { - "type": "object", - "properties": { - "newIsCap": { - "type": "boolean" - }, - "capIsNew": { - "type": "boolean" - }, - "newIsCapExceptions": { - "type": "array", - "items": { - "type": "string" - } - }, - "capIsNewExceptions": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "additionalProperties": false - } -]; +module.exports = ruleComposer.filterReports( + newCapRule, + (problem, metadata) => !isDecorator(problem.node) +); diff --git a/eslint/babel-eslint-plugin/rules/no-invalid-this.js b/eslint/babel-eslint-plugin/rules/no-invalid-this.js index a8478a852f5b..ab12ca5320a3 100644 --- a/eslint/babel-eslint-plugin/rules/no-invalid-this.js +++ b/eslint/babel-eslint-plugin/rules/no-invalid-this.js @@ -1,143 +1,24 @@ -/** - * @fileoverview A rule to disallow `this` keywords outside of classes or class-like objects. - * @author Toru Nagashima - */ - "use strict"; -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("../ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -module.exports = { - meta: { - docs: { - description: "disallow `this` keywords outside of classes or class-like objects", - category: "Best Practices", - recommended: false - }, - - schema: [] - }, - - create(context) { - const stack = [], - sourceCode = context.getSourceCode(); +const ruleComposer = require('eslint-rule-composer'); +const eslint = require('eslint'); +const noInvalidThisRule = new eslint.Linter().getRules().get('no-invalid-this'); - let insideClassProperty = false; +module.exports = ruleComposer.filterReports( + noInvalidThisRule, + (problem, metadata) => { + let inClassProperty = false; + let node = problem.node; - /** - * Gets the current checking context. - * - * The return value has a flag that whether or not `this` keyword is valid. - * The flag is initialized when got at the first time. - * - * @returns {{valid: boolean}} - * an object which has a flag that whether or not `this` keyword is valid. - */ - stack.getCurrent = function() { - const current = this[this.length - 1]; - - if (!current.init) { - current.init = true; - current.valid = !astUtils.isDefaultThisBinding( - current.node, - sourceCode); + while (node) { + if (node.type === "ClassProperty") { + inClassProperty = true; + return; } - return current; - }; - - /** - * `this` should be fair game anywhere inside a class property. - * - * @returns {void} - */ - function enterClassProperty() { - insideClassProperty = true; - } - - /** - * Back to the normal check. - * @returns {void} - */ - function exitClassProperty() { - insideClassProperty = false; - } - - /** - * Pushs new checking context into the stack. - * - * The checking context is not initialized yet. - * Because most functions don't have `this` keyword. - * When `this` keyword was found, the checking context is initialized. - * - * @param {ASTNode} node - A function node that was entered. - * @returns {void} - */ - function enterFunction(node) { - - // `this` can be invalid only under strict mode. - stack.push({ - init: !context.getScope().isStrict, - node, - valid: true - }); - } - - /** - * Pops the current checking context from the stack. - * @returns {void} - */ - function exitFunction() { - stack.pop(); + + node = node.parent; } - return { - - /* - * `this` is invalid only under strict mode. - * Modules is always strict mode. - */ - Program(node) { - const scope = context.getScope(), - features = context.parserOptions.ecmaFeatures || {}; - - stack.push({ - init: true, - node, - valid: !( - scope.isStrict || - node.sourceType === "module" || - (features.globalReturn && scope.childScopes[0].isStrict) - ) - }); - }, - - "Program:exit"() { - stack.pop(); - }, - - ClassProperty: enterClassProperty, - "ClassProperty:exit": exitClassProperty, - FunctionDeclaration: enterFunction, - "FunctionDeclaration:exit": exitFunction, - FunctionExpression: enterFunction, - "FunctionExpression:exit": exitFunction, - - // Reports if `this` of the current context is invalid. - ThisExpression(node) { - const current = stack.getCurrent(); - - if (!insideClassProperty && current && !current.valid) { - context.report(node, "Unexpected 'this'."); - } - } - }; + return !inClassProperty; } -}; +); diff --git a/eslint/babel-eslint-plugin/rules/object-curly-spacing.js b/eslint/babel-eslint-plugin/rules/object-curly-spacing.js index 54d8becae9a7..19953bf04ffe 100644 --- a/eslint/babel-eslint-plugin/rules/object-curly-spacing.js +++ b/eslint/babel-eslint-plugin/rules/object-curly-spacing.js @@ -1,296 +1,25 @@ -/** - * @fileoverview Disallows or enforces spaces inside of object literals. - * @author Jamund Ferguson - * @copyright 2014 Brandyn Bennett. All rights reserved. - * @copyright 2014 Michael Ficarra. No rights reserved. - * @copyright 2014 Vignesh Anand. All rights reserved. - * @copyright 2015 Jamund Ferguson. All rights reserved. - * @copyright 2015 Mathieu M-Gosselin. All rights reserved. - * @copyright 2015 Toru Nagashima. All rights reserved. - * See LICENSE file in root directory for full license. - */ "use strict"; -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ +const ruleComposer = require('eslint-rule-composer'); +const eslint = require('eslint'); +const objectCurlySpacingRule = new eslint.Linter().getRules().get('object-curly-spacing'); -module.exports = function(context) { - var spaced = context.options[0] === "always", - sourceCode = context.getSourceCode(); - - /** - * Determines whether an option is set, relative to the spacing option. - * If spaced is "always", then check whether option is set to false. - * If spaced is "never", then check whether option is set to true. - * @param {Object} option - The option to exclude. - * @returns {boolean} Whether or not the property is excluded. - */ - function isOptionSet(option) { - return context.options[1] != null ? context.options[1][option] === !spaced : false; - } - - var options = { - spaced: spaced, - arraysInObjectsException: isOptionSet("arraysInObjects"), - objectsInObjectsException: isOptionSet("objectsInObjects") - }; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Determines whether two adjacent tokens are have whitespace between them. - * @param {Object} left - The left token object. - * @param {Object} right - The right token object. - * @returns {boolean} Whether or not there is space between the tokens. - */ - function isSpaced(left, right) { - return sourceCode.isSpaceBetweenTokens(left, right); - } - - /** - * Determines whether two adjacent tokens are on the same line. - * @param {Object} left - The left token object. - * @param {Object} right - The right token object. - * @returns {boolean} Whether or not the tokens are on the same line. - */ - function isSameLine(left, right) { - return left.loc.start.line === right.loc.start.line; - } - - /** - * Reports that there shouldn't be a space after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @returns {void} - */ - function reportNoBeginningSpace(node, token) { - context.report({ - node: node, - loc: token.loc.end, - message: "There should be no space after '" + token.value + "'", - fix: function(fixer) { - var nextToken = sourceCode.getTokenAfter(token); - return fixer.removeRange([token.range[1], nextToken.range[0]]); - } - }); - } - - /** - * Reports that there shouldn't be a space before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @returns {void} - */ - function reportNoEndingSpace(node, token) { - context.report({ - node: node, - loc: token.loc.start, - message: "There should be no space before '" + token.value + "'", - fix: function(fixer) { - var previousToken = sourceCode.getTokenBefore(token); - return fixer.removeRange([previousToken.range[1], token.range[0]]); - } - }); - } - - /** - * Reports that there should be a space after the first token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @returns {void} - */ - function reportRequiredBeginningSpace(node, token) { - context.report({ - node: node, - loc: token.loc.end, - message: "A space is required after '" + token.value + "'", - fix: function(fixer) { - return fixer.insertTextAfter(token, " "); - } - }); - } - - /** - * Reports that there should be a space before the last token - * @param {ASTNode} node - The node to report in the event of an error. - * @param {Token} token - The token to use for the report. - * @returns {void} - */ - function reportRequiredEndingSpace(node, token) { - context.report({ - node: node, - loc: token.loc.start, - message: "A space is required before '" + token.value + "'", - fix: function(fixer) { - return fixer.insertTextBefore(token, " "); - } - }); - } - - /** - * Determines if spacing in curly braces is valid. - * @param {ASTNode} node The AST node to check. - * @param {Token} first The first token to check (should be the opening brace) - * @param {Token} second The second token to check (should be first after the opening brace) - * @param {Token} penultimate The penultimate token to check (should be last before closing brace) - * @param {Token} last The last token to check (should be closing brace) - * @returns {void} - */ - function validateBraceSpacing(node, first, second, penultimate, last) { - var closingCurlyBraceMustBeSpaced = - options.arraysInObjectsException && penultimate.value === "]" || - options.objectsInObjectsException && penultimate.value === "}" - ? !options.spaced : options.spaced; - - if (isSameLine(first, second)) { - if (options.spaced && !isSpaced(first, second)) { - reportRequiredBeginningSpace(node, first); - } - if (!options.spaced && isSpaced(first, second)) { - reportNoBeginningSpace(node, first); - } - } - - if (isSameLine(penultimate, last)) { - if (closingCurlyBraceMustBeSpaced && !isSpaced(penultimate, last)) { - reportRequiredEndingSpace(node, last); - } - if (!closingCurlyBraceMustBeSpaced && isSpaced(penultimate, last)) { - reportNoEndingSpace(node, last); - } - } - } - - /** - * Reports a given object node if spacing in curly braces is invalid. - * @param {ASTNode} node - An ObjectExpression or ObjectPattern node to check. - * @returns {void} - */ - function checkForObject(node) { - if (node.properties.length === 0) { - return; - } - - var firstSpecifier = node.properties[0], - lastSpecifier = node.properties[node.properties.length - 1]; - - var first = sourceCode.getTokenBefore(firstSpecifier), - last = sourceCode.getTokenAfter(lastSpecifier); - - // support trailing commas - if (last.value === ",") { - last = sourceCode.getTokenAfter(last); - } - - var second = sourceCode.getTokenAfter(first), - penultimate = sourceCode.getTokenBefore(last); - - validateBraceSpacing(node, first, second, penultimate, last); - } - - /** - * Reports a given import node if spacing in curly braces is invalid. - * @param {ASTNode} node - An ImportDeclaration node to check. - * @returns {void} - */ - function checkForImport(node) { - if (node.specifiers.length === 0) { - return; - } - - var firstSpecifier = node.specifiers[0], - lastSpecifier = node.specifiers[node.specifiers.length - 1]; - - if (lastSpecifier.type !== "ImportSpecifier") { - return; - } - if (firstSpecifier.type !== "ImportSpecifier") { - firstSpecifier = node.specifiers[1]; - } - - var first = sourceCode.getTokenBefore(firstSpecifier), - last = sourceCode.getTokenAfter(lastSpecifier); - - // to support a trailing comma. - if (last.value === ",") { - last = sourceCode.getTokenAfter(last); - } - - var second = sourceCode.getTokenAfter(first), - penultimate = sourceCode.getTokenBefore(last); - - validateBraceSpacing(node, first, second, penultimate, last); - } - - /** - * Reports a given export node if spacing in curly braces is invalid. - * @param {ASTNode} node - An ExportNamedDeclaration node to check. - * @returns {void} - */ - function checkForExport(node) { - if (node.specifiers.length === 0) { - return; - } - - var firstSpecifier = node.specifiers[0], - lastSpecifier = node.specifiers[node.specifiers.length - 1], - first = sourceCode.getTokenBefore(firstSpecifier), - last = sourceCode.getTokenAfter(lastSpecifier); +module.exports = ruleComposer.filterReports( + objectCurlySpacingRule, + (problem, metadata) => { + const node = problem.node; + // Allow `exportNamespaceFrom` and `exportDefaultFrom` syntax: // export * as x from '...'; // export x from '...'; - if (first.value === "export") { - return; + if ( + node.type === 'ExportNamedDeclaration' && + node.specifiers.length > 0 && + metadata.sourceCode.getTokenBefore(node.specifiers[0]).value === "export" + ) { + return false; } - // to support a trailing comma. - if (last.value === ",") { - last = sourceCode.getTokenAfter(last); - } - - var second = sourceCode.getTokenAfter(first), - penultimate = sourceCode.getTokenBefore(last); - - validateBraceSpacing(node, first, second, penultimate, last); - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - // var {x} = y; - ObjectPattern: checkForObject, - - // var y = {x: 'y'} - ObjectExpression: checkForObject, - - // import {y} from 'x'; - ImportDeclaration: checkForImport, - - // export {name} from 'yo'; - ExportNamedDeclaration: checkForExport - }; - -}; - -module.exports.schema = [ - { - "enum": ["always", "never"] - }, - { - "type": "object", - "properties": { - "arraysInObjects": { - "type": "boolean" - }, - "objectsInObjects": { - "type": "boolean" - } - }, - "additionalProperties": false + return true; } -]; +); diff --git a/eslint/babel-eslint-plugin/rules/semi.js b/eslint/babel-eslint-plugin/rules/semi.js index 0f9ef74f4ec0..95a2467bfc52 100644 --- a/eslint/babel-eslint-plugin/rules/semi.js +++ b/eslint/babel-eslint-plugin/rules/semi.js @@ -1,225 +1,115 @@ -/** - * @fileoverview Rule to flag missing semicolons. - * @author Nicholas C. Zakas - */ "use strict"; -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ +const ruleComposer = require('eslint-rule-composer'); +const eslint = require('eslint'); +const semiRule = new eslint.Linter().getRules().get('semi'); -module.exports = { - meta: { - docs: { - description: "require or disallow semicolons instead of ASI", - category: "Stylistic Issues", - recommended: false - }, +const OPT_OUT_PATTERN = /^[-[(/+`]/; // One of [(/+-` - fixable: "code", - - schema: { - anyOf: [ - { - type: "array", - items: [ - { - enum: ["never"] - } - ], - minItems: 0, - maxItems: 1 - }, - { - type: "array", - items: [ - { - enum: ["always"] - }, - { - type: "object", - properties: { - omitLastInOneLineBlock: { type: "boolean" } - }, - additionalProperties: false - } - ], - minItems: 0, - maxItems: 2 - } - ] - } - }, - - create(context) { - - const OPT_OUT_PATTERN = /^[-[(/+`]/; // One of [(/+-` - const options = context.options[1]; - const never = context.options[0] === "never", - exceptOneLine = options && options.omitLastInOneLineBlock === true, - sourceCode = context.getSourceCode(); - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Reports a semicolon error with appropriate location and message. - * @param {ASTNode} node The node with an extra or missing semicolon. - * @param {boolean} missing True if the semicolon is missing. - * @returns {void} - */ - function report(node, missing) { - const lastToken = sourceCode.getLastToken(node); - let message, - fix, - loc = lastToken.loc; - - if (!missing) { - message = "Missing semicolon."; - loc = loc.end; - fix = function(fixer) { - return fixer.insertTextAfter(lastToken, ";"); - }; - } else { - message = "Extra semicolon."; - loc = loc.start; - fix = function(fixer) { - return fixer.remove(lastToken); - }; - } +const isSemicolon = token => token.type === "Punctuator" && token.value === ";"; - context.report({ - node, - loc, - message, - fix - }); +const isUnnecessarySemicolon = (context, lastToken) => { + if (!isSemicolon(lastToken)) { + return false; + } - } + const nextToken = context.getSourceCode().getTokenAfter(lastToken); - /** - * Checks whether a token is a semicolon punctuator. - * @param {Token} token The token. - * @returns {boolean} True if token is a semicolon punctuator. - */ - function isSemicolon(token) { - return (token.type === "Punctuator" && token.value === ";"); - } + if (!nextToken) { + return true; + } - /** - * Check if a semicolon is unnecessary, only true if: - * - next token is on a new line and is not one of the opt-out tokens - * - next token is a valid statement divider - * @param {Token} lastToken last token of current node. - * @returns {boolean} whether the semicolon is unnecessary. - */ - function isUnnecessarySemicolon(lastToken) { - if (!isSemicolon(lastToken)) { - return false; - } + const lastTokenLine = lastToken.loc.end.line; + const nextTokenLine = nextToken.loc.start.line; + const isOptOutToken = OPT_OUT_PATTERN.test(nextToken.value) && nextToken.value !== "++" && nextToken.value !== "--"; + const isDivider = (nextToken.value === "}" || nextToken.value === ";"); - const nextToken = sourceCode.getTokenAfter(lastToken); + return (lastTokenLine !== nextTokenLine && !isOptOutToken) || isDivider; +} - if (!nextToken) { - return true; - } +const isOneLinerBlock = (context, node) => { + const nextToken = context.getSourceCode().getTokenAfter(node); - const lastTokenLine = lastToken.loc.end.line; - const nextTokenLine = nextToken.loc.start.line; - const isOptOutToken = OPT_OUT_PATTERN.test(nextToken.value) && nextToken.value !== "++" && nextToken.value !== "--"; - const isDivider = (nextToken.value === "}" || nextToken.value === ";"); + if (!nextToken || nextToken.value !== "}") { + return false; + } - return (lastTokenLine !== nextTokenLine && !isOptOutToken) || isDivider; - } + const parent = node.parent; - /** - * Checks a node to see if it's in a one-liner block statement. - * @param {ASTNode} node The node to check. - * @returns {boolean} whether the node is in a one-liner block statement. - */ - function isOneLinerBlock(node) { - const nextToken = sourceCode.getTokenAfter(node); + return parent && parent.type === "BlockStatement" && + parent.loc.start.line === parent.loc.end.line; +}; - if (!nextToken || nextToken.value !== "}") { - return false; - } +const report = (context, node, missing) => { + const lastToken = context.getSourceCode().getLastToken(node); - const parent = node.parent; + let message, fix, loc = lastToken.loc; - return parent && parent.type === "BlockStatement" && - parent.loc.start.line === parent.loc.end.line; - } + if (!missing) { + message = "Missing semicolon."; + loc = loc.end; + fix = function(fixer) { + return fixer.insertTextAfter(lastToken, ";"); + }; + } else { + message = "Extra semicolon."; + loc = loc.start; + fix = function(fixer) { + return fixer.remove(lastToken); + }; + } + + context.report({ + node, + loc, + message, + fix + }); +}; + +const semiRuleWithClassProperty = ruleComposer.joinReports([ + semiRule, + context => ({ + ClassProperty(node) { + const options = context.options[1]; + const exceptOneLine = options && options.omitLastInOneLineBlock === true; - /** - * Checks a node to see if it's followed by a semicolon. - * @param {ASTNode} node The node to check. - * @returns {void} - */ - function checkForSemicolon(node) { + const sourceCode = context.getSourceCode(); const lastToken = sourceCode.getLastToken(node); - if (never) { - if (isUnnecessarySemicolon(lastToken)) { - report(node, true); + if (context.options[0] === "never") { + if (isUnnecessarySemicolon(context, lastToken)) { + report(context, node, true); } } else { if (!isSemicolon(lastToken)) { if (!exceptOneLine || !isOneLinerBlock(node)) { - report(node); + report(context, node); } } else { if (exceptOneLine && isOneLinerBlock(node)) { - report(node, true); + report(context, node, true); } } } + }, + }), +]); + +module.exports = ruleComposer.filterReports( + semiRuleWithClassProperty, + (problem, metadata) => { + const node = problem.node; + + // Handle async iterator: + // for await (let something of {}) + if ( + node.type === "VariableDeclaration" && + node.parent.type === "ForAwaitStatement" + ) { + return false; } - /** - * Checks to see if there's a semicolon after a variable declaration. - * @param {ASTNode} node The node to check. - * @returns {void} - */ - function checkForSemicolonForVariableDeclaration(node) { - const ancestors = context.getAncestors(), - parentIndex = ancestors.length - 1, - parent = ancestors[parentIndex]; - - if ((parent.type !== "ForStatement" || parent.init !== node) && - (!/^For(?:In|Of|Await)Statement/.test(parent.type) || parent.left !== node) - ) { - checkForSemicolon(node); - } - } - - //-------------------------------------------------------------------------- - // Public API - //-------------------------------------------------------------------------- - - return { - VariableDeclaration: checkForSemicolonForVariableDeclaration, - ExpressionStatement: checkForSemicolon, - ReturnStatement: checkForSemicolon, - ThrowStatement: checkForSemicolon, - DoWhileStatement: checkForSemicolon, - DebuggerStatement: checkForSemicolon, - BreakStatement: checkForSemicolon, - ContinueStatement: checkForSemicolon, - ImportDeclaration: checkForSemicolon, - ExportAllDeclaration: checkForSemicolon, - ClassProperty: checkForSemicolon, - ExportNamedDeclaration(node) { - if (!node.declaration) { - checkForSemicolon(node); - } - }, - ExportDefaultDeclaration(node) { - if (!/(?:Class|Function)Declaration/.test(node.declaration.type)) { - checkForSemicolon(node); - } - } - }; - + return true; } -}; +); diff --git a/eslint/babel-eslint-plugin/tests/rules/no-invalid-this.js b/eslint/babel-eslint-plugin/tests/rules/no-invalid-this.js index 5e1c67c8b8ae..3ab5da59c95f 100644 --- a/eslint/babel-eslint-plugin/tests/rules/no-invalid-this.js +++ b/eslint/babel-eslint-plugin/tests/rules/no-invalid-this.js @@ -78,6 +78,9 @@ function extractPatterns(patterns, type) { thisPattern.code += " /* should error */"; } + delete thisPattern.invalid; + delete thisPattern.valid; + return thisPattern; }); }); diff --git a/eslint/babel-eslint-plugin/tests/rules/object-curly-spacing.js b/eslint/babel-eslint-plugin/tests/rules/object-curly-spacing.js index 44c188fdd0a3..8771785ff51e 100644 --- a/eslint/babel-eslint-plugin/tests/rules/object-curly-spacing.js +++ b/eslint/babel-eslint-plugin/tests/rules/object-curly-spacing.js @@ -161,13 +161,13 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, errors: [ { - message: "A space is required after '{'", + message: "A space is required after '{'.", type: "ImportDeclaration", line: 1, - column: 9 + column: 8 }, { - message: "A space is required before '}'", + message: "A space is required before '}'.", type: "ImportDeclaration", line: 1, column: 12 @@ -183,7 +183,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, errors: [ { - message: "A space is required before '}'", + message: "A space is required before '}'.", type: "ImportDeclaration", line: 1, column: 18 @@ -199,13 +199,13 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, errors: [ { - message: "A space is required after '{'", + message: "A space is required after '{'.", type: "ImportDeclaration", line: 1, - column: 9 + column: 8 }, { - message: "A space is required before '}'", + message: "A space is required before '}'.", type: "ImportDeclaration", line: 1, column: 17 @@ -221,7 +221,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, errors: [ { - message: "A space is required before '}'", + message: "A space is required before '}'.", type: "ImportDeclaration", line: 1, column: 13 @@ -237,7 +237,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, errors: [ { - message: "A space is required before '}'", + message: "A space is required before '}'.", type: "ImportDeclaration", line: 1, column: 16 @@ -254,7 +254,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, errors: [ { - message: "A space is required before '}'", + message: "A space is required before '}'.", type: "ImportDeclaration", line: 1, column: 21 @@ -271,13 +271,13 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, errors: [ { - message: "A space is required after '{'", + message: "A space is required after '{'.", type: "ImportDeclaration", line: 1, - column: 12 + column: 11 }, { - message: "A space is required before '}'", + message: "A space is required before '}'.", type: "ImportDeclaration", line: 1, column: 15 @@ -294,13 +294,13 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, errors: [ { - message: "A space is required after '{'", + message: "A space is required after '{'.", type: "ImportDeclaration", line: 1, - column: 12 + column: 11 }, { - message: "A space is required before '}'", + message: "A space is required before '}'.", type: "ImportDeclaration", line: 1, column: 20 @@ -316,13 +316,13 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, errors: [ { - message: "A space is required after '{'", + message: "A space is required after '{'.", type: "ImportDeclaration", line: 1, - column: 9 + column: 8 }, { - message: "A space is required before '}'", + message: "A space is required before '}'.", type: "ImportDeclaration", line: 1, column: 13 @@ -339,13 +339,13 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, errors: [ { - message: "There should be no space after '{'", + message: "There should be no space after '{'.", type: "ImportDeclaration", line: 1, - column: 9 + column: 8 }, { - message: "There should be no space before '}'", + message: "There should be no space before '}'.", type: "ImportDeclaration", line: 1, column: 15 @@ -361,13 +361,13 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, errors: [ { - message: "A space is required after '{'", + message: "A space is required after '{'.", type: "ExportNamedDeclaration", line: 1, - column: 9 + column: 8 }, { - message: "A space is required before '}'", + message: "A space is required before '}'.", type: "ExportNamedDeclaration", line: 1, column: 12 @@ -382,7 +382,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { options: ["always", {"arraysInObjects": false}], errors: [ { - message: "There should be no space before '}'", + message: "There should be no space before '}'.", type: "ObjectExpression" } ] @@ -393,7 +393,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { options: ["always", {"arraysInObjects": false}], errors: [ { - message: "There should be no space before '}'", + message: "There should be no space before '}'.", type: "ObjectExpression" } ] @@ -406,7 +406,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { options: ["always", {"objectsInObjects": false}], errors: [ { - message: "There should be no space before '}'", + message: "There should be no space before '}'.", type: "ObjectExpression", line: 1, column: 43 @@ -419,7 +419,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { options: ["always", {"objectsInObjects": false}], errors: [ { - message: "There should be no space before '}'", + message: "There should be no space before '}'.", type: "ObjectExpression", line: 1, column: 61 @@ -435,7 +435,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { ecmaFeatures: { destructuring: true }, errors: [ { - message: "A space is required before '}'", + message: "A space is required before '}'.", type: "ObjectPattern", line: 1, column: 9 @@ -449,7 +449,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { ecmaFeatures: { destructuring: true }, errors: [ { - message: "There should be no space before '}'", + message: "There should be no space before '}'.", type: "ObjectPattern", line: 1, column: 9 @@ -463,7 +463,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { ecmaFeatures: { destructuring: true }, errors: [ { - message: "There should be no space before '}'", + message: "There should be no space before '}'.", type: "ObjectPattern", line: 1, column: 10 @@ -477,13 +477,13 @@ ruleTester.run('babel/object-curly-spacing', rule, { ecmaFeatures: { destructuring: true }, errors: [ { - message: "There should be no space after '{'", + message: "There should be no space after '{'.", type: "ObjectPattern", line: 1, - column: 6 + column: 5 }, { - message: "There should be no space before '}'", + message: "There should be no space before '}'.", type: "ObjectPattern", line: 1, column: 11 @@ -498,7 +498,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { options: ["never", {"objectsInObjects": true}], errors: [ { - message: "A space is required before '}'", + message: "A space is required before '}'.", type: "ObjectExpression", line: 1, column: 39 @@ -511,7 +511,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { options: ["never", {"objectsInObjects": true}], errors: [ { - message: "A space is required before '}'", + message: "A space is required before '}'.", type: "ObjectExpression", line: 1, column: 55 @@ -526,13 +526,13 @@ ruleTester.run('babel/object-curly-spacing', rule, { options: ["always"], errors: [ { - message: "A space is required after '{'", + message: "A space is required after '{'.", type: "ObjectExpression", line: 1, - column: 12 + column: 11 }, { - message: "A space is required before '}'", + message: "A space is required before '}'.", type: "ObjectExpression", line: 1, column: 30 @@ -545,10 +545,10 @@ ruleTester.run('babel/object-curly-spacing', rule, { options: ["always"], errors: [ { - message: "A space is required after '{'", + message: "A space is required after '{'.", type: "ObjectExpression", line: 1, - column: 12 + column: 11 } ] }, @@ -558,7 +558,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { options: ["always"], errors: [ { - message: "A space is required before '}'", + message: "A space is required before '}'.", type: "ObjectExpression", line: 1, column: 31 @@ -571,13 +571,13 @@ ruleTester.run('babel/object-curly-spacing', rule, { options: ["never"], errors: [ { - message: "There should be no space after '{'", + message: "There should be no space after '{'.", type: "ObjectExpression", line: 1, - column: 12 + column: 11 }, { - message: "There should be no space before '}'", + message: "There should be no space before '}'.", type: "ObjectExpression", line: 1, column: 32 @@ -590,7 +590,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { options: ["never"], errors: [ { - message: "There should be no space before '}'", + message: "There should be no space before '}'.", type: "ObjectExpression", line: 1, column: 31 @@ -603,10 +603,10 @@ ruleTester.run('babel/object-curly-spacing', rule, { options: ["never"], errors: [ { - message: "There should be no space after '{'", + message: "There should be no space after '{'.", type: "ObjectExpression", line: 1, - column: 12 + column: 11 } ] }, @@ -616,16 +616,16 @@ ruleTester.run('babel/object-curly-spacing', rule, { options: ["never"], errors: [ { - message: "There should be no space after '{'", + message: "There should be no space after '{'.", type: "ObjectExpression", line: 1, - column: 12 + column: 11 }, { - message: "There should be no space after '{'", + message: "There should be no space after '{'.", type: "ObjectExpression", line: 1, - column: 19 + column: 18 } ] }, @@ -635,13 +635,13 @@ ruleTester.run('babel/object-curly-spacing', rule, { options: ["never"], errors: [ { - message: "There should be no space before '}'", + message: "There should be no space before '}'.", type: "ObjectExpression", line: 1, column: 28 }, { - message: "There should be no space before '}'", + message: "There should be no space before '}'.", type: "ObjectExpression", line: 1, column: 40 @@ -658,10 +658,10 @@ ruleTester.run('babel/object-curly-spacing', rule, { options: ["always"], errors: [ { - message: "A space is required after '{'", + message: "A space is required after '{'.", type: "ObjectExpression", line: 1, - column: 23 + column: 22 } ] }, @@ -674,13 +674,13 @@ ruleTester.run('babel/object-curly-spacing', rule, { options: ["always"], errors: [ { - message: "A space is required after '{'", + message: "A space is required after '{'.", type: "ObjectPattern", line: 1, - column: 6 + column: 5 }, { - message: "A space is required before '}'", + message: "A space is required before '}'.", type: "ObjectPattern", line: 1, column: 10 @@ -694,7 +694,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { options: ["always"], errors: [ { - message: "A space is required before '}'", + message: "A space is required before '}'.", type: "ObjectPattern", line: 1, column: 11 @@ -708,13 +708,13 @@ ruleTester.run('babel/object-curly-spacing', rule, { options: ["never"], errors: [ { - message: "There should be no space after '{'", + message: "There should be no space after '{'.", type: "ObjectPattern", line: 1, - column: 6 + column: 5 }, { - message: "There should be no space before '}'", + message: "There should be no space before '}'.", type: "ObjectPattern", line: 1, column: 12 @@ -728,7 +728,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { options: ["never"], errors: [ { - message: "There should be no space before '}'", + message: "There should be no space before '}'.", type: "ObjectPattern", line: 1, column: 11 @@ -742,7 +742,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { options: ["always"], errors: [ { - message: "A space is required before '}'", + message: "A space is required before '}'.", type: "ObjectPattern", line: 1, column: 11 @@ -756,10 +756,10 @@ ruleTester.run('babel/object-curly-spacing', rule, { options: ["always"], errors: [ { - message: "A space is required after '{'", + message: "A space is required after '{'.", type: "ObjectPattern", line: 1, - column: 6 + column: 5 } ] }, @@ -771,7 +771,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { options: ["never", {"arraysInObjects": true}], errors: [ { - message: "A space is required before '}'", + message: "A space is required before '}'.", type: "ObjectExpression" } ] @@ -782,7 +782,7 @@ ruleTester.run('babel/object-curly-spacing', rule, { options: ["never", {"arraysInObjects": true}], errors: [ { - message: "A space is required before '}'", + message: "A space is required before '}'.", type: "ObjectExpression" } ] @@ -801,13 +801,13 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, errors: [ { - message: "A space is required after '{'", + message: "A space is required after '{'.", type: "ObjectPattern", line: 1, - column: 14 + column: 13 }, { - message: "A space is required before '}'", + message: "A space is required before '}'.", type: "ObjectPattern", line: 1, column: 17 @@ -826,13 +826,13 @@ ruleTester.run('babel/object-curly-spacing', rule, { }, errors: [ { - message: "There should be no space after '{'", + message: "There should be no space after '{'.", type: "ObjectPattern", line: 1, - column: 14 + column: 13 }, { - message: "There should be no space before '}'", + message: "There should be no space before '}'.", type: "ObjectPattern", line: 1, column: 19 diff --git a/eslint/babel-eslint-plugin/yarn.lock b/eslint/babel-eslint-plugin/yarn.lock new file mode 100644 index 000000000000..b7e874dfa9d9 --- /dev/null +++ b/eslint/babel-eslint-plugin/yarn.lock @@ -0,0 +1,1023 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +acorn-jsx@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" + dependencies: + acorn "^3.0.4" + +acorn@^3.0.4: + version "3.3.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" + +acorn@^5.5.0: + version "5.5.3" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.5.3.tgz#f473dd47e0277a08e28e9bec5aeeb04751f0b8c9" + +ajv-keywords@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.1.tgz#617997fc5f60576894c435f940d819e135b80762" + +ajv@^5.2.3, ajv@^5.3.0: + version "5.5.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" + dependencies: + co "^4.6.0" + fast-deep-equal "^1.0.0" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.3.0" + +ansi-escapes@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.1.0.tgz#f73207bb81207d75fd6c83f125af26eea378ca30" + +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + +ansi-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + +ansi-styles@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" + +ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + dependencies: + color-convert "^1.9.0" + +argparse@^1.0.7: + version "1.0.9" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86" + dependencies: + sprintf-js "~1.0.2" + +array-union@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" + dependencies: + array-uniq "^1.0.1" + +array-uniq@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" + +arrify@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" + +babel-code-frame@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4" + dependencies: + chalk "^1.1.0" + esutils "^2.0.2" + js-tokens "^3.0.0" + +babel-eslint@^7.1.0: + version "7.2.3" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-7.2.3.tgz#b2fe2d80126470f5c19442dc757253a897710827" + dependencies: + babel-code-frame "^6.22.0" + babel-traverse "^6.23.1" + babel-types "^6.23.0" + babylon "^6.17.0" + +babel-messages@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" + dependencies: + babel-runtime "^6.22.0" + +babel-runtime@^6.22.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.23.0.tgz#0a9489f144de70efb3ce4300accdb329e2fc543b" + dependencies: + core-js "^2.4.0" + regenerator-runtime "^0.10.0" + +babel-traverse@^6.23.1: + version "6.25.0" + resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.25.0.tgz#2257497e2fcd19b89edc13c4c91381f9512496f1" + dependencies: + babel-code-frame "^6.22.0" + babel-messages "^6.23.0" + babel-runtime "^6.22.0" + babel-types "^6.25.0" + babylon "^6.17.2" + debug "^2.2.0" + globals "^9.0.0" + invariant "^2.2.0" + lodash "^4.2.0" + +babel-types@^6.23.0, babel-types@^6.25.0: + version "6.25.0" + resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.25.0.tgz#70afb248d5660e5d18f811d91c8303b54134a18e" + dependencies: + babel-runtime "^6.22.0" + esutils "^2.0.2" + lodash "^4.2.0" + to-fast-properties "^1.0.1" + +babylon@^6.17.0, babylon@^6.17.2: + version "6.17.4" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.17.4.tgz#3e8b7402b88d22c3423e137a1577883b15ff869a" + +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + +brace-expansion@^1.1.7: + version "1.1.8" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292" + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +browser-stdout@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" + +buffer-from@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.0.0.tgz#4cb8832d23612589b0406e9e2956c17f06fdf531" + +caller-path@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" + dependencies: + callsites "^0.2.0" + +callsites@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" + +chalk@^1.1.0: + version "1.1.3" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + dependencies: + ansi-styles "^2.2.1" + escape-string-regexp "^1.0.2" + has-ansi "^2.0.0" + strip-ansi "^3.0.0" + supports-color "^2.0.0" + +chalk@^2.0.0, chalk@^2.1.0: + version "2.3.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.2.tgz#250dc96b07491bfd601e648d66ddf5f60c7a5c65" + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + +chardet@^0.4.0: + version "0.4.2" + resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2" + +circular-json@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.1.tgz#be8b36aefccde8b3ca7aa2d6afc07a37242c0d2d" + +cli-cursor@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" + dependencies: + restore-cursor "^2.0.0" + +cli-width@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.1.0.tgz#b234ca209b29ef66fc518d9b98d5847b00edf00a" + +co@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + +color-convert@^1.9.0: + version "1.9.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.1.tgz#c1261107aeb2f294ebffec9ed9ecad529a6097ed" + dependencies: + color-name "^1.1.1" + +color-name@^1.1.1: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + +commander@2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" + dependencies: + graceful-readlink ">= 1.0.0" + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + +concat-stream@^1.6.0: + version "1.6.2" + resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" + dependencies: + buffer-from "^1.0.0" + inherits "^2.0.3" + readable-stream "^2.2.2" + typedarray "^0.0.6" + +core-js@^2.4.0: + version "2.4.1" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.4.1.tgz#4de911e667b0eae9124e34254b53aea6fc618d3e" + +core-util-is@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + +cross-spawn@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" + dependencies: + lru-cache "^4.0.1" + shebang-command "^1.2.0" + which "^1.2.9" + +debug@2.6.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.0.tgz#bc596bcabe7617f11d9fa15361eded5608b8499b" + dependencies: + ms "0.7.2" + +debug@^2.2.0: + version "2.6.8" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc" + dependencies: + ms "2.0.0" + +debug@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + dependencies: + ms "2.0.0" + +deep-is@~0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" + +del@^2.0.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8" + dependencies: + globby "^5.0.0" + is-path-cwd "^1.0.0" + is-path-in-cwd "^1.0.0" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + rimraf "^2.2.8" + +diff@3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-3.2.0.tgz#c9ce393a4b7cbd0b058a725c93df299027868ff9" + +doctrine@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" + dependencies: + esutils "^2.0.2" + +escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + +eslint-rule-composer@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/eslint-rule-composer/-/eslint-rule-composer-0.1.1.tgz#479dfd4e93d7f2777499a35ce9be76403c8e982a" + +eslint-scope@^3.7.1: + version "3.7.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint-visitor-keys@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" + +eslint@^4.19.1: + version "4.19.1" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.19.1.tgz#32d1d653e1d90408854bfb296f076ec7e186a300" + dependencies: + ajv "^5.3.0" + babel-code-frame "^6.22.0" + chalk "^2.1.0" + concat-stream "^1.6.0" + cross-spawn "^5.1.0" + debug "^3.1.0" + doctrine "^2.1.0" + eslint-scope "^3.7.1" + eslint-visitor-keys "^1.0.0" + espree "^3.5.4" + esquery "^1.0.0" + esutils "^2.0.2" + file-entry-cache "^2.0.0" + functional-red-black-tree "^1.0.1" + glob "^7.1.2" + globals "^11.0.1" + ignore "^3.3.3" + imurmurhash "^0.1.4" + inquirer "^3.0.6" + is-resolvable "^1.0.0" + js-yaml "^3.9.1" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.3.0" + lodash "^4.17.4" + minimatch "^3.0.2" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + optionator "^0.8.2" + path-is-inside "^1.0.2" + pluralize "^7.0.0" + progress "^2.0.0" + regexpp "^1.0.1" + require-uncached "^1.0.3" + semver "^5.3.0" + strip-ansi "^4.0.0" + strip-json-comments "~2.0.1" + table "4.0.2" + text-table "~0.2.0" + +espree@^3.5.4: + version "3.5.4" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.4.tgz#b0f447187c8a8bed944b815a660bddf5deb5d1a7" + dependencies: + acorn "^5.5.0" + acorn-jsx "^3.0.0" + +esprima@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" + +esquery@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.0.tgz#cfba8b57d7fba93f17298a8a006a04cda13d80fa" + dependencies: + estraverse "^4.0.0" + +esrecurse@^4.1.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.0.tgz#fa9568d98d3823f9a41d91e902dcab9ea6e5b163" + dependencies: + estraverse "^4.1.0" + object-assign "^4.0.1" + +estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1: + version "4.2.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" + +esutils@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" + +external-editor@^2.0.4: + version "2.1.0" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.1.0.tgz#3d026a21b7f95b5726387d4200ac160d372c3b48" + dependencies: + chardet "^0.4.0" + iconv-lite "^0.4.17" + tmp "^0.0.33" + +fast-deep-equal@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz#c053477817c86b51daa853c81e059b733d023614" + +fast-json-stable-stringify@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" + +fast-levenshtein@~2.0.4: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + +figures@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" + dependencies: + escape-string-regexp "^1.0.5" + +file-entry-cache@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" + dependencies: + flat-cache "^1.2.1" + object-assign "^4.0.1" + +flat-cache@^1.2.1: + version "1.2.2" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.2.2.tgz#fa86714e72c21db88601761ecf2f555d1abc6b96" + dependencies: + circular-json "^0.3.1" + del "^2.0.2" + graceful-fs "^4.1.2" + write "^0.2.1" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + +functional-red-black-tree@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" + +glob@7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.2" + once "^1.3.0" + path-is-absolute "^1.0.0" + +glob@^7.0.3, glob@^7.0.5, glob@^7.1.2: + version "7.1.2" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +globals@^11.0.1: + version "11.4.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.4.0.tgz#b85c793349561c16076a3c13549238a27945f1bc" + +globals@^9.0.0: + version "9.18.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" + +globby@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d" + dependencies: + array-union "^1.0.1" + arrify "^1.0.0" + glob "^7.0.3" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + +graceful-fs@^4.1.2: + version "4.1.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" + +"graceful-readlink@>= 1.0.0": + version "1.0.1" + resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" + +growl@1.9.2: + version "1.9.2" + resolved "https://registry.yarnpkg.com/growl/-/growl-1.9.2.tgz#0ea7743715db8d8de2c5ede1775e1b45ac85c02f" + +has-ansi@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + dependencies: + ansi-regex "^2.0.0" + +has-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" + +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + +iconv-lite@^0.4.17: + version "0.4.19" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" + +ignore@^3.3.3: + version "3.3.7" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.7.tgz#612289bfb3c220e186a58118618d5be8c1bab021" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2, inherits@^2.0.3, inherits@~2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + +inquirer@^3.0.6: + version "3.3.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.3.0.tgz#9dd2f2ad765dcab1ff0443b491442a20ba227dc9" + dependencies: + ansi-escapes "^3.0.0" + chalk "^2.0.0" + cli-cursor "^2.1.0" + cli-width "^2.0.0" + external-editor "^2.0.4" + figures "^2.0.0" + lodash "^4.3.0" + mute-stream "0.0.7" + run-async "^2.2.0" + rx-lite "^4.0.8" + rx-lite-aggregates "^4.0.8" + string-width "^2.1.0" + strip-ansi "^4.0.0" + through "^2.3.6" + +invariant@^2.2.0: + version "2.2.2" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" + dependencies: + loose-envify "^1.0.0" + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + +is-path-cwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" + +is-path-in-cwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz#6477582b8214d602346094567003be8a9eac04dc" + dependencies: + is-path-inside "^1.0.0" + +is-path-inside@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.0.tgz#fc06e5a1683fbda13de667aff717bbc10a48f37f" + dependencies: + path-is-inside "^1.0.1" + +is-promise@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" + +is-resolvable@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.0.0.tgz#8df57c61ea2e3c501408d100fb013cf8d6e0cc62" + dependencies: + tryit "^1.0.1" + +isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + +js-tokens@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7" + +js-yaml@^3.9.1: + version "3.11.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.11.0.tgz#597c1a8bd57152f26d622ce4117851a51f5ebaef" + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + +json-schema-traverse@^0.3.0: + version "0.3.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" + +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + +json3@3.3.2: + version "3.3.2" + resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.2.tgz#3c0434743df93e2f5c42aee7b19bcb483575f4e1" + +levn@^0.3.0, levn@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" + dependencies: + prelude-ls "~1.1.2" + type-check "~0.3.2" + +lodash._baseassign@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz#8c38a099500f215ad09e59f1722fd0c52bfe0a4e" + dependencies: + lodash._basecopy "^3.0.0" + lodash.keys "^3.0.0" + +lodash._basecopy@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36" + +lodash._basecreate@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz#1bc661614daa7fc311b7d03bf16806a0213cf821" + +lodash._getnative@^3.0.0: + version "3.9.1" + resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" + +lodash._isiterateecall@^3.0.0: + version "3.0.9" + resolved "https://registry.yarnpkg.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz#5203ad7ba425fae842460e696db9cf3e6aac057c" + +lodash.clonedeep@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" + +lodash.create@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/lodash.create/-/lodash.create-3.1.1.tgz#d7f2849f0dbda7e04682bb8cd72ab022461debe7" + dependencies: + lodash._baseassign "^3.0.0" + lodash._basecreate "^3.0.0" + lodash._isiterateecall "^3.0.0" + +lodash.isarguments@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" + +lodash.isarray@^3.0.0: + version "3.0.4" + resolved "https://registry.yarnpkg.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55" + +lodash.keys@^3.0.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a" + dependencies: + lodash._getnative "^3.0.0" + lodash.isarguments "^3.0.0" + lodash.isarray "^3.0.0" + +lodash@^4.17.4: + version "4.17.5" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" + +lodash@^4.2.0, lodash@^4.3.0: + version "4.17.4" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" + +loose-envify@^1.0.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" + dependencies: + js-tokens "^3.0.0" + +lru-cache@^4.0.1: + version "4.1.2" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.2.tgz#45234b2e6e2f2b33da125624c4664929a0224c3f" + dependencies: + pseudomap "^1.0.2" + yallist "^2.1.2" + +mimic-fn@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" + +minimatch@^3.0.2, minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + dependencies: + brace-expansion "^1.1.7" + +minimist@0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + +mkdirp@0.5.1, mkdirp@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + dependencies: + minimist "0.0.8" + +mocha@^3.0.0: + version "3.4.2" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-3.4.2.tgz#d0ef4d332126dbf18d0d640c9b382dd48be97594" + dependencies: + browser-stdout "1.3.0" + commander "2.9.0" + debug "2.6.0" + diff "3.2.0" + escape-string-regexp "1.0.5" + glob "7.1.1" + growl "1.9.2" + json3 "3.3.2" + lodash.create "3.1.1" + mkdirp "0.5.1" + supports-color "3.1.2" + +ms@0.7.2: + version "0.7.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.2.tgz#ae25cf2512b3885a1d95d7f037868d8431124765" + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + +mute-stream@0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + +object-assign@^4.0.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + +once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + dependencies: + wrappy "1" + +onetime@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" + dependencies: + mimic-fn "^1.0.0" + +optionator@^0.8.2: + version "0.8.2" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" + dependencies: + deep-is "~0.1.3" + fast-levenshtein "~2.0.4" + levn "~0.3.0" + prelude-ls "~1.1.2" + type-check "~0.3.2" + wordwrap "~1.0.0" + +os-tmpdir@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + +path-is-inside@^1.0.1, path-is-inside@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" + +pify@^2.0.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + +pinkie-promise@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" + dependencies: + pinkie "^2.0.0" + +pinkie@^2.0.0: + version "2.0.4" + resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" + +pluralize@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" + +prelude-ls@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" + +process-nextick-args@~1.0.6: + version "1.0.7" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" + +progress@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f" + +pseudomap@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + +readable-stream@^2.2.2: + version "2.3.0" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.0.tgz#640f5dcda88c91a8dc60787145629170813a1ed2" + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~1.0.6" + safe-buffer "~5.1.0" + string_decoder "~1.0.0" + util-deprecate "~1.0.1" + +regenerator-runtime@^0.10.0: + version "0.10.5" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz#336c3efc1220adcedda2c9fab67b5a7955a33658" + +regexpp@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-1.0.1.tgz#d857c3a741dce075c2848dcb019a0a975b190d43" + +require-uncached@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" + dependencies: + caller-path "^0.1.0" + resolve-from "^1.0.0" + +resolve-from@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" + +restore-cursor@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" + dependencies: + onetime "^2.0.0" + signal-exit "^3.0.2" + +rimraf@^2.2.8: + version "2.6.1" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d" + dependencies: + glob "^7.0.5" + +run-async@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" + dependencies: + is-promise "^2.1.0" + +rx-lite-aggregates@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz#753b87a89a11c95467c4ac1626c4efc4e05c67be" + dependencies: + rx-lite "*" + +rx-lite@*, rx-lite@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444" + +safe-buffer@~5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.0.1.tgz#d263ca54696cd8a306b5ca6551e92de57918fbe7" + +safe-buffer@~5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.0.tgz#fe4c8460397f9eaaaa58e73be46273408a45e223" + +semver@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" + +shebang-command@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + dependencies: + shebang-regex "^1.0.0" + +shebang-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + +signal-exit@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + +slice-ansi@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d" + dependencies: + is-fullwidth-code-point "^2.0.0" + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + +string-width@^2.1.0, string-width@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^4.0.0" + +string_decoder@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.2.tgz#b29e1f4e1125fa97a10382b8a533737b7491e179" + dependencies: + safe-buffer "~5.0.1" + +strip-ansi@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + dependencies: + ansi-regex "^2.0.0" + +strip-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + dependencies: + ansi-regex "^3.0.0" + +strip-json-comments@~2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + +supports-color@3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.1.2.tgz#72a262894d9d408b956ca05ff37b2ed8a6e2a2d5" + dependencies: + has-flag "^1.0.0" + +supports-color@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" + +supports-color@^5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.3.0.tgz#5b24ac15db80fa927cf5227a4a33fd3c4c7676c0" + dependencies: + has-flag "^3.0.0" + +table@4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/table/-/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36" + dependencies: + ajv "^5.2.3" + ajv-keywords "^2.1.0" + chalk "^2.1.0" + lodash "^4.17.4" + slice-ansi "1.0.0" + string-width "^2.1.1" + +text-table@~0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + +through@^2.3.6: + version "2.3.8" + resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + +tmp@^0.0.33: + version "0.0.33" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" + dependencies: + os-tmpdir "~1.0.2" + +to-fast-properties@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" + +tryit@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/tryit/-/tryit-1.0.3.tgz#393be730a9446fd1ead6da59a014308f36c289cb" + +type-check@~0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" + dependencies: + prelude-ls "~1.1.2" + +typedarray@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" + +util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + +which@^1.2.9: + version "1.3.0" + resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a" + dependencies: + isexe "^2.0.0" + +wordwrap@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + +write@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" + dependencies: + mkdirp "^0.5.1" + +yallist@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" From 2624190887fd6d1f8bf754aaa53a6c14cc98d10d Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Fri, 30 Mar 2018 09:09:23 -0500 Subject: [PATCH 529/569] Update deprecation table with versions --- eslint/babel-eslint-plugin/README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md index a9da5486713d..d2965cef58e5 100644 --- a/eslint/babel-eslint-plugin/README.md +++ b/eslint/babel-eslint-plugin/README.md @@ -48,10 +48,12 @@ Each rule corresponds to a core `eslint` rule, and has the same options. #### Deprecated -- `babel/generator-star-spacing`: Use [`generator-star-spacing`](http://eslint.org/docs/rules/generator-star-spacing). -- `babel/object-shorthand`: Use [`object-shorthand`](http://eslint.org/docs/rules/object-shorthand). -- `babel/arrow-parens`: Use [`arrow-parens`](http://eslint.org/docs/rules/arrow-parens). -- `babel/func-params-comma-dangle`: Use [`comma-dangle`](http://eslint.org/docs/rules/comma-dangle). -- `babel/array-bracket-spacing`: Use [`array-bracket-spacing`](http://eslint.org/docs/rules/array-bracket-spacing). -- `babel/flow-object-type`: Use [`flowtype/object-type-delimiter`](https://github.com/gajus/eslint-plugin-flowtype#eslint-plugin-flowtype-rules-object-type-delimiter). -- `babel/no-await-in-loop`: Use [`no-await-in-loop`](http://eslint.org/docs/rules/no-await-in-loop). +| Rule | Notes | +|:---------------------------------|:-----------------------------------| +| `babel/generator-star-spacing` | Use [`generator-star-spacing`](http://eslint.org/docs/rules/generator-star-spacing) since eslint@3.6.0 | +| `babel/object-shorthand` | Use [`object-shorthand`](http://eslint.org/docs/rules/object-shorthand) since eslint@0.20.0 | +| `babel/arrow-parens` | Use [`arrow-parens`](http://eslint.org/docs/rules/arrow-parens) since eslint@3.10.0 | +| `babel/func-params-comma-dangle` | Use [`comma-dangle`](http://eslint.org/docs/rules/comma-dangle) since eslint@3.8.0 | +| `babel/array-bracket-spacing` | Use [`array-bracket-spacing`](http://eslint.org/docs/rules/array-bracket-spacing) since eslint@3.9.0 | +| `babel/flow-object-type` | Use [`flowtype/object-type-delimiter`](https://github.com/gajus/eslint-plugin-flowtype#eslint-plugin-flowtype-rules-object-type-delimiter) since eslint-plugin-flowtype@2.23.0 | +| `babel/no-await-in-loop` | Use [`no-await-in-loop`](http://eslint.org/docs/rules/no-await-in-loop) since eslint@3.12.0 | From 550dcfc96a66e6ae824e78cda4c6309129d66ee1 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Fri, 30 Mar 2018 09:11:10 -0500 Subject: [PATCH 530/569] Merge pull request babel/eslint-plugin-babel#139 from babel/quotes-jsxfragment Add babel/quotes rule for JSXFragment workaround --- eslint/babel-eslint-plugin/README.md | 6 +- eslint/babel-eslint-plugin/package.json | 2 +- eslint/babel-eslint-plugin/rules/quotes.js | 18 + .../babel-eslint-plugin/tests/rules/quotes.js | 320 ++++++++++++++++++ eslint/babel-eslint-plugin/yarn.lock | 174 ++++++---- 5 files changed, 448 insertions(+), 72 deletions(-) create mode 100644 eslint/babel-eslint-plugin/rules/quotes.js create mode 100644 eslint/babel-eslint-plugin/tests/rules/quotes.js diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md index d2965cef58e5..3571f1923c6f 100644 --- a/eslint/babel-eslint-plugin/README.md +++ b/eslint/babel-eslint-plugin/README.md @@ -29,8 +29,9 @@ original ones as well!). { "rules": { "babel/new-cap": 1, - "babel/object-curly-spacing": 1, "babel/no-invalid-this": 1, + "babel/object-curly-spacing": 1, + "babel/quotes": 1, "babel/semi": 1 } } @@ -42,8 +43,9 @@ Each rule corresponds to a core `eslint` rule, and has the same options. 🛠: means it's autofixable with `--fix`. - `babel/new-cap`: Ignores capitalized decorators (`@Decorator`) -- `babel/object-curly-spacing`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` (🛠) - `babel/no-invalid-this`: doesn't fail when inside class properties (`class A { a = this.b; }`) +- `babel/object-curly-spacing`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` (🛠) +- `babel/quotes`: doesn't complain about JSX fragment shorthand syntax (`<>foo;`) - `babel/semi`: doesn't fail when using `for await (let something of {})`. Includes class properties (🛠) #### Deprecated diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index 8c0b36b7e1b7..bbdfa7bd9ed9 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -33,7 +33,7 @@ "eslint-rule-composer": "^0.1.1" }, "devDependencies": { - "babel-eslint": "^7.1.0", + "babel-eslint": "^8.2.2", "eslint": "^4.19.1", "lodash.clonedeep": "^4.5.0", "mocha": "^3.0.0" diff --git a/eslint/babel-eslint-plugin/rules/quotes.js b/eslint/babel-eslint-plugin/rules/quotes.js new file mode 100644 index 000000000000..41cd7da5a325 --- /dev/null +++ b/eslint/babel-eslint-plugin/rules/quotes.js @@ -0,0 +1,18 @@ +'use strict'; + +const ruleComposer = require('eslint-rule-composer'); +const eslint = require('eslint'); +const quotesRule = new eslint.Linter().getRules().get('quotes'); + +module.exports = ruleComposer.filterReports( + quotesRule, + (problem, metadata) => { + // Workaround for JSX fragment syntax until + // https://github.com/eslint/eslint/issues/9662 + if (problem.node.parent.type === "JSXFragment") { + return false; + } + + return true; + } +); diff --git a/eslint/babel-eslint-plugin/tests/rules/quotes.js b/eslint/babel-eslint-plugin/tests/rules/quotes.js new file mode 100644 index 000000000000..96b93e674a57 --- /dev/null +++ b/eslint/babel-eslint-plugin/tests/rules/quotes.js @@ -0,0 +1,320 @@ +var rule = require('../../rules/quotes'), + RuleTester = require('../RuleTester'); + +var ruleTester = new RuleTester(); +ruleTester.run('babel/quotes', rule, { + valid: [ + "var foo = \"bar\";", + { code: "var foo = 'bar';", options: ["single"] }, + { code: "var foo = \"bar\";", options: ["double"] }, + { code: "var foo = 1;", options: ["single"] }, + { code: "var foo = 1;", options: ["double"] }, + { code: "var foo = \"'\";", options: ["single", { avoidEscape: true }] }, + { code: "var foo = '\"';", options: ["double", { avoidEscape: true }] }, + { code: "var foo =
Hello world
;", options: ["single"], parserOptions: { ecmaVersion: 6, ecmaFeatures: { jsx: true } } }, + { code: "var foo =
;", options: ["single"], parserOptions: { ecmaVersion: 6, ecmaFeatures: { jsx: true } } }, + { code: "var foo =
Hello world
;", options: ["double"], parserOptions: { ecmaVersion: 6, ecmaFeatures: { jsx: true } } }, + { code: "var foo =
Hello world
;", options: ["double", { avoidEscape: true }], parserOptions: { ecmaVersion: 6, ecmaFeatures: { jsx: true } } }, + { code: "var foo = `bar`;", options: ["backtick"], parserOptions: { ecmaVersion: 6 } }, + { code: "var foo = `bar 'baz'`;", options: ["backtick"], parserOptions: { ecmaVersion: 6 } }, + { code: "var foo = `bar \"baz\"`;", options: ["backtick"], parserOptions: { ecmaVersion: 6 } }, + { code: "var foo = 1;", options: ["backtick"] }, + { code: "var foo = \"a string containing `backtick` quotes\";", options: ["backtick", { avoidEscape: true }] }, + { code: "var foo =
;", options: ["backtick"], parserOptions: { ecmaVersion: 6, ecmaFeatures: { jsx: true } } }, + { code: "var foo =
Hello world
;", options: ["backtick"], parserOptions: { ecmaVersion: 6, ecmaFeatures: { jsx: true } } }, + + // Backticks are only okay if they have substitutions, contain a line break, or are tagged + { code: "var foo = `back\ntick`;", options: ["single"], parserOptions: { ecmaVersion: 6 } }, + { code: "var foo = `back\rtick`;", options: ["single"], parserOptions: { ecmaVersion: 6 } }, + { code: "var foo = `back\u2028tick`;", options: ["single"], parserOptions: { ecmaVersion: 6 } }, + { code: "var foo = `back\u2029tick`;", options: ["single"], parserOptions: { ecmaVersion: 6 } }, + { + code: "var foo = `back\\\\\ntick`;", // 2 backslashes followed by a newline + options: ["single"], + parserOptions: { ecmaVersion: 6 } + }, + { code: "var foo = `back\\\\\\\\\ntick`;", options: ["single"], parserOptions: { ecmaVersion: 6 } }, + { code: "var foo = `\n`;", options: ["single"], parserOptions: { ecmaVersion: 6 } }, + { code: "var foo = `back${x}tick`;", options: ["double"], parserOptions: { ecmaVersion: 6 } }, + { code: "var foo = tag`backtick`;", options: ["double"], parserOptions: { ecmaVersion: 6 } }, + + // Backticks are also okay if allowTemplateLiterals + { code: "var foo = `bar 'foo' baz` + 'bar';", options: ["single", { allowTemplateLiterals: true }], parserOptions: { ecmaVersion: 6 } }, + { code: "var foo = `bar 'foo' baz` + \"bar\";", options: ["double", { allowTemplateLiterals: true }], parserOptions: { ecmaVersion: 6 } }, + { code: "var foo = `bar 'foo' baz` + `bar`;", options: ["backtick", { allowTemplateLiterals: true }], parserOptions: { ecmaVersion: 6 } }, + + // `backtick` should not warn the directive prologues. + { code: "\"use strict\"; var foo = `backtick`;", options: ["backtick"], parserOptions: { ecmaVersion: 6 } }, + { code: "\"use strict\"; 'use strong'; \"use asm\"; var foo = `backtick`;", options: ["backtick"], parserOptions: { ecmaVersion: 6 } }, + { code: "function foo() { \"use strict\"; \"use strong\"; \"use asm\"; var foo = `backtick`; }", options: ["backtick"], parserOptions: { ecmaVersion: 6 } }, + { code: "(function() { 'use strict'; 'use strong'; 'use asm'; var foo = `backtick`; })();", options: ["backtick"], parserOptions: { ecmaVersion: 6 } }, + { code: "(() => { \"use strict\"; \"use strong\"; \"use asm\"; var foo = `backtick`; })();", options: ["backtick"], parserOptions: { ecmaVersion: 6 } }, + + // `backtick` should not warn import/export sources. + { code: "import \"a\"; import 'b';", options: ["backtick"], parserOptions: { sourceType: "module" } }, + { code: "import a from \"a\"; import b from 'b';", options: ["backtick"], parserOptions: { sourceType: "module" } }, + { code: "export * from \"a\"; export * from 'b';", options: ["backtick"], parserOptions: { sourceType: "module" } }, + + // `backtick` should not warn property/method names (not computed). + { code: "var obj = {\"key0\": 0, 'key1': 1};", options: ["backtick"], parserOptions: { ecmaVersion: 6 } }, + { code: "class Foo { 'bar'(){} }", options: ["backtick"], parserOptions: { ecmaVersion: 6 } }, + { code: "class Foo { static ''(){} }", options: ["backtick"], parserOptions: { ecmaVersion: 6 } }, + + // Babel + '<>foo;', + { code: '<>foo;', options: ['single'] }, + { code: '<>foo;', options: ['double'] }, + '<>
;', + { code: '<>
;', options: ['single'] }, + { code: '<>
;', options: ['double'] }, + ], + invalid: [ + { + code: "var foo = 'bar';", + output: "var foo = \"bar\";", + errors: [{ message: "Strings must use doublequote.", type: "Literal" }] + }, + { + code: "var foo = \"bar\";", + output: "var foo = 'bar';", + options: ["single"], + errors: [{ message: "Strings must use singlequote.", type: "Literal" }] + }, + { + code: "var foo = `bar`;", + output: "var foo = 'bar';", + options: ["single"], + parserOptions: { + ecmaVersion: 6 + }, + errors: [{ message: "Strings must use singlequote.", type: "TemplateLiteral" }] + }, + { + code: "var foo = 'don\\'t';", + output: "var foo = \"don't\";", + errors: [{ message: "Strings must use doublequote.", type: "Literal" }] + }, + { + code: "var msg = \"Plugin '\" + name + \"' not found\"", + output: "var msg = 'Plugin \\'' + name + '\\' not found'", + options: ["single"], + errors: [ + { message: "Strings must use singlequote.", type: "Literal", column: 11 }, + { message: "Strings must use singlequote.", type: "Literal", column: 31 } + ] + }, + { + code: "var foo = 'bar';", + output: "var foo = \"bar\";", + options: ["double"], + errors: [{ message: "Strings must use doublequote.", type: "Literal" }] + }, + { + code: "var foo = `bar`;", + output: "var foo = \"bar\";", + options: ["double"], + parserOptions: { + ecmaVersion: 6 + }, + errors: [{ message: "Strings must use doublequote.", type: "TemplateLiteral" }] + }, + { + code: "var foo = \"bar\";", + output: "var foo = 'bar';", + options: ["single", { avoidEscape: true }], + errors: [{ message: "Strings must use singlequote.", type: "Literal" }] + }, + { + code: "var foo = 'bar';", + output: "var foo = \"bar\";", + options: ["double", { avoidEscape: true }], + errors: [{ message: "Strings must use doublequote.", type: "Literal" }] + }, + { + code: "var foo = '\\\\';", + output: "var foo = \"\\\\\";", + options: ["double", { avoidEscape: true }], + errors: [{ message: "Strings must use doublequote.", type: "Literal" }] + }, + { + code: "var foo = \"bar\";", + output: "var foo = 'bar';", + options: ["single", { allowTemplateLiterals: true }], + errors: [{ message: "Strings must use singlequote.", type: "Literal" }] + }, + { + code: "var foo = 'bar';", + output: "var foo = \"bar\";", + options: ["double", { allowTemplateLiterals: true }], + errors: [{ message: "Strings must use doublequote.", type: "Literal" }] + }, + { + code: "var foo = 'bar';", + output: "var foo = `bar`;", + options: ["backtick"], + errors: [{ message: "Strings must use backtick.", type: "Literal" }] + }, + { + code: "var foo = 'b${x}a$r';", + output: "var foo = `b\\${x}a$r`;", + options: ["backtick"], + errors: [{ message: "Strings must use backtick.", type: "Literal" }] + }, + { + code: "var foo = \"bar\";", + output: "var foo = `bar`;", + options: ["backtick"], + errors: [{ message: "Strings must use backtick.", type: "Literal" }] + }, + { + code: "var foo = \"bar\";", + output: "var foo = `bar`;", + options: ["backtick", { avoidEscape: true }], + errors: [{ message: "Strings must use backtick.", type: "Literal" }] + }, + { + code: "var foo = 'bar';", + output: "var foo = `bar`;", + options: ["backtick", { avoidEscape: true }], + errors: [{ message: "Strings must use backtick.", type: "Literal" }] + }, + + // "use strict" is *not* a directive prologue in these statements so is subject to the rule + { + code: "var foo = `backtick`; \"use strict\";", + output: "var foo = `backtick`; `use strict`;", + options: ["backtick"], + parserOptions: { ecmaVersion: 6 }, + errors: [{ message: "Strings must use backtick.", type: "Literal" }] + }, + { + code: "{ \"use strict\"; var foo = `backtick`; }", + output: "{ `use strict`; var foo = `backtick`; }", + options: ["backtick"], + parserOptions: { ecmaVersion: 6 }, + errors: [{ message: "Strings must use backtick.", type: "Literal" }] + }, + { + code: "if (1) { \"use strict\"; var foo = `backtick`; }", + output: "if (1) { `use strict`; var foo = `backtick`; }", + options: ["backtick"], + parserOptions: { ecmaVersion: 6 }, + errors: [{ message: "Strings must use backtick.", type: "Literal" }] + }, + + // `backtick` should warn computed property names. + { + code: "var obj = {[\"key0\"]: 0, ['key1']: 1};", + output: "var obj = {[`key0`]: 0, [`key1`]: 1};", + options: ["backtick"], + parserOptions: { ecmaVersion: 6 }, + errors: [ + { message: "Strings must use backtick.", type: "Literal" }, + { message: "Strings must use backtick.", type: "Literal" } + ] + }, + { + code: "class Foo { ['a'](){} static ['b'](){} }", + output: "class Foo { [`a`](){} static [`b`](){} }", + options: ["backtick"], + parserOptions: { ecmaVersion: 6 }, + errors: [ + { message: "Strings must use backtick.", type: "Literal" }, + { message: "Strings must use backtick.", type: "Literal" } + ] + }, + + // https://github.com/eslint/eslint/issues/7084 + { + code: "
", + output: "
", + options: ["single"], + parserOptions: { ecmaFeatures: { jsx: true } }, + errors: [ + { message: "Strings must use singlequote.", type: "Literal" } + ] + }, + { + code: "
", + output: "
", + options: ["double"], + parserOptions: { ecmaFeatures: { jsx: true } }, + errors: [ + { message: "Strings must use doublequote.", type: "Literal" } + ] + }, + { + code: "
", + output: "
", + options: ["backtick"], + parserOptions: { ecmaFeatures: { jsx: true } }, + errors: [ + { message: "Strings must use backtick.", type: "Literal" } + ] + }, + + // https://github.com/eslint/eslint/issues/7610 + { + code: "`use strict`;", + output: null, + parserOptions: { ecmaVersion: 6 }, + errors: [{ message: "Strings must use doublequote.", type: "TemplateLiteral" }] + }, + { + code: "function foo() { `use strict`; foo(); }", + output: null, + parserOptions: { ecmaVersion: 6 }, + errors: [{ message: "Strings must use doublequote.", type: "TemplateLiteral" }] + }, + { + code: "foo = function() { `use strict`; foo(); }", + output: null, + parserOptions: { ecmaVersion: 6 }, + errors: [{ message: "Strings must use doublequote.", type: "TemplateLiteral" }] + }, + { + code: "() => { `use strict`; foo(); }", + output: null, + parserOptions: { ecmaVersion: 6 }, + errors: [{ message: "Strings must use doublequote.", type: "TemplateLiteral" }] + }, + { + code: "() => { foo(); `use strict`; }", + output: "() => { foo(); \"use strict\"; }", + parserOptions: { ecmaVersion: 6 }, + errors: [{ message: "Strings must use doublequote.", type: "TemplateLiteral" }] + }, + { + code: "foo(); `use strict`;", + output: "foo(); \"use strict\";", + parserOptions: { ecmaVersion: 6 }, + errors: [{ message: "Strings must use doublequote.", type: "TemplateLiteral" }] + }, + + // https://github.com/eslint/eslint/issues/7646 + { + code: "var foo = `foo\\nbar`;", + output: "var foo = \"foo\\nbar\";", + parserOptions: { ecmaVersion: 6 }, + errors: [{ message: "Strings must use doublequote.", type: "TemplateLiteral" }] + }, + { + code: "var foo = `foo\\\nbar`;", // 1 backslash followed by a newline + output: "var foo = \"foo\\\nbar\";", + parserOptions: { ecmaVersion: 6 }, + errors: [{ message: "Strings must use doublequote.", type: "TemplateLiteral" }] + }, + { + code: "var foo = `foo\\\\\\\nbar`;", // 3 backslashes followed by a newline + output: "var foo = \"foo\\\\\\\nbar\";", + parserOptions: { ecmaVersion: 6 }, + errors: [{ message: "Strings must use doublequote.", type: "TemplateLiteral" }] + }, + { + code: "````", + output: "\"\"``", + parserOptions: { ecmaVersion: 6 }, + errors: [{ message: "Strings must use doublequote.", type: "TemplateLiteral", line: 1, column: 1 }] + } + ], +}); diff --git a/eslint/babel-eslint-plugin/yarn.lock b/eslint/babel-eslint-plugin/yarn.lock index b7e874dfa9d9..dab1b2ffb796 100644 --- a/eslint/babel-eslint-plugin/yarn.lock +++ b/eslint/babel-eslint-plugin/yarn.lock @@ -2,6 +2,82 @@ # yarn lockfile v1 +"@babel/code-frame@7.0.0-beta.42", "@babel/code-frame@^7.0.0-beta.40": + version "7.0.0-beta.42" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.42.tgz#a9c83233fa7cd06b39dc77adbb908616ff4f1962" + dependencies: + "@babel/highlight" "7.0.0-beta.42" + +"@babel/generator@7.0.0-beta.42": + version "7.0.0-beta.42" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0-beta.42.tgz#777bb50f39c94a7e57f73202d833141f8159af33" + dependencies: + "@babel/types" "7.0.0-beta.42" + jsesc "^2.5.1" + lodash "^4.2.0" + source-map "^0.5.0" + trim-right "^1.0.1" + +"@babel/helper-function-name@7.0.0-beta.42": + version "7.0.0-beta.42" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.42.tgz#b38b8f4f85168d1812c543dd700b5d549b0c4658" + dependencies: + "@babel/helper-get-function-arity" "7.0.0-beta.42" + "@babel/template" "7.0.0-beta.42" + "@babel/types" "7.0.0-beta.42" + +"@babel/helper-get-function-arity@7.0.0-beta.42": + version "7.0.0-beta.42" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.42.tgz#ad072e32f912c033053fc80478169aeadc22191e" + dependencies: + "@babel/types" "7.0.0-beta.42" + +"@babel/helper-split-export-declaration@7.0.0-beta.42": + version "7.0.0-beta.42" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.42.tgz#0d0d5254220a9cc4e7e226240306b939dc210ee7" + dependencies: + "@babel/types" "7.0.0-beta.42" + +"@babel/highlight@7.0.0-beta.42": + version "7.0.0-beta.42" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-beta.42.tgz#a502a1c0d6f99b2b0e81d468a1b0c0e81e3f3623" + dependencies: + chalk "^2.0.0" + esutils "^2.0.2" + js-tokens "^3.0.0" + +"@babel/template@7.0.0-beta.42": + version "7.0.0-beta.42" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.42.tgz#7186d4e70d44cdec975049ba0a73bdaf5cdee052" + dependencies: + "@babel/code-frame" "7.0.0-beta.42" + "@babel/types" "7.0.0-beta.42" + babylon "7.0.0-beta.42" + lodash "^4.2.0" + +"@babel/traverse@^7.0.0-beta.40": + version "7.0.0-beta.42" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.42.tgz#f4bf4d1e33d41baf45205e2d0463591d57326285" + dependencies: + "@babel/code-frame" "7.0.0-beta.42" + "@babel/generator" "7.0.0-beta.42" + "@babel/helper-function-name" "7.0.0-beta.42" + "@babel/helper-split-export-declaration" "7.0.0-beta.42" + "@babel/types" "7.0.0-beta.42" + babylon "7.0.0-beta.42" + debug "^3.1.0" + globals "^11.1.0" + invariant "^2.2.0" + lodash "^4.2.0" + +"@babel/types@7.0.0-beta.42", "@babel/types@^7.0.0-beta.40": + version "7.0.0-beta.42" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.42.tgz#1e2118767684880f6963801b272fd2b3348efacc" + dependencies: + esutils "^2.0.2" + lodash "^4.2.0" + to-fast-properties "^2.0.0" + acorn-jsx@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" @@ -79,54 +155,20 @@ babel-code-frame@^6.22.0: esutils "^2.0.2" js-tokens "^3.0.0" -babel-eslint@^7.1.0: - version "7.2.3" - resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-7.2.3.tgz#b2fe2d80126470f5c19442dc757253a897710827" +babel-eslint@^8.2.2: + version "8.2.2" + resolved "http://registry.npmjs.org/babel-eslint/-/babel-eslint-8.2.2.tgz#1102273354c6f0b29b4ea28a65f97d122296b68b" dependencies: - babel-code-frame "^6.22.0" - babel-traverse "^6.23.1" - babel-types "^6.23.0" - babylon "^6.17.0" - -babel-messages@^6.23.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" - dependencies: - babel-runtime "^6.22.0" - -babel-runtime@^6.22.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.23.0.tgz#0a9489f144de70efb3ce4300accdb329e2fc543b" - dependencies: - core-js "^2.4.0" - regenerator-runtime "^0.10.0" - -babel-traverse@^6.23.1: - version "6.25.0" - resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.25.0.tgz#2257497e2fcd19b89edc13c4c91381f9512496f1" - dependencies: - babel-code-frame "^6.22.0" - babel-messages "^6.23.0" - babel-runtime "^6.22.0" - babel-types "^6.25.0" - babylon "^6.17.2" - debug "^2.2.0" - globals "^9.0.0" - invariant "^2.2.0" - lodash "^4.2.0" - -babel-types@^6.23.0, babel-types@^6.25.0: - version "6.25.0" - resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.25.0.tgz#70afb248d5660e5d18f811d91c8303b54134a18e" - dependencies: - babel-runtime "^6.22.0" - esutils "^2.0.2" - lodash "^4.2.0" - to-fast-properties "^1.0.1" + "@babel/code-frame" "^7.0.0-beta.40" + "@babel/traverse" "^7.0.0-beta.40" + "@babel/types" "^7.0.0-beta.40" + babylon "^7.0.0-beta.40" + eslint-scope "~3.7.1" + eslint-visitor-keys "^1.0.0" -babylon@^6.17.0, babylon@^6.17.2: - version "6.17.4" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.17.4.tgz#3e8b7402b88d22c3423e137a1577883b15ff869a" +babylon@7.0.0-beta.42, babylon@^7.0.0-beta.40: + version "7.0.0-beta.42" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.42.tgz#67cfabcd4f3ec82999d29031ccdea89d0ba99657" balanced-match@^1.0.0: version "1.0.0" @@ -226,10 +268,6 @@ concat-stream@^1.6.0: readable-stream "^2.2.2" typedarray "^0.0.6" -core-js@^2.4.0: - version "2.4.1" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.4.1.tgz#4de911e667b0eae9124e34254b53aea6fc618d3e" - core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" @@ -248,12 +286,6 @@ debug@2.6.0: dependencies: ms "0.7.2" -debug@^2.2.0: - version "2.6.8" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc" - dependencies: - ms "2.0.0" - debug@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" @@ -294,7 +326,7 @@ eslint-rule-composer@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/eslint-rule-composer/-/eslint-rule-composer-0.1.1.tgz#479dfd4e93d7f2777499a35ce9be76403c8e982a" -eslint-scope@^3.7.1: +eslint-scope@^3.7.1, eslint-scope@~3.7.1: version "3.7.1" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" dependencies: @@ -452,14 +484,10 @@ glob@^7.0.3, glob@^7.0.5, glob@^7.1.2: once "^1.3.0" path-is-absolute "^1.0.0" -globals@^11.0.1: +globals@^11.0.1, globals@^11.1.0: version "11.4.0" resolved "https://registry.yarnpkg.com/globals/-/globals-11.4.0.tgz#b85c793349561c16076a3c13549238a27945f1bc" -globals@^9.0.0: - version "9.18.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" - globby@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d" @@ -594,6 +622,10 @@ js-yaml@^3.9.1: argparse "^1.0.7" esprima "^4.0.0" +jsesc@^2.5.1: + version "2.5.1" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.1.tgz#e421a2a8e20d6b0819df28908f782526b96dd1fe" + json-schema-traverse@^0.3.0: version "0.3.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" @@ -822,10 +854,6 @@ readable-stream@^2.2.2: string_decoder "~1.0.0" util-deprecate "~1.0.1" -regenerator-runtime@^0.10.0: - version "0.10.5" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz#336c3efc1220adcedda2c9fab67b5a7955a33658" - regexpp@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-1.0.1.tgz#d857c3a741dce075c2848dcb019a0a975b190d43" @@ -902,6 +930,10 @@ slice-ansi@1.0.0: dependencies: is-fullwidth-code-point "^2.0.0" +source-map@^0.5.0: + version "0.5.7" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" @@ -976,9 +1008,13 @@ tmp@^0.0.33: dependencies: os-tmpdir "~1.0.2" -to-fast-properties@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" +to-fast-properties@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + +trim-right@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" tryit@^1.0.1: version "1.0.3" From 8e49bbbb091b53c31b82a72a8d68cc33cd92ac34 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Fri, 30 Mar 2018 09:28:48 -0500 Subject: [PATCH 531/569] Add quotes rule to index --- eslint/babel-eslint-plugin/index.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/eslint/babel-eslint-plugin/index.js b/eslint/babel-eslint-plugin/index.js index ffc2cf994a93..98fcdc137627 100644 --- a/eslint/babel-eslint-plugin/index.js +++ b/eslint/babel-eslint-plugin/index.js @@ -2,16 +2,17 @@ module.exports = { rules: { - 'generator-star-spacing': require('./rules/generator-star-spacing'), - 'new-cap': require('./rules/new-cap'), - 'object-curly-spacing': require('./rules/object-curly-spacing'), 'array-bracket-spacing': require('./rules/array-bracket-spacing'), - 'object-shorthand': require('./rules/object-shorthand'), 'arrow-parens': require('./rules/arrow-parens'), - 'no-await-in-loop': require('./rules/no-await-in-loop'), 'flow-object-type': require('./rules/flow-object-type'), 'func-params-comma-dangle': require('./rules/func-params-comma-dangle'), + 'generator-star-spacing': require('./rules/generator-star-spacing'), + 'new-cap': require('./rules/new-cap'), + 'no-await-in-loop': require('./rules/no-await-in-loop'), 'no-invalid-this': require('./rules/no-invalid-this'), + 'object-curly-spacing': require('./rules/object-curly-spacing'), + 'object-shorthand': require('./rules/object-shorthand'), + 'quotes': require('./rules/quotes'), 'semi': require('./rules/semi'), }, rulesConfig: { @@ -25,6 +26,7 @@ module.exports = { 'flow-object-type': 0, 'func-params-comma-dangle': 0, 'no-invalid-this': 0, + 'quotes': 0, 'semi': 0, } }; From 1037e37418b28b68e2f5a27d978ddac357cd0573 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 31 Mar 2018 08:42:29 -0400 Subject: [PATCH 532/569] 5.0.0 --- eslint/babel-eslint-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index bbdfa7bd9ed9..4c5b50cbe43a 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-babel", - "version": "4.1.2", + "version": "5.0.0", "description": "an eslint rule plugin companion to babel-eslint", "main": "index.js", "scripts": { From bc15f0627d0f5a2e6a37f74b70f6f43934d0997a Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Wed, 18 Apr 2018 20:25:42 -0500 Subject: [PATCH 533/569] Merge pull request babel/eslint-plugin-babel#131 from lyleunderwood/do-expressions add no-unused-expressions with do expressions support --- eslint/babel-eslint-plugin/README.md | 4 +- eslint/babel-eslint-plugin/index.js | 2 + .../rules/no-unused-expressions.js | 49 ++++++ .../tests/rules/no-unused-expressions.js | 143 ++++++++++++++++++ 4 files changed, 197 insertions(+), 1 deletion(-) create mode 100644 eslint/babel-eslint-plugin/rules/no-unused-expressions.js create mode 100644 eslint/babel-eslint-plugin/tests/rules/no-unused-expressions.js diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md index 3571f1923c6f..70f6f833a505 100644 --- a/eslint/babel-eslint-plugin/README.md +++ b/eslint/babel-eslint-plugin/README.md @@ -32,7 +32,8 @@ original ones as well!). "babel/no-invalid-this": 1, "babel/object-curly-spacing": 1, "babel/quotes": 1, - "babel/semi": 1 + "babel/semi": 1, + "babel/no-unused-expressions": 1 } } ``` @@ -47,6 +48,7 @@ Each rule corresponds to a core `eslint` rule, and has the same options. - `babel/object-curly-spacing`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` (🛠) - `babel/quotes`: doesn't complain about JSX fragment shorthand syntax (`<>foo;`) - `babel/semi`: doesn't fail when using `for await (let something of {})`. Includes class properties (🛠) +- `babel/no-unused-expressions`: doesn't fail when using `do` expressions #### Deprecated diff --git a/eslint/babel-eslint-plugin/index.js b/eslint/babel-eslint-plugin/index.js index 98fcdc137627..39962b9f75e3 100644 --- a/eslint/babel-eslint-plugin/index.js +++ b/eslint/babel-eslint-plugin/index.js @@ -14,6 +14,7 @@ module.exports = { 'object-shorthand': require('./rules/object-shorthand'), 'quotes': require('./rules/quotes'), 'semi': require('./rules/semi'), + 'no-unused-expressions': require('./rules/no-unused-expressions'), }, rulesConfig: { 'generator-star-spacing': 0, @@ -28,5 +29,6 @@ module.exports = { 'no-invalid-this': 0, 'quotes': 0, 'semi': 0, + 'no-unused-expressions': 0, } }; diff --git a/eslint/babel-eslint-plugin/rules/no-unused-expressions.js b/eslint/babel-eslint-plugin/rules/no-unused-expressions.js new file mode 100644 index 000000000000..94628cb32a34 --- /dev/null +++ b/eslint/babel-eslint-plugin/rules/no-unused-expressions.js @@ -0,0 +1,49 @@ +"use strict"; + +const ruleComposer = require('eslint-rule-composer'); +const eslint = require('eslint'); +const rule = new eslint.Linter().getRules().get('no-unused-expressions'); + +/** + * @param {ASTNode} node - any node + * @returns {boolean} whether the given node is either an IfStatement or an + * ExpressionStatement and is the last node in the body of a BlockStatement + */ +function isFinalStatementInBlockStatement(node) { + const parent = node.parent; + return /^(?:If|Expression)Statement$/.test(node.type) && + parent.type === 'BlockStatement' && + parent.body[parent.body.length - 1] === node; +} + +/** + * @param {ASTNode} node - any node + * @returns {boolean} whether the given node represents an unbroken chain of + * tail ExpressionStatements and IfStatements within a DoExpression + */ +function isInDoStatement(node) { + if (!node) return false; + + if (node.type === 'DoExpression') return true; + + // this is an `else if` + if ( + node.type === 'IfStatement' && + node.parent && + node.parent.type === 'IfStatement' + ) { + return isInDoStatement(node.parent); + } + + if (isFinalStatementInBlockStatement(node)) { + return isInDoStatement(node.parent.parent); + } + + return false; +} + +module.exports = ruleComposer.filterReports( + rule, + (problem, metadata) => !isInDoStatement(problem.node) +); + diff --git a/eslint/babel-eslint-plugin/tests/rules/no-unused-expressions.js b/eslint/babel-eslint-plugin/tests/rules/no-unused-expressions.js new file mode 100644 index 000000000000..a8156ec174f7 --- /dev/null +++ b/eslint/babel-eslint-plugin/tests/rules/no-unused-expressions.js @@ -0,0 +1,143 @@ +/** + * @fileoverview Tests for no-unused-expressions rule. + * @author Michael Ficarra + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const rule = require("../../rules/no-unused-expressions"), + RuleTester = require("../RuleTester"); + +//------------------------------------------------------------------------------ +// Tests +//------------------------------------------------------------------------------ + +const ruleTester = new RuleTester(); + +ruleTester.run("no-unused-expressions", rule, { + valid: [ + // Original test cases. + "function f(){}", + "a = b", + "new a", + "{}", + "f(); g()", + "i++", + "a()", + { code: "a && a()", options: [{ allowShortCircuit: true }] }, + { code: "a() || (b = c)", options: [{ allowShortCircuit: true }] }, + { code: "a ? b() : c()", options: [{ allowTernary: true }] }, + { code: "a ? b() || (c = d) : e()", options: [{ allowShortCircuit: true, allowTernary: true }] }, + "delete foo.bar", + "void new C", + "\"use strict\";", + "\"directive one\"; \"directive two\"; f();", + "function foo() {\"use strict\"; return true; }", + { code: "var foo = () => {\"use strict\"; return true; }", parserOptions: { ecmaVersion: 6 } }, + "function foo() {\"directive one\"; \"directive two\"; f(); }", + "function foo() { var foo = \"use strict\"; return true; }", + { + code: "function* foo(){ yield 0; }", + parserOptions: { ecmaVersion: 6 } + }, + { + code: "async function foo() { await 5; }", + parserOptions: { ecmaVersion: 8 } + }, + { + code: "async function foo() { await foo.bar; }", + parserOptions: { ecmaVersion: 8 } + }, + { + code: "async function foo() { bar && await baz; }", + options: [{ allowShortCircuit: true }], + parserOptions: { ecmaVersion: 8 } + }, + { + code: "async function foo() { foo ? await bar : await baz; }", + options: [{ allowTernary: true }], + parserOptions: { ecmaVersion: 8 } + }, + { + code: "tag`tagged template literal`", + options: [{ allowTaggedTemplates: true }], + parserOptions: { ecmaVersion: 6 } + }, + { + code: "shouldNotBeAffectedByAllowTemplateTagsOption()", + options: [{ allowTaggedTemplates: true }], + parserOptions: { ecmaVersion: 6 } + }, + + // Babel-specific test cases. + "let a = do { if (foo) { foo.bar } }", + "let a = do { foo }", + "let a = do { let b = 2; foo; }", + "let a = do { (foo + 1) }", + "let a = do { if (foo) { if (foo.bar) { foo.bar } } }", + "let a = do { if (foo) { if (foo.bar) { foo.bar } else if (foo.baz) { foo.baz } } }", + + ], + invalid: [ + { code: "0", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] }, + { code: "a", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] }, + { code: "f(), 0", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] }, + { code: "{0}", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] }, + { code: "[]", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] }, + { code: "a && b();", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] }, + { code: "a() || false", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] }, + { code: "a || (b = c)", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] }, + { code: "a ? b() || (c = d) : e", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] }, + { + code: "`untagged template literal`", + parserOptions: { ecmaVersion: 6 }, + errors: ["Expected an assignment or function call and instead saw an expression."] + }, + { + code: "tag`tagged template literal`", + parserOptions: { ecmaVersion: 6 }, + errors: ["Expected an assignment or function call and instead saw an expression."] + }, + { code: "a && b()", options: [{ allowTernary: true }], errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] }, + { code: "a ? b() : c()", options: [{ allowShortCircuit: true }], errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] }, + { code: "a || b", options: [{ allowShortCircuit: true }], errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] }, + { code: "a() && b", options: [{ allowShortCircuit: true }], errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] }, + { code: "a ? b : 0", options: [{ allowTernary: true }], errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] }, + { code: "a ? b : c()", options: [{ allowTernary: true }], errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] }, + { code: "foo.bar;", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] }, + { code: "!a", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] }, + { code: "+a", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] }, + { code: "\"directive one\"; f(); \"directive two\";", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] }, + { code: "function foo() {\"directive one\"; f(); \"directive two\"; }", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] }, + { code: "if (0) { \"not a directive\"; f(); }", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] }, + { code: "function foo() { var foo = true; \"use strict\"; }", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] }, + { code: "var foo = () => { var foo = true; \"use strict\"; }", parserOptions: { ecmaVersion: 6 }, errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] }, + { + code: "`untagged template literal`", + options: [{ allowTaggedTemplates: true }], + parserOptions: { ecmaVersion: 6 }, + errors: ["Expected an assignment or function call and instead saw an expression."] + }, + { + code: "`untagged template literal`", + options: [{ allowTaggedTemplates: false }], + parserOptions: { ecmaVersion: 6 }, + errors: ["Expected an assignment or function call and instead saw an expression."] + }, + { + code: "tag`tagged template literal`", + options: [{ allowTaggedTemplates: false }], + parserOptions: { ecmaVersion: 6 }, + errors: ["Expected an assignment or function call and instead saw an expression."] + }, + + // Babel-specific test cases. + { code: "let a = do { foo; let b = 2; }", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] }, + { code: "let a = do { if (foo) { foo.bar } else { a; bar.foo } }", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] }, + + ] +}); From 5b5d9a5decac4cb5c30d8435f576e9eafd9520d1 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Wed, 18 Apr 2018 20:29:53 -0500 Subject: [PATCH 534/569] eslint-rule-composer@0.3.0 --- eslint/babel-eslint-plugin/package.json | 2 +- eslint/babel-eslint-plugin/yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index 4c5b50cbe43a..796d7a629c74 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -30,7 +30,7 @@ "eslint": ">=4.0.0" }, "dependencies": { - "eslint-rule-composer": "^0.1.1" + "eslint-rule-composer": "^0.3.0" }, "devDependencies": { "babel-eslint": "^8.2.2", diff --git a/eslint/babel-eslint-plugin/yarn.lock b/eslint/babel-eslint-plugin/yarn.lock index dab1b2ffb796..038c6659b6b9 100644 --- a/eslint/babel-eslint-plugin/yarn.lock +++ b/eslint/babel-eslint-plugin/yarn.lock @@ -322,9 +322,9 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1 version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" -eslint-rule-composer@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/eslint-rule-composer/-/eslint-rule-composer-0.1.1.tgz#479dfd4e93d7f2777499a35ce9be76403c8e982a" +eslint-rule-composer@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz#79320c927b0c5c0d3d3d2b76c8b4a488f25bbaf9" eslint-scope@^3.7.1, eslint-scope@~3.7.1: version "3.7.1" From ae68b5bf24772c1747afb73ee8baa1d90b762ef1 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Wed, 18 Apr 2018 20:33:36 -0500 Subject: [PATCH 535/569] Refresh new-cap tests --- .../tests/rules/new-cap.js | 56 +++++++++++++------ 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/eslint/babel-eslint-plugin/tests/rules/new-cap.js b/eslint/babel-eslint-plugin/tests/rules/new-cap.js index 5fe53cbe3996..d03adde0713a 100644 --- a/eslint/babel-eslint-plugin/tests/rules/new-cap.js +++ b/eslint/babel-eslint-plugin/tests/rules/new-cap.js @@ -37,36 +37,46 @@ ruleTester.run('babel/new-cap', rule, { "var x = Symbol('symbol')", "var x = _();", "var x = $();", - { code: "var x = Foo(42)", options: [{"capIsNew": false}] }, - { code: "var x = bar.Foo(42)", options: [{"capIsNew": false}] }, + { code: "var x = Foo(42)", options: [{ capIsNew: false }] }, + { code: "var x = bar.Foo(42)", options: [{ capIsNew: false }] }, + { code: "var x = Foo.bar(42)", options: [{ capIsNew: false }] }, "var x = bar[Foo](42)", - {code: "var x = bar['Foo'](42)", options: [{"capIsNew": false}] }, + { code: "var x = bar['Foo'](42)", options: [{ capIsNew: false }] }, "var x = Foo.bar(42)", - { code: "var x = new foo(42)", options: [{"newIsCap": false}] }, + { code: "var x = new foo(42)", options: [{ newIsCap: false }] }, "var o = { 1: function() {} }; o[1]();", "var o = { 1: function() {} }; new o[1]();", { code: "var x = Foo(42);", options: [{ capIsNew: true, capIsNewExceptions: ["Foo"] }] }, + { code: "var x = Foo(42);", options: [{ capIsNewExceptionPattern: "^Foo" }] }, { code: "var x = new foo(42);", options: [{ newIsCap: true, newIsCapExceptions: ["foo"] }] }, + { code: "var x = new foo(42);", options: [{ newIsCapExceptionPattern: "^foo" }] }, { code: "var x = Object(42);", options: [{ capIsNewExceptions: ["Foo"] }] }, { code: "var x = Foo.Bar(42);", options: [{ capIsNewExceptions: ["Bar"] }] }, { code: "var x = Foo.Bar(42);", options: [{ capIsNewExceptions: ["Foo.Bar"] }] }, + + { code: "var x = Foo.Bar(42);", options: [{ capIsNewExceptionPattern: "^Foo\\.." }] }, { code: "var x = new foo.bar(42);", options: [{ newIsCapExceptions: ["bar"] }] }, { code: "var x = new foo.bar(42);", options: [{ newIsCapExceptions: ["foo.bar"] }] }, + { code: "var x = new foo.bar(42);", options: [{ newIsCapExceptionPattern: "^foo\\.." }] }, + { code: "var x = new foo.bar(42);", options: [{ properties: false }] }, + { code: "var x = Foo.bar(42);", options: [{ properties: false }] }, + { code: "var x = foo.Bar(42);", options: [{ capIsNew: false, properties: false }] }, + // Babel-specific test cases. { code: "@MyDecorator(123) class MyClass{}", parser: "babel-eslint" }, ], invalid: [ - { code: "var x = new c();", errors: [{ message: "A constructor name should not start with a lowercase letter.", type: "NewExpression"}] }, - { code: "var x = new φ;", errors: [{ message: "A constructor name should not start with a lowercase letter.", type: "NewExpression"}] }, - { code: "var x = new a.b.c;", errors: [{ message: "A constructor name should not start with a lowercase letter.", type: "NewExpression"}] }, - { code: "var x = new a.b['c'];", errors: [{ message: "A constructor name should not start with a lowercase letter.", type: "NewExpression"}] }, - { code: "var b = Foo();", errors: [{ message: "A function with a name starting with an uppercase letter should only be used as a constructor.", type: "CallExpression"}] }, - { code: "var b = a.Foo();", errors: [{ message: "A function with a name starting with an uppercase letter should only be used as a constructor.", type: "CallExpression"}] }, - { code: "var b = a['Foo']();", errors: [{ message: "A function with a name starting with an uppercase letter should only be used as a constructor.", type: "CallExpression"}] }, - { code: "var b = a.Date.UTC();", errors: [{ message: "A function with a name starting with an uppercase letter should only be used as a constructor.", type: "CallExpression"}] }, - { code: "var b = UTC();", errors: [{ message: "A function with a name starting with an uppercase letter should only be used as a constructor.", type: "CallExpression"}] }, + { code: "var x = new c();", errors: [{ message: "A constructor name should not start with a lowercase letter.", type: "NewExpression" }] }, + { code: "var x = new φ;", errors: [{ message: "A constructor name should not start with a lowercase letter.", type: "NewExpression" }] }, + { code: "var x = new a.b.c;", errors: [{ message: "A constructor name should not start with a lowercase letter.", type: "NewExpression" }] }, + { code: "var x = new a.b['c'];", errors: [{ message: "A constructor name should not start with a lowercase letter.", type: "NewExpression" }] }, + { code: "var b = Foo();", errors: [{ message: "A function with a name starting with an uppercase letter should only be used as a constructor.", type: "CallExpression" }] }, + { code: "var b = a.Foo();", errors: [{ message: "A function with a name starting with an uppercase letter should only be used as a constructor.", type: "CallExpression" }] }, + { code: "var b = a['Foo']();", errors: [{ message: "A function with a name starting with an uppercase letter should only be used as a constructor.", type: "CallExpression" }] }, + { code: "var b = a.Date.UTC();", errors: [{ message: "A function with a name starting with an uppercase letter should only be used as a constructor.", type: "CallExpression" }] }, + { code: "var b = UTC();", errors: [{ message: "A function with a name starting with an uppercase letter should only be used as a constructor.", type: "CallExpression" }] }, { code: "var a = B.C();", errors: [ @@ -125,13 +135,25 @@ ruleTester.run('babel/new-cap', rule, { { code: "var x = Foo.Bar(42);", - options: [{capIsNewExceptions: ["Foo"]}], - errors: [{type: "CallExpression", message: "A function with a name starting with an uppercase letter should only be used as a constructor."}] + options: [{ capIsNewExceptions: ["Foo"] }], + errors: [{ type: "CallExpression", message: "A function with a name starting with an uppercase letter should only be used as a constructor." }] + }, + { + code: "var x = Bar.Foo(42);", + + options: [{ capIsNewExceptionPattern: "^Foo\\.." }], + errors: [{ type: "CallExpression", message: "A function with a name starting with an uppercase letter should only be used as a constructor." }] }, { code: "var x = new foo.bar(42);", - options: [{newIsCapExceptions: ["foo"]}], - errors: [{type: "NewExpression", message: "A constructor name should not start with a lowercase letter."}] + options: [{ newIsCapExceptions: ["foo"] }], + errors: [{ type: "NewExpression", message: "A constructor name should not start with a lowercase letter." }] + }, + { + code: "var x = new bar.foo(42);", + + options: [{ newIsCapExceptionPattern: "^foo\\.." }], + errors: [{ type: "NewExpression", message: "A constructor name should not start with a lowercase letter." }] } ] }); From 562deb8f09e1ccc4a24e6354d3377e42e1e08d25 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Thu, 19 Apr 2018 23:30:41 -0500 Subject: [PATCH 536/569] Merge pull request babel/eslint-plugin-babel#144 from babel/issue142 Fix bug with semi rule with class properties and omitLastInOneLineBlock option --- eslint/babel-eslint-plugin/rules/semi.js | 4 ++-- eslint/babel-eslint-plugin/tests/rules/semi.js | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/eslint/babel-eslint-plugin/rules/semi.js b/eslint/babel-eslint-plugin/rules/semi.js index 95a2467bfc52..2d2fcc4ed292 100644 --- a/eslint/babel-eslint-plugin/rules/semi.js +++ b/eslint/babel-eslint-plugin/rules/semi.js @@ -83,11 +83,11 @@ const semiRuleWithClassProperty = ruleComposer.joinReports([ } } else { if (!isSemicolon(lastToken)) { - if (!exceptOneLine || !isOneLinerBlock(node)) { + if (!exceptOneLine || !isOneLinerBlock(context, node)) { report(context, node); } } else { - if (exceptOneLine && isOneLinerBlock(node)) { + if (exceptOneLine && isOneLinerBlock(context, node)) { report(context, node, true); } } diff --git a/eslint/babel-eslint-plugin/tests/rules/semi.js b/eslint/babel-eslint-plugin/tests/rules/semi.js index b3f4620df919..15ebea037ff6 100644 --- a/eslint/babel-eslint-plugin/tests/rules/semi.js +++ b/eslint/babel-eslint-plugin/tests/rules/semi.js @@ -103,10 +103,12 @@ ruleTester.run("semi", rule, { "class Foo { bar = 'example'; }", "class Foo { static bar = 'example'; }", { code: "async function foo() { for await (let thing of {}) { console.log(thing); } }", parserOptions: { ecmaVersion: 6 } }, + { code: "class Foo { bar = () => {}; }", options: ["always", { omitLastInOneLineBlock: true }] }, // babel, "never" { code: "class Foo { bar = 'example' }", options: ["never"] }, - { code: "class Foo { static bar = 'example' }", options: ["never"] } + { code: "class Foo { static bar = 'example' }", options: ["never"] }, + { code: "class Foo { bar = () => {} }", options: ["never"] }, ], invalid: [ { code: "import * as utils from './utils'", output: "import * as utils from './utils';", parserOptions: { sourceType: "module" }, errors: [{ message: "Missing semicolon.", type: "ImportDeclaration", column: 33 }] }, @@ -184,9 +186,19 @@ ruleTester.run("semi", rule, { // babel { code: "class Foo { bar = 'example' }", errors: [{ message: "Missing semicolon." }] }, { code: "class Foo { static bar = 'example' }", errors: [{ message: "Missing semicolon." }] }, + { + code: "class Foo { bar = () => {} }", + options: ["always", { omitLastInOneLineBlock: true }], + errors: [{ message: "Missing semicolon." }] + }, // babel, "never" { code: "class Foo { bar = 'example'; }", options: ["never"], errors: [{ message: "Extra semicolon." }] }, - { code: "class Foo { static bar = 'example'; }", options: ["never"], errors: [{ message: "Extra semicolon." }] } + { code: "class Foo { static bar = 'example'; }", options: ["never"], errors: [{ message: "Extra semicolon." }] }, + { + code: "class Foo { bar = () => {}; }", + options: ["never"], + errors: [{ message: "Extra semicolon." }] + }, ] }); From 3e7fe7b25e81c6458cfe8804d6ee12ecc5b24e7d Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Fri, 20 Apr 2018 08:49:02 -0500 Subject: [PATCH 537/569] 5.1.0 --- eslint/babel-eslint-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index 796d7a629c74..49662a943c94 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-babel", - "version": "5.0.0", + "version": "5.1.0", "description": "an eslint rule plugin companion to babel-eslint", "main": "index.js", "scripts": { From 2ea80c845e68ab16eb00855f0877b657cfa4d79f Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Tue, 4 Sep 2018 10:34:28 -0500 Subject: [PATCH 538/569] Merge pull request babel/eslint-plugin-babel#157 from amilajack/patch-1 Test against modern node versions --- eslint/babel-eslint-plugin/.travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eslint/babel-eslint-plugin/.travis.yml b/eslint/babel-eslint-plugin/.travis.yml index 6dbd2e233605..068a0122c856 100644 --- a/eslint/babel-eslint-plugin/.travis.yml +++ b/eslint/babel-eslint-plugin/.travis.yml @@ -4,6 +4,6 @@ git: sudo: false language: node_js node_js: - - '4' - - '6' - - '7' + - 6 + - 8 + - 10 From b3ce66b1ff3e65dd26ff077d1905704e7c6c3f0d Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Wed, 5 Sep 2018 09:20:31 -0500 Subject: [PATCH 539/569] Merge pull request babel/eslint-plugin-babel#158 from lehni/fix/optional-call-expression-in-no-unused-expressions --- .../rules/no-unused-expressions.js | 16 +++++++++++++++- .../tests/rules/no-unused-expressions.js | 15 ++++++++------- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/eslint/babel-eslint-plugin/rules/no-unused-expressions.js b/eslint/babel-eslint-plugin/rules/no-unused-expressions.js index 94628cb32a34..eb1955ab0bb8 100644 --- a/eslint/babel-eslint-plugin/rules/no-unused-expressions.js +++ b/eslint/babel-eslint-plugin/rules/no-unused-expressions.js @@ -42,8 +42,22 @@ function isInDoStatement(node) { return false; } +/** + * @param {ASTNode} node - any node + * @returns {boolean} whether the given node is an optional call expression, + * see https://github.com/tc39/proposal-optional-chaining + */ +function isOptionalCallExpression(node) { + return ( + !!node && + node.type === 'ExpressionStatement' && + node.expression.type === 'OptionalCallExpression' + ); +} + module.exports = ruleComposer.filterReports( rule, - (problem, metadata) => !isInDoStatement(problem.node) + (problem, metadata) => + !isInDoStatement(problem.node) && !isOptionalCallExpression(problem.node) ); diff --git a/eslint/babel-eslint-plugin/tests/rules/no-unused-expressions.js b/eslint/babel-eslint-plugin/tests/rules/no-unused-expressions.js index a8156ec174f7..8ecbf68f2622 100644 --- a/eslint/babel-eslint-plugin/tests/rules/no-unused-expressions.js +++ b/eslint/babel-eslint-plugin/tests/rules/no-unused-expressions.js @@ -74,12 +74,13 @@ ruleTester.run("no-unused-expressions", rule, { }, // Babel-specific test cases. - "let a = do { if (foo) { foo.bar } }", - "let a = do { foo }", - "let a = do { let b = 2; foo; }", - "let a = do { (foo + 1) }", - "let a = do { if (foo) { if (foo.bar) { foo.bar } } }", - "let a = do { if (foo) { if (foo.bar) { foo.bar } else if (foo.baz) { foo.baz } } }", + "let a = do { if (foo) { foo.bar; } }", + "let a = do { foo; }", + "let a = do { let b = 2; foo; }", + "let a = do { (foo + 1); }", + "let a = do { if (foo) { if (foo.bar) { foo.bar; } } }", + "let a = do { if (foo) { if (foo.bar) { foo.bar; } else if (foo.baz) { foo.baz; } } }", + "foo.bar?.();", ], invalid: [ @@ -136,7 +137,7 @@ ruleTester.run("no-unused-expressions", rule, { }, // Babel-specific test cases. - { code: "let a = do { foo; let b = 2; }", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] }, + { code: "let a = do { foo; let b = 2; }", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] }, { code: "let a = do { if (foo) { foo.bar } else { a; bar.foo } }", errors: [{ message: "Expected an assignment or function call and instead saw an expression.", type: "ExpressionStatement" }] }, ] From d03a00c1a4a217d3956cfb73c1baa26d26d07b50 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Wed, 5 Sep 2018 09:26:43 -0500 Subject: [PATCH 540/569] mocha@5.2.0 (babel/eslint-plugin-babel#159) --- eslint/babel-eslint-plugin/package.json | 2 +- eslint/babel-eslint-plugin/yarn.lock | 148 ++++++------------------ 2 files changed, 36 insertions(+), 114 deletions(-) diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index 49662a943c94..95f805c72cf9 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -36,6 +36,6 @@ "babel-eslint": "^8.2.2", "eslint": "^4.19.1", "lodash.clonedeep": "^4.5.0", - "mocha": "^3.0.0" + "mocha": "^5.2.0" } } diff --git a/eslint/babel-eslint-plugin/yarn.lock b/eslint/babel-eslint-plugin/yarn.lock index 038c6659b6b9..1b01166993d9 100644 --- a/eslint/babel-eslint-plugin/yarn.lock +++ b/eslint/babel-eslint-plugin/yarn.lock @@ -181,9 +181,9 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" -browser-stdout@1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" +browser-stdout@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" buffer-from@^1.0.0: version "1.0.0" @@ -249,11 +249,9 @@ color-name@^1.1.1: version "1.1.3" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" -commander@2.9.0: - version "2.9.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" - dependencies: - graceful-readlink ">= 1.0.0" +commander@2.15.1: + version "2.15.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.1.tgz#df46e867d0fc2aec66a34662b406a9ccafff5b0f" concat-map@0.0.1: version "0.0.1" @@ -280,13 +278,7 @@ cross-spawn@^5.1.0: shebang-command "^1.2.0" which "^1.2.9" -debug@2.6.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.0.tgz#bc596bcabe7617f11d9fa15361eded5608b8499b" - dependencies: - ms "0.7.2" - -debug@^3.1.0: +debug@3.1.0, debug@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" dependencies: @@ -308,9 +300,9 @@ del@^2.0.2: pinkie-promise "^2.0.0" rimraf "^2.2.8" -diff@3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-3.2.0.tgz#c9ce393a4b7cbd0b058a725c93df299027868ff9" +diff@3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" doctrine@^2.1.0: version "2.1.0" @@ -462,18 +454,7 @@ functional-red-black-tree@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" -glob@7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.2" - once "^1.3.0" - path-is-absolute "^1.0.0" - -glob@^7.0.3, glob@^7.0.5, glob@^7.1.2: +glob@7.1.2, glob@^7.0.3, glob@^7.0.5, glob@^7.1.2: version "7.1.2" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" dependencies: @@ -503,13 +484,9 @@ graceful-fs@^4.1.2: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" -"graceful-readlink@>= 1.0.0": - version "1.0.1" - resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" - -growl@1.9.2: - version "1.9.2" - resolved "https://registry.yarnpkg.com/growl/-/growl-1.9.2.tgz#0ea7743715db8d8de2c5ede1775e1b45ac85c02f" +growl@1.10.5: + version "1.10.5" + resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e" has-ansi@^2.0.0: version "2.0.0" @@ -517,14 +494,14 @@ has-ansi@^2.0.0: dependencies: ansi-regex "^2.0.0" -has-flag@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" - has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" +he@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" + iconv-lite@^0.4.17: version "0.4.19" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" @@ -634,10 +611,6 @@ json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" -json3@3.3.2: - version "3.3.2" - resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.2.tgz#3c0434743df93e2f5c42aee7b19bcb483575f4e1" - levn@^0.3.0, levn@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" @@ -645,57 +618,10 @@ levn@^0.3.0, levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" -lodash._baseassign@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz#8c38a099500f215ad09e59f1722fd0c52bfe0a4e" - dependencies: - lodash._basecopy "^3.0.0" - lodash.keys "^3.0.0" - -lodash._basecopy@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36" - -lodash._basecreate@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz#1bc661614daa7fc311b7d03bf16806a0213cf821" - -lodash._getnative@^3.0.0: - version "3.9.1" - resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" - -lodash._isiterateecall@^3.0.0: - version "3.0.9" - resolved "https://registry.yarnpkg.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz#5203ad7ba425fae842460e696db9cf3e6aac057c" - lodash.clonedeep@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" -lodash.create@3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/lodash.create/-/lodash.create-3.1.1.tgz#d7f2849f0dbda7e04682bb8cd72ab022461debe7" - dependencies: - lodash._baseassign "^3.0.0" - lodash._basecreate "^3.0.0" - lodash._isiterateecall "^3.0.0" - -lodash.isarguments@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" - -lodash.isarray@^3.0.0: - version "3.0.4" - resolved "https://registry.yarnpkg.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55" - -lodash.keys@^3.0.0: - version "3.1.2" - resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a" - dependencies: - lodash._getnative "^3.0.0" - lodash.isarguments "^3.0.0" - lodash.isarray "^3.0.0" - lodash@^4.17.4: version "4.17.5" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" @@ -721,7 +647,7 @@ mimic-fn@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" -minimatch@^3.0.2, minimatch@^3.0.4: +minimatch@3.0.4, minimatch@^3.0.2, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" dependencies: @@ -737,25 +663,21 @@ mkdirp@0.5.1, mkdirp@^0.5.1: dependencies: minimist "0.0.8" -mocha@^3.0.0: - version "3.4.2" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-3.4.2.tgz#d0ef4d332126dbf18d0d640c9b382dd48be97594" +mocha@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-5.2.0.tgz#6d8ae508f59167f940f2b5b3c4a612ae50c90ae6" dependencies: - browser-stdout "1.3.0" - commander "2.9.0" - debug "2.6.0" - diff "3.2.0" + browser-stdout "1.3.1" + commander "2.15.1" + debug "3.1.0" + diff "3.5.0" escape-string-regexp "1.0.5" - glob "7.1.1" - growl "1.9.2" - json3 "3.3.2" - lodash.create "3.1.1" + glob "7.1.2" + growl "1.10.5" + he "1.1.1" + minimatch "3.0.4" mkdirp "0.5.1" - supports-color "3.1.2" - -ms@0.7.2: - version "0.7.2" - resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.2.tgz#ae25cf2512b3885a1d95d7f037868d8431124765" + supports-color "5.4.0" ms@2.0.0: version "2.0.0" @@ -967,11 +889,11 @@ strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" -supports-color@3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.1.2.tgz#72a262894d9d408b956ca05ff37b2ed8a6e2a2d5" +supports-color@5.4.0: + version "5.4.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.4.0.tgz#1c6b337402c2137605efe19f10fec390f6faab54" dependencies: - has-flag "^1.0.0" + has-flag "^3.0.0" supports-color@^2.0.0: version "2.0.0" From f70f68e44a61a6a0e832158d3020d9918e622ae2 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Wed, 5 Sep 2018 09:41:55 -0500 Subject: [PATCH 541/569] Update readme for opt call support in no-unused-expressions [skip ci] (babel/eslint-plugin-babel#160) --- eslint/babel-eslint-plugin/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md index 70f6f833a505..da1dfe220890 100644 --- a/eslint/babel-eslint-plugin/README.md +++ b/eslint/babel-eslint-plugin/README.md @@ -48,7 +48,7 @@ Each rule corresponds to a core `eslint` rule, and has the same options. - `babel/object-curly-spacing`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` (🛠) - `babel/quotes`: doesn't complain about JSX fragment shorthand syntax (`<>foo;`) - `babel/semi`: doesn't fail when using `for await (let something of {})`. Includes class properties (🛠) -- `babel/no-unused-expressions`: doesn't fail when using `do` expressions +- `babel/no-unused-expressions`: doesn't fail when using `do` expressions or [optional chaining](https://github.com/tc39/proposal-optional-chaining) (`a?.b()`). #### Deprecated From d86c6dd4492b6912471565714947cb6e91ea1912 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Thu, 6 Sep 2018 10:39:48 -0500 Subject: [PATCH 542/569] Add valid-typeof rule with support for BigInt (babel/eslint-plugin-babel#161) --- eslint/babel-eslint-plugin/README.md | 4 +- .../babel-eslint-plugin/rules/valid-typeof.js | 12 ++ .../tests/rules/valid-typeof.js | 193 ++++++++++++++++++ 3 files changed, 208 insertions(+), 1 deletion(-) create mode 100644 eslint/babel-eslint-plugin/rules/valid-typeof.js create mode 100644 eslint/babel-eslint-plugin/tests/rules/valid-typeof.js diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md index da1dfe220890..7d1aebcbbdb2 100644 --- a/eslint/babel-eslint-plugin/README.md +++ b/eslint/babel-eslint-plugin/README.md @@ -33,7 +33,8 @@ original ones as well!). "babel/object-curly-spacing": 1, "babel/quotes": 1, "babel/semi": 1, - "babel/no-unused-expressions": 1 + "babel/no-unused-expressions": 1, + "babel/valid-typeof": 1 } } ``` @@ -49,6 +50,7 @@ Each rule corresponds to a core `eslint` rule, and has the same options. - `babel/quotes`: doesn't complain about JSX fragment shorthand syntax (`<>foo;`) - `babel/semi`: doesn't fail when using `for await (let something of {})`. Includes class properties (🛠) - `babel/no-unused-expressions`: doesn't fail when using `do` expressions or [optional chaining](https://github.com/tc39/proposal-optional-chaining) (`a?.b()`). +- `babel/valid-typeof`: doesn't complain when used with [BigInt](https://github.com/tc39/proposal-bigint) (`typeof BigInt(9007199254740991) === 'bigint'`). #### Deprecated diff --git a/eslint/babel-eslint-plugin/rules/valid-typeof.js b/eslint/babel-eslint-plugin/rules/valid-typeof.js new file mode 100644 index 000000000000..df5110be052a --- /dev/null +++ b/eslint/babel-eslint-plugin/rules/valid-typeof.js @@ -0,0 +1,12 @@ +"use strict"; + +const ruleComposer = require('eslint-rule-composer'); +const eslint = require('eslint'); +const validTypeOf = new eslint.Linter().getRules().get('valid-typeof'); + +module.exports = ruleComposer.filterReports( + validTypeOf, + (problem, metadata) => { + return problem.node.value !== 'bigint'; + } +) diff --git a/eslint/babel-eslint-plugin/tests/rules/valid-typeof.js b/eslint/babel-eslint-plugin/tests/rules/valid-typeof.js new file mode 100644 index 000000000000..8e474f6bb123 --- /dev/null +++ b/eslint/babel-eslint-plugin/tests/rules/valid-typeof.js @@ -0,0 +1,193 @@ +/** + * @fileoverview Ensures that the results of typeof are compared against a valid string + * @author Ian Christian Myers + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const rule = require("../../rules/valid-typeof"), + RuleTester = require("../RuleTester"); + +//------------------------------------------------------------------------------ +// Tests +//------------------------------------------------------------------------------ + +const ruleTester = new RuleTester(); + +ruleTester.run("valid-typeof", rule, { + valid: [ + // Original test cases. + "typeof foo === 'string'", + "typeof foo === 'object'", + "typeof foo === 'function'", + "typeof foo === 'undefined'", + "typeof foo === 'boolean'", + "typeof foo === 'number'", + "'string' === typeof foo", + "'object' === typeof foo", + "'function' === typeof foo", + "'undefined' === typeof foo", + "'boolean' === typeof foo", + "'number' === typeof foo", + "typeof foo === typeof bar", + "typeof foo === baz", + "typeof foo !== someType", + "typeof bar != someType", + "someType === typeof bar", + "someType == typeof bar", + "typeof foo == 'string'", + "typeof(foo) === 'string'", + "typeof(foo) !== 'string'", + "typeof(foo) == 'string'", + "typeof(foo) != 'string'", + "var oddUse = typeof foo + 'thing'", + { + code: "typeof foo === 'number'", + options: [{ requireStringLiterals: true }] + }, + { + code: "typeof foo === \"number\"", + options: [{ requireStringLiterals: true }] + }, + { + code: "var baz = typeof foo + 'thing'", + options: [{ requireStringLiterals: true }] + }, + { + code: "typeof foo === typeof bar", + options: [{ requireStringLiterals: true }] + }, + { + code: "typeof foo === `string`", + options: [{ requireStringLiterals: true }], + parserOptions: { ecmaVersion: 6 } + }, + { + code: "`object` === typeof foo", + options: [{ requireStringLiterals: true }], + parserOptions: { ecmaVersion: 6 } + }, + { + code: "typeof foo === `str${somethingElse}`", + parserOptions: { ecmaVersion: 6 } + }, + + // Babel-specific test cases. + { + code: "typeof BigInt(Number.MAX_SAFE_INTEGER) === 'bigint'" + }, + { + code: "'bigint' === typeof BigInt(Number.MAX_SAFE_INTEGER)" + }, + { + code: "typeof BigInt(Number.MAX_SAFE_INTEGER) === 'bigint'", + options: [{ requireStringLiterals: true }] + }, + ], + invalid: [ + { + code: "typeof foo === 'strnig'", + errors: [{ message: "Invalid typeof comparison value.", type: "Literal" }] + }, + { + code: "'strnig' === typeof foo", + errors: [{ message: "Invalid typeof comparison value.", type: "Literal" }] + }, + { + code: "if (typeof bar === 'umdefined') {}", + errors: [{ message: "Invalid typeof comparison value.", type: "Literal" }] + }, + { + code: "typeof foo !== 'strnig'", + errors: [{ message: "Invalid typeof comparison value.", type: "Literal" }] + }, + { + code: "'strnig' !== typeof foo", + errors: [{ message: "Invalid typeof comparison value.", type: "Literal" }] + }, + { + code: "if (typeof bar !== 'umdefined') {}", + errors: [{ message: "Invalid typeof comparison value.", type: "Literal" }] + }, + { + code: "typeof foo != 'strnig'", + errors: [{ message: "Invalid typeof comparison value.", type: "Literal" }] + }, + { + code: "'strnig' != typeof foo", + errors: [{ message: "Invalid typeof comparison value.", type: "Literal" }] + }, + { + code: "if (typeof bar != 'umdefined') {}", + errors: [{ message: "Invalid typeof comparison value.", type: "Literal" }] + }, + { + code: "typeof foo == 'strnig'", + errors: [{ message: "Invalid typeof comparison value.", type: "Literal" }] + }, + { + code: "'strnig' == typeof foo", + errors: [{ message: "Invalid typeof comparison value.", type: "Literal" }] + }, + { + code: "if (typeof bar == 'umdefined') {}", + errors: [{ message: "Invalid typeof comparison value.", type: "Literal" }] + }, + { + code: "if (typeof bar === `umdefined`) {}", + parserOptions: { ecmaVersion: 6 }, + errors: [{ message: "Invalid typeof comparison value.", type: "TemplateLiteral" }] + }, + { + code: "typeof foo == 'invalid string'", + options: [{ requireStringLiterals: true }], + errors: [{ message: "Invalid typeof comparison value.", type: "Literal" }] + }, + { + code: "typeof foo == Object", + options: [{ requireStringLiterals: true }], + errors: [{ message: "Typeof comparisons should be to string literals.", type: "Identifier" }] + }, + { + code: "typeof foo === undefined", + options: [{ requireStringLiterals: true }], + errors: [{ message: "Typeof comparisons should be to string literals.", type: "Identifier" }] + }, + { + code: "undefined === typeof foo", + options: [{ requireStringLiterals: true }], + errors: [{ message: "Typeof comparisons should be to string literals.", type: "Identifier" }] + }, + { + code: "undefined == typeof foo", + options: [{ requireStringLiterals: true }], + errors: [{ message: "Typeof comparisons should be to string literals.", type: "Identifier" }] + }, + { + code: "typeof foo === `undefined${foo}`", + options: [{ requireStringLiterals: true }], + parserOptions: { ecmaVersion: 6 }, + errors: [{ message: "Typeof comparisons should be to string literals.", type: "TemplateLiteral" }] + }, + { + code: "typeof foo === `${string}`", + options: [{ requireStringLiterals: true }], + parserOptions: { ecmaVersion: 6 }, + errors: [{ message: "Typeof comparisons should be to string literals.", type: "TemplateLiteral" }] + }, + + // Babel-specific test cases. + { + code: "typeof foo === 'bgiint'", + errors: [{ message: "Invalid typeof comparison value.", type: "Literal" }] + }, + { + code: "'bignit' === typeof foo", + errors: [{ message: "Invalid typeof comparison value.", type: "Literal" }] + }, + ] +}); From 7c97b5587ad5cd48fc87f2b30e39dc8587408eb5 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Thu, 6 Sep 2018 10:45:30 -0500 Subject: [PATCH 543/569] 5.2.0 --- eslint/babel-eslint-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index 95f805c72cf9..911b3c9bb802 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-babel", - "version": "5.1.0", + "version": "5.2.0", "description": "an eslint rule plugin companion to babel-eslint", "main": "index.js", "scripts": { From e8c0f529a0ac2d5427137ffad9b44df53a2b4771 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Thu, 27 Sep 2018 08:20:52 -0500 Subject: [PATCH 544/569] Fix missing valid-typeof export (babel/eslint-plugin-babel#165) --- eslint/babel-eslint-plugin/index.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/eslint/babel-eslint-plugin/index.js b/eslint/babel-eslint-plugin/index.js index 39962b9f75e3..5ef9660ce452 100644 --- a/eslint/babel-eslint-plugin/index.js +++ b/eslint/babel-eslint-plugin/index.js @@ -10,25 +10,27 @@ module.exports = { 'new-cap': require('./rules/new-cap'), 'no-await-in-loop': require('./rules/no-await-in-loop'), 'no-invalid-this': require('./rules/no-invalid-this'), + 'no-unused-expressions': require('./rules/no-unused-expressions'), 'object-curly-spacing': require('./rules/object-curly-spacing'), 'object-shorthand': require('./rules/object-shorthand'), 'quotes': require('./rules/quotes'), 'semi': require('./rules/semi'), - 'no-unused-expressions': require('./rules/no-unused-expressions'), + 'valid-typeof': require('./rules/valid-typeof'), }, rulesConfig: { - 'generator-star-spacing': 0, - 'new-cap': 0, - 'object-curly-spacing': 0, 'array-bracket-spacing': 0, - 'object-shorthand': 0, 'arrow-parens': 0, - 'no-await-in-loop': 0, 'flow-object-type': 0, 'func-params-comma-dangle': 0, + 'generator-star-spacing': 0, + 'new-cap': 0, + 'no-await-in-loop': 0, 'no-invalid-this': 0, + 'no-unused-expressions': 0, + 'object-curly-spacing': 0, + 'object-shorthand': 0, 'quotes': 0, 'semi': 0, - 'no-unused-expressions': 0, - } + 'valid-typeof': 0, + }, }; From 2358ed1bf920f9f60e13cf5fcc19eca07e80a0dd Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Thu, 27 Sep 2018 09:09:40 -0500 Subject: [PATCH 545/569] 5.2.1 --- eslint/babel-eslint-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index 911b3c9bb802..0f41d9156f43 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-babel", - "version": "5.2.0", + "version": "5.2.1", "description": "an eslint rule plugin companion to babel-eslint", "main": "index.js", "scripts": { From eccbdab734c8ccd42790e9838595ef0ff7e48236 Mon Sep 17 00:00:00 2001 From: Ville Saukkonen Date: Thu, 8 Nov 2018 17:47:03 +0200 Subject: [PATCH 546/569] Camelcase - support for optional chaining (babel/eslint-plugin-babel#163) --- eslint/babel-eslint-plugin/README.md | 2 + eslint/babel-eslint-plugin/index.js | 4 +- eslint/babel-eslint-plugin/rules/camelcase.js | 194 ++++++ .../tests/rules/camelcase.js | 568 ++++++++++++++++++ 4 files changed, 767 insertions(+), 1 deletion(-) create mode 100644 eslint/babel-eslint-plugin/rules/camelcase.js create mode 100644 eslint/babel-eslint-plugin/tests/rules/camelcase.js diff --git a/eslint/babel-eslint-plugin/README.md b/eslint/babel-eslint-plugin/README.md index 7d1aebcbbdb2..fba35aa4dc3f 100644 --- a/eslint/babel-eslint-plugin/README.md +++ b/eslint/babel-eslint-plugin/README.md @@ -29,6 +29,7 @@ original ones as well!). { "rules": { "babel/new-cap": 1, + "babel/camelcase": 1, "babel/no-invalid-this": 1, "babel/object-curly-spacing": 1, "babel/quotes": 1, @@ -45,6 +46,7 @@ Each rule corresponds to a core `eslint` rule, and has the same options. 🛠: means it's autofixable with `--fix`. - `babel/new-cap`: Ignores capitalized decorators (`@Decorator`) +- `babel/camelcase: doesn't complain about optional chaining (`var foo = bar?.a_b;`) - `babel/no-invalid-this`: doesn't fail when inside class properties (`class A { a = this.b; }`) - `babel/object-curly-spacing`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` (🛠) - `babel/quotes`: doesn't complain about JSX fragment shorthand syntax (`<>foo;`) diff --git a/eslint/babel-eslint-plugin/index.js b/eslint/babel-eslint-plugin/index.js index 5ef9660ce452..6cd30daefb0b 100644 --- a/eslint/babel-eslint-plugin/index.js +++ b/eslint/babel-eslint-plugin/index.js @@ -8,6 +8,7 @@ module.exports = { 'func-params-comma-dangle': require('./rules/func-params-comma-dangle'), 'generator-star-spacing': require('./rules/generator-star-spacing'), 'new-cap': require('./rules/new-cap'), + 'camelcase': require('./rules/camelcase'), 'no-await-in-loop': require('./rules/no-await-in-loop'), 'no-invalid-this': require('./rules/no-invalid-this'), 'no-unused-expressions': require('./rules/no-unused-expressions'), @@ -20,6 +21,7 @@ module.exports = { rulesConfig: { 'array-bracket-spacing': 0, 'arrow-parens': 0, + 'camelcase': 0, 'flow-object-type': 0, 'func-params-comma-dangle': 0, 'generator-star-spacing': 0, @@ -28,7 +30,7 @@ module.exports = { 'no-invalid-this': 0, 'no-unused-expressions': 0, 'object-curly-spacing': 0, - 'object-shorthand': 0, + 'object-shorthand': 0, 'quotes': 0, 'semi': 0, 'valid-typeof': 0, diff --git a/eslint/babel-eslint-plugin/rules/camelcase.js b/eslint/babel-eslint-plugin/rules/camelcase.js new file mode 100644 index 000000000000..65e8164cd77b --- /dev/null +++ b/eslint/babel-eslint-plugin/rules/camelcase.js @@ -0,0 +1,194 @@ +/** + * @fileoverview Rule to flag non-camelcased identifiers + * @author Nicholas C. Zakas + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = { + meta: { + docs: { + description: "enforce camelcase naming convention", + category: "Stylistic Issues", + recommended: false, + url: "https://eslint.org/docs/rules/camelcase" + }, + + schema: [ + { + type: "object", + properties: { + ignoreDestructuring: { + type: "boolean" + }, + properties: { + enum: ["always", "never"] + } + }, + additionalProperties: false + } + ], + + messages: { + notCamelCase: "Identifier '{{name}}' is not in camel case." + } + }, + + create(context) { + + //-------------------------------------------------------------------------- + // Helpers + //-------------------------------------------------------------------------- + + // contains reported nodes to avoid reporting twice on destructuring with shorthand notation + const reported = []; + const ALLOWED_PARENT_TYPES = new Set(["CallExpression", "NewExpression"]); + const MEMBER_EXPRESSIONS = ["MemberExpression", "OptionalMemberExpression"]; + + /** + * Checks if expression is supported member expression. + * + * @param {string} expression - An expression to check. + * @returns {boolean} `true` if the expression type is supported + */ + function isMemberExpression(expression) { + return MEMBER_EXPRESSIONS.indexOf(expression) >= 0; + } + + /** + * Checks if a string contains an underscore and isn't all upper-case + * @param {string} name The string to check. + * @returns {boolean} if the string is underscored + * @private + */ + function isUnderscored(name) { + + // if there's an underscore, it might be A_CONSTANT, which is okay + return name.indexOf("_") > -1 && name !== name.toUpperCase(); + } + + /** + * Checks if a parent of a node is an ObjectPattern. + * @param {ASTNode} node The node to check. + * @returns {boolean} if the node is inside an ObjectPattern + * @private + */ + function isInsideObjectPattern(node) { + let { parent } = node; + + while (parent) { + if (parent.type === "ObjectPattern") { + return true; + } + + parent = parent.parent; + } + + return false; + } + + /** + * Reports an AST node as a rule violation. + * @param {ASTNode} node The node to report. + * @returns {void} + * @private + */ + function report(node) { + if (reported.indexOf(node.parent) < 0) { + reported.push(node.parent); + context.report({ node, messageId: "notCamelCase", data: { name: node.name } }); + } + } + + const options = context.options[0] || {}; + let properties = options.properties || ""; + const ignoreDestructuring = options.ignoreDestructuring || false; + + if (properties !== "always" && properties !== "never") { + properties = "always"; + } + + return { + + Identifier(node) { + + /* + * Leading and trailing underscores are commonly used to flag + * private/protected identifiers, strip them + */ + const name = node.name.replace(/^_+|_+$/g, ""), + effectiveParent = isMemberExpression(node.parent.type) ? node.parent.parent : node.parent; + + // MemberExpressions get special rules + if (isMemberExpression(node.parent.type)) { + + // "never" check properties + if (properties === "never") { + return; + } + + // Always report underscored object names + if (node.parent.object.type === "Identifier" && node.parent.object.name === node.name && isUnderscored(name)) { + report(node); + + // Report AssignmentExpressions only if they are the left side of the assignment + } else if (effectiveParent.type === "AssignmentExpression" && isUnderscored(name) && (!isMemberExpression(effectiveParent.right.type) || isMemberExpression(effectiveParent.left.type) && effectiveParent.left.property.name === node.name)) { + report(node); + } + + /* + * Properties have their own rules, and + * AssignmentPattern nodes can be treated like Properties: + * e.g.: const { no_camelcased = false } = bar; + */ + } else if (node.parent.type === "Property" || node.parent.type === "AssignmentPattern") { + + if (node.parent.parent && node.parent.parent.type === "ObjectPattern") { + + const assignmentKeyEqualsValue = node.parent.key.name === node.parent.value.name; + + // prevent checking righthand side of destructured object + if (node.parent.key === node && node.parent.value !== node) { + return; + } + + const valueIsUnderscored = node.parent.value.name && isUnderscored(name); + + // ignore destructuring if the option is set, unless a new identifier is created + if (valueIsUnderscored && !(assignmentKeyEqualsValue && ignoreDestructuring)) { + report(node); + } + } + + // "never" check properties or always ignore destructuring + if (properties === "never" || (ignoreDestructuring && isInsideObjectPattern(node))) { + return; + } + + // don't check right hand side of AssignmentExpression to prevent duplicate warnings + if (isUnderscored(name) && !ALLOWED_PARENT_TYPES.has(effectiveParent.type) && !(node.parent.right === node)) { + report(node); + } + + // Check if it's an import specifier + } else if (["ImportSpecifier", "ImportNamespaceSpecifier", "ImportDefaultSpecifier"].indexOf(node.parent.type) >= 0) { + + // Report only if the local imported identifier is underscored + if (node.parent.local && node.parent.local.name === node.name && isUnderscored(name)) { + report(node); + } + + // Report anything that is underscored that isn't a CallExpression + } else if (isUnderscored(name) && !ALLOWED_PARENT_TYPES.has(effectiveParent.type)) { + report(node); + } + } + + }; + + } +}; diff --git a/eslint/babel-eslint-plugin/tests/rules/camelcase.js b/eslint/babel-eslint-plugin/tests/rules/camelcase.js new file mode 100644 index 000000000000..0344018515b8 --- /dev/null +++ b/eslint/babel-eslint-plugin/tests/rules/camelcase.js @@ -0,0 +1,568 @@ +/** + * @fileoverview Tests for camelcase rule. + * @author Nicholas C. Zakas + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const rule = require("../../rules/camelcase"), + RuleTester = require("../RuleTester"); + +//------------------------------------------------------------------------------ +// Tests +//------------------------------------------------------------------------------ + +const ruleTester = new RuleTester(); + +ruleTester.run("camelcase", rule, { + valid: [ + // Original test cases. + "firstName = \"Nicholas\"", + "FIRST_NAME = \"Nicholas\"", + "__myPrivateVariable = \"Patrick\"", + "myPrivateVariable_ = \"Patrick\"", + "function doSomething(){}", + "do_something()", + "new do_something", + "new do_something()", + "foo.do_something()", + "var foo = bar.baz_boom;", + "var foo = bar.baz_boom.something;", + "foo.boom_pow.qux = bar.baz_boom.something;", + "if (bar.baz_boom) {}", + "var obj = { key: foo.bar_baz };", + "var arr = [foo.bar_baz];", + "[foo.bar_baz]", + "var arr = [foo.bar_baz.qux];", + "[foo.bar_baz.nesting]", + "if (foo.bar_baz === boom.bam_pow) { [foo.baz_boom] }", + { + code: "var o = {key: 1}", + options: [{ properties: "always" }] + }, + { + code: "var o = {_leading: 1}", + options: [{ properties: "always" }] + }, + { + code: "var o = {trailing_: 1}", + options: [{ properties: "always" }] + }, + { + code: "var o = {bar_baz: 1}", + options: [{ properties: "never" }] + }, + { + code: "var o = {_leading: 1}", + options: [{ properties: "never" }] + }, + { + code: "var o = {trailing_: 1}", + options: [{ properties: "never" }] + }, + { + code: "obj.a_b = 2;", + options: [{ properties: "never" }] + }, + { + code: "obj._a = 2;", + options: [{ properties: "always" }] + }, + { + code: "obj.a_ = 2;", + options: [{ properties: "always" }] + }, + { + code: "obj._a = 2;", + options: [{ properties: "never" }] + }, + { + code: "obj.a_ = 2;", + options: [{ properties: "never" }] + }, + { + code: "var obj = {\n a_a: 1 \n};\n obj.a_b = 2;", + options: [{ properties: "never" }] + }, + { + code: "obj.foo_bar = function(){};", + options: [{ properties: "never" }] + }, + { + code: "var { category_id } = query;", + options: [{ ignoreDestructuring: true }], + parserOptions: { ecmaVersion: 6 } + }, + { + code: "var { category_id: category_id } = query;", + options: [{ ignoreDestructuring: true }], + parserOptions: { ecmaVersion: 6 } + }, + { + code: "var { category_id = 1 } = query;", + options: [{ ignoreDestructuring: true }], + parserOptions: { ecmaVersion: 6 }, + + }, + { + code: "var { category_id: category } = query;", + parserOptions: { ecmaVersion: 6 } + }, + { + code: "var { _leading } = query;", + parserOptions: { ecmaVersion: 6 } + }, + { + code: "var { trailing_ } = query;", + parserOptions: { ecmaVersion: 6 } + }, + { + code: "import { camelCased } from \"external module\";", + parserOptions: { ecmaVersion: 6, sourceType: "module" } + }, + { + code: "import { _leading } from \"external module\";", + parserOptions: { ecmaVersion: 6, sourceType: "module" } + }, + { + code: "import { trailing_ } from \"external module\";", + parserOptions: { ecmaVersion: 6, sourceType: "module" } + }, + { + code: "import { no_camelcased as camelCased } from \"external-module\";", + parserOptions: { ecmaVersion: 6, sourceType: "module" } + }, + { + code: "import { no_camelcased as _leading } from \"external-module\";", + parserOptions: { ecmaVersion: 6, sourceType: "module" } + }, + { + code: "import { no_camelcased as trailing_ } from \"external-module\";", + parserOptions: { ecmaVersion: 6, sourceType: "module" } + }, + { + code: "import { no_camelcased as camelCased, anoterCamelCased } from \"external-module\";", + parserOptions: { ecmaVersion: 6, sourceType: "module" } + }, + { + code: "function foo({ no_camelcased: camelCased }) {};", + parserOptions: { ecmaVersion: 6 } + }, + { + code: "function foo({ no_camelcased: _leading }) {};", + parserOptions: { ecmaVersion: 6 } + }, + { + code: "function foo({ no_camelcased: trailing_ }) {};", + parserOptions: { ecmaVersion: 6 } + }, + { + code: "function foo({ camelCased = 'default value' }) {};", + parserOptions: { ecmaVersion: 6 } + }, + { + code: "function foo({ _leading = 'default value' }) {};", + parserOptions: { ecmaVersion: 6 } + }, + { + code: "function foo({ trailing_ = 'default value' }) {};", + parserOptions: { ecmaVersion: 6 } + }, + { + code: "function foo({ camelCased }) {};", + parserOptions: { ecmaVersion: 6 } + }, + { + code: "function foo({ _leading }) {}", + parserOptions: { ecmaVersion: 6 } + }, + { + code: "function foo({ trailing_ }) {}", + parserOptions: { ecmaVersion: 6 } + }, + + // Babel-specific test cases + { + code: "var foo = bar?.a_b;", + options: [{ properties: "never" }] + }, + ], + invalid: [ + { + code: "first_name = \"Nicholas\"", + errors: [ + { + messageId: "notCamelCase", + data: { name: "first_name" }, + type: "Identifier" + } + ] + }, + { + code: "__private_first_name = \"Patrick\"", + errors: [ + { + messageId: "notCamelCase", + data: { name: "__private_first_name" }, + type: "Identifier" + } + ] + }, + { + code: "function foo_bar(){}", + errors: [ + { + messageId: "notCamelCase", + data: { name: "foo_bar" }, + type: "Identifier" + } + ] + }, + { + code: "obj.foo_bar = function(){};", + errors: [ + { + messageId: "notCamelCase", + data: { name: "foo_bar" }, + type: "Identifier" + } + ] + }, + { + code: "bar_baz.foo = function(){};", + errors: [ + { + messageId: "notCamelCase", + data: { name: "bar_baz" }, + type: "Identifier" + } + ] + }, + { + code: "[foo_bar.baz]", + errors: [ + { + messageId: "notCamelCase", + data: { name: "foo_bar" }, + type: "Identifier" + } + ] + }, + { + code: "if (foo.bar_baz === boom.bam_pow) { [foo_bar.baz] }", + errors: [ + { + messageId: "notCamelCase", + data: { name: "foo_bar" }, + type: "Identifier" + } + ] + }, + { + code: "foo.bar_baz = boom.bam_pow", + errors: [ + { + messageId: "notCamelCase", + data: { name: "bar_baz" }, + type: "Identifier" + } + ] + }, + { + code: "var foo = { bar_baz: boom.bam_pow }", + errors: [ + { + messageId: "notCamelCase", + data: { name: "bar_baz" }, + type: "Identifier" + } + ] + }, + { + code: "foo.qux.boom_pow = { bar: boom.bam_pow }", + errors: [ + { + messageId: "notCamelCase", + data: { name: "boom_pow" }, + type: "Identifier" + } + ] + }, + { + code: "var o = {bar_baz: 1}", + options: [{ properties: "always" }], + errors: [ + { + messageId: "notCamelCase", + data: { name: "bar_baz" }, + type: "Identifier" + } + ] + }, + { + code: "obj.a_b = 2;", + options: [{ properties: "always" }], + errors: [ + { + messageId: "notCamelCase", + data: { name: "a_b" }, + type: "Identifier" + } + ] + }, + { + code: "var { category_id: category_alias } = query;", + parserOptions: { ecmaVersion: 6 }, + errors: [ + { + messageId: "notCamelCase", + data: { name: "category_alias" }, + type: "Identifier" + } + ] + }, + { + code: "var { category_id: category_alias } = query;", + options: [{ ignoreDestructuring: true }], + parserOptions: { ecmaVersion: 6 }, + errors: [ + { + messageId: "notCamelCase", + data: { name: "category_alias" }, + type: "Identifier" + } + ] + }, + { + code: "var { category_id: categoryId, ...other_props } = query;", + options: [{ ignoreDestructuring: true }], + parserOptions: { ecmaVersion: 2018 }, + errors: [ + { + messageId: "notCamelCase", + data: { name: "other_props" }, + type: "Identifier" + } + ] + }, + { + code: "var { category_id } = query;", + parserOptions: { ecmaVersion: 6 }, + errors: [ + { + messageId: "notCamelCase", + data: { name: "category_id" }, + type: "Identifier" + } + ] + }, + { + code: "var { category_id: category_id } = query;", + parserOptions: { ecmaVersion: 6 }, + errors: [ + { + messageId: "notCamelCase", + data: { name: "category_id" }, + type: "Identifier" + } + ] + }, + { + code: "var { category_id = 1 } = query;", + parserOptions: { ecmaVersion: 6 }, + errors: [ + { + message: "Identifier 'category_id' is not in camel case.", + type: "Identifier" + } + ] + }, + { + code: "import no_camelcased from \"external-module\";", + parserOptions: { ecmaVersion: 6, sourceType: "module" }, + errors: [ + { + messageId: "notCamelCase", + data: { name: "no_camelcased" }, + type: "Identifier" + } + ] + }, + { + code: "import * as no_camelcased from \"external-module\";", + parserOptions: { ecmaVersion: 6, sourceType: "module" }, + errors: [ + { + messageId: "notCamelCase", + data: { name: "no_camelcased" }, + type: "Identifier" + } + ] + }, + { + code: "import { no_camelcased } from \"external-module\";", + parserOptions: { ecmaVersion: 6, sourceType: "module" }, + errors: [ + { + messageId: "notCamelCase", + data: { name: "no_camelcased" }, + type: "Identifier" + } + ] + }, + { + code: "import { no_camelcased as no_camel_cased } from \"external module\";", + parserOptions: { ecmaVersion: 6, sourceType: "module" }, + errors: [ + { + messageId: "notCamelCase", + data: { name: "no_camel_cased" }, + type: "Identifier" + } + ] + }, + { + code: "import { camelCased as no_camel_cased } from \"external module\";", + parserOptions: { ecmaVersion: 6, sourceType: "module" }, + errors: [ + { + messageId: "notCamelCase", + data: { name: "no_camel_cased" }, + type: "Identifier" + } + ] + }, + { + code: "import { camelCased, no_camelcased } from \"external-module\";", + parserOptions: { ecmaVersion: 6, sourceType: "module" }, + errors: [ + { + messageId: "notCamelCase", + data: { name: "no_camelcased" }, + type: "Identifier" + } + ] + }, + { + code: "import { no_camelcased as camelCased, another_no_camelcased } from \"external-module\";", + parserOptions: { ecmaVersion: 6, sourceType: "module" }, + errors: [ + { + messageId: "notCamelCase", + data: { name: "another_no_camelcased" }, + type: "Identifier" + } + ] + }, + { + code: "import camelCased, { no_camelcased } from \"external-module\";", + parserOptions: { ecmaVersion: 6, sourceType: "module" }, + errors: [ + { + messageId: "notCamelCase", + data: { name: "no_camelcased" }, + type: "Identifier" + } + ] + }, + { + code: "import no_camelcased, { another_no_camelcased as camelCased } from \"external-module\";", + parserOptions: { ecmaVersion: 6, sourceType: "module" }, + errors: [ + { + messageId: "notCamelCase", + data: { name: "no_camelcased" }, + type: "Identifier" + } + ] + }, + { + code: "function foo({ no_camelcased }) {};", + parserOptions: { ecmaVersion: 6 }, + errors: [ + { + message: "Identifier 'no_camelcased' is not in camel case.", + type: "Identifier" + } + ] + }, + { + code: "function foo({ no_camelcased = 'default value' }) {};", + parserOptions: { ecmaVersion: 6 }, + errors: [ + { + message: "Identifier 'no_camelcased' is not in camel case.", + type: "Identifier" + } + ] + }, + { + code: "const no_camelcased = 0; function foo({ camelcased_value = no_camelcased}) {}", + parserOptions: { ecmaVersion: 6 }, + errors: [ + { + message: "Identifier 'no_camelcased' is not in camel case.", + type: "Identifier" + }, + { + message: "Identifier 'camelcased_value' is not in camel case.", + type: "Identifier" + } + ] + }, + { + code: "const { bar: no_camelcased } = foo;", + parserOptions: { ecmaVersion: 6 }, + errors: [ + { + message: "Identifier 'no_camelcased' is not in camel case.", + type: "Identifier" + } + ] + }, + { + code: "function foo({ value_1: my_default }) {}", + parserOptions: { ecmaVersion: 6 }, + errors: [ + { + message: "Identifier 'my_default' is not in camel case.", + type: "Identifier" + } + ] + }, + { + code: "function foo({ isCamelcased: no_camelcased }) {};", + parserOptions: { ecmaVersion: 6 }, + errors: [ + { + message: "Identifier 'no_camelcased' is not in camel case.", + type: "Identifier" + } + ] + }, + { + code: "var { foo: bar_baz = 1 } = quz;", + parserOptions: { ecmaVersion: 6 }, + errors: [ + { + message: "Identifier 'bar_baz' is not in camel case.", + type: "Identifier" + } + ] + }, + { + code: "const { no_camelcased = false } = bar;", + parserOptions: { ecmaVersion: 6 }, + errors: [ + { + message: "Identifier 'no_camelcased' is not in camel case.", + type: "Identifier" + } + ] + } + ] +}); From ebe197f12ecb3a8c0b3e63bc82f6f6189fc46065 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Thu, 15 Nov 2018 09:13:03 -0600 Subject: [PATCH 547/569] 5.3.0 --- eslint/babel-eslint-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin/package.json b/eslint/babel-eslint-plugin/package.json index 0f41d9156f43..1d07201d0473 100644 --- a/eslint/babel-eslint-plugin/package.json +++ b/eslint/babel-eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-babel", - "version": "5.2.1", + "version": "5.3.0", "description": "an eslint rule plugin companion to babel-eslint", "main": "index.js", "scripts": { From 7061d966ab8ebcb13cf18ee65a520164e33ef8f6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 12 Jul 2019 20:20:59 -0500 Subject: [PATCH 548/569] Bump lodash from 4.17.4 to 4.17.14 (babel/eslint-plugin-babel#181) Bumps [lodash](https://github.com/lodash/lodash) from 4.17.4 to 4.17.14. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.4...4.17.14) Signed-off-by: dependabot[bot] --- eslint/babel-eslint-plugin/yarn.lock | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/eslint/babel-eslint-plugin/yarn.lock b/eslint/babel-eslint-plugin/yarn.lock index 1b01166993d9..b057a7f7d565 100644 --- a/eslint/babel-eslint-plugin/yarn.lock +++ b/eslint/babel-eslint-plugin/yarn.lock @@ -622,13 +622,9 @@ lodash.clonedeep@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" -lodash@^4.17.4: - version "4.17.5" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" - -lodash@^4.2.0, lodash@^4.3.0: - version "4.17.4" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" +lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0: + version "4.17.14" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.14.tgz#9ce487ae66c96254fe20b599f21b6816028078ba" loose-envify@^1.0.0: version "1.3.1" From 693fa1aa0da42596366a61979c55eacfef2d4344 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Jul 2019 18:52:01 +0200 Subject: [PATCH 549/569] Bump js-yaml from 3.11.0 to 3.13.1 (babel/eslint-plugin-babel#177) Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.11.0 to 3.13.1. - [Release notes](https://github.com/nodeca/js-yaml/releases) - [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md) - [Commits](https://github.com/nodeca/js-yaml/compare/3.11.0...3.13.1) Signed-off-by: dependabot[bot] --- eslint/babel-eslint-plugin/yarn.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/eslint/babel-eslint-plugin/yarn.lock b/eslint/babel-eslint-plugin/yarn.lock index b057a7f7d565..7845d4d1c04c 100644 --- a/eslint/babel-eslint-plugin/yarn.lock +++ b/eslint/babel-eslint-plugin/yarn.lock @@ -128,8 +128,8 @@ ansi-styles@^3.2.1: color-convert "^1.9.0" argparse@^1.0.7: - version "1.0.9" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86" + version "1.0.10" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" dependencies: sprintf-js "~1.0.2" @@ -380,8 +380,8 @@ espree@^3.5.4: acorn-jsx "^3.0.0" esprima@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" esquery@^1.0.0: version "1.0.0" @@ -593,8 +593,8 @@ js-tokens@^3.0.0: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7" js-yaml@^3.9.1: - version "3.11.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.11.0.tgz#597c1a8bd57152f26d622ce4117851a51f5ebaef" + version "3.13.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" dependencies: argparse "^1.0.7" esprima "^4.0.0" From f3e2752df3f9815c494cbbc38b04d99b626d8ab9 Mon Sep 17 00:00:00 2001 From: fergald Date: Sat, 24 Aug 2019 17:12:15 +0900 Subject: [PATCH 550/569] Support private properties in no-invalid-this (babel/eslint-plugin-babel#183) * add failing test * support ClassPrivateProperty --- .../babel-eslint-plugin/rules/no-invalid-this.js | 7 ++++--- .../tests/rules/no-invalid-this.js | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/eslint/babel-eslint-plugin/rules/no-invalid-this.js b/eslint/babel-eslint-plugin/rules/no-invalid-this.js index ab12ca5320a3..994499eaadaa 100644 --- a/eslint/babel-eslint-plugin/rules/no-invalid-this.js +++ b/eslint/babel-eslint-plugin/rules/no-invalid-this.js @@ -5,17 +5,18 @@ const eslint = require('eslint'); const noInvalidThisRule = new eslint.Linter().getRules().get('no-invalid-this'); module.exports = ruleComposer.filterReports( - noInvalidThisRule, + noInvalidThisRule, (problem, metadata) => { let inClassProperty = false; let node = problem.node; while (node) { - if (node.type === "ClassProperty") { + if (node.type === "ClassProperty" || + node.type === "ClassPrivateProperty") { inClassProperty = true; return; } - + node = node.parent; } diff --git a/eslint/babel-eslint-plugin/tests/rules/no-invalid-this.js b/eslint/babel-eslint-plugin/tests/rules/no-invalid-this.js index 3ab5da59c95f..e28c77aa5e07 100644 --- a/eslint/babel-eslint-plugin/tests/rules/no-invalid-this.js +++ b/eslint/babel-eslint-plugin/tests/rules/no-invalid-this.js @@ -602,6 +602,21 @@ const patterns = [ valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], invalid: [] }, + + // Class Private Instance Properties. + { + code: "class A {#a = this.b;};", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, + + { + code: "class A {#a = () => {return this.b;};};", + parserOptions: { ecmaVersion: 6 }, + valid: [NORMAL, USE_STRICT, IMPLIED_STRICT, MODULES], + invalid: [] + }, ]; const ruleTester = new RuleTester(); From 3243af3e07a4661674027821377cfaf184807817 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Sun, 18 Nov 2018 23:57:36 +0100 Subject: [PATCH 551/569] First commit --- .../.eslintrc.json | 20 + .../.gitignore | 1 + .../.prettierrc | 11 + .../babel-eslint-plugin-development/README.md | 29 + .../package.json | 30 + .../src/index.js | 5 + .../babel-eslint-plugin-development/yarn.lock | 857 ++++++++++++++++++ 7 files changed, 953 insertions(+) create mode 100644 eslint/babel-eslint-plugin-development/.eslintrc.json create mode 100644 eslint/babel-eslint-plugin-development/.gitignore create mode 100644 eslint/babel-eslint-plugin-development/.prettierrc create mode 100644 eslint/babel-eslint-plugin-development/README.md create mode 100644 eslint/babel-eslint-plugin-development/package.json create mode 100644 eslint/babel-eslint-plugin-development/src/index.js create mode 100644 eslint/babel-eslint-plugin-development/yarn.lock diff --git a/eslint/babel-eslint-plugin-development/.eslintrc.json b/eslint/babel-eslint-plugin-development/.eslintrc.json new file mode 100644 index 000000000000..0b09e73c3d1f --- /dev/null +++ b/eslint/babel-eslint-plugin-development/.eslintrc.json @@ -0,0 +1,20 @@ +{ + "root": true, + "extends": "eslint:recommended", + "plugins": ["prettier"], + "parserOptions": { + "ecmaVersion": 2018, + "sourceType": "script" + }, + "env": { + "node": true + }, + "rules": { + "prettier/prettier": "error", + + "curly": ["error", "multi-line"], + "linebreak-style": ["error", "unix"], + "no-var": "error", + "prefer-const": "error" + } +} diff --git a/eslint/babel-eslint-plugin-development/.gitignore b/eslint/babel-eslint-plugin-development/.gitignore new file mode 100644 index 000000000000..b512c09d4766 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/eslint/babel-eslint-plugin-development/.prettierrc b/eslint/babel-eslint-plugin-development/.prettierrc new file mode 100644 index 000000000000..bf2972ae07a3 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/.prettierrc @@ -0,0 +1,11 @@ +{ + "arrowParens": "avoid", + "trailingComma": "all", + "useTabs": false, + "semi": true, + "singleQuote": false, + "bracketSpacing": true, + "jsxBracketSameLine": false, + "tabWidth": 2, + "printWidth": 80 +} diff --git a/eslint/babel-eslint-plugin-development/README.md b/eslint/babel-eslint-plugin-development/README.md new file mode 100644 index 000000000000..c18f4801d90b --- /dev/null +++ b/eslint/babel-eslint-plugin-development/README.md @@ -0,0 +1,29 @@ +# eslint-plugin-babel-plugin + +A set of eslint rules to enforce best practices in the development of Babel plugins. + +## Installation + +You'll first need to install [ESLint](http://eslint.org): + +``` +$ npm install --save-dev eslint +``` + +Next, install `eslint-plugin-babel-plugin`: + +``` +$ npm install --save-dev eslint-plugin-babel-plugin +``` + +Then, load the plugin in your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix: + +```json +{ + "plugins": ["babel-plugin"] +} +``` + +## Supported Rules + +* Fill in provided rules here diff --git a/eslint/babel-eslint-plugin-development/package.json b/eslint/babel-eslint-plugin-development/package.json new file mode 100644 index 000000000000..ce7a934753c3 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/package.json @@ -0,0 +1,30 @@ +{ + "name": "eslint-plugin-babel-plugin", + "version": "0.0.0", + "description": "A set of eslint rules to enforce best practices in the development of Babel plugins.", + "keywords": [ + "eslint", + "eslintplugin", + "eslint-plugin" + ], + "author": { + "name": "Nicolò Ribaudo", + "email": "nicolo.ribaudo@gmail.com", + "url": "https://github.com/nicolo-ribaudo" + }, + "main": "index.js", + "scripts": { + "test": "mocha tests --recursive", + "lint": "eslint src" + }, + "devDependencies": { + "eslint": "^5.9.0", + "eslint-plugin-prettier": "^3.0.0", + "mocha": "^5.2.0", + "prettier": "^1.15.2" + }, + "engines": { + "node": ">=8.0.0" + }, + "license": "MIT" +} diff --git a/eslint/babel-eslint-plugin-development/src/index.js b/eslint/babel-eslint-plugin-development/src/index.js new file mode 100644 index 000000000000..84d69fb8226d --- /dev/null +++ b/eslint/babel-eslint-plugin-development/src/index.js @@ -0,0 +1,5 @@ +"use strict"; + +module.exports = { + rules: {}, +}; diff --git a/eslint/babel-eslint-plugin-development/yarn.lock b/eslint/babel-eslint-plugin-development/yarn.lock new file mode 100644 index 000000000000..7532a9eae183 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/yarn.lock @@ -0,0 +1,857 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@babel/code-frame@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0.tgz#06e2ab19bdb535385559aabb5ba59729482800f8" + integrity sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA== + dependencies: + "@babel/highlight" "^7.0.0" + +"@babel/highlight@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0.tgz#f710c38c8d458e6dd9a201afb637fcb781ce99e4" + integrity sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw== + dependencies: + chalk "^2.0.0" + esutils "^2.0.2" + js-tokens "^4.0.0" + +acorn-jsx@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.0.tgz#958584ddb60990c02c97c1bd9d521fce433bb101" + integrity sha512-XkB50fn0MURDyww9+UYL3c1yLbOBz0ZFvrdYlGB8l+Ije1oSC75qAqrzSPjYQbdnQUzhlUGNKuesryAv0gxZOg== + +acorn@^6.0.2: + version "6.0.4" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.0.4.tgz#77377e7353b72ec5104550aa2d2097a2fd40b754" + integrity sha512-VY4i5EKSKkofY2I+6QLTbTTN/UvEQPCo6eiwzzSaSWfpaDhOmStMCMod6wmuPciNq+XS0faCglFu2lHZpdHUtg== + +ajv@^6.5.3: + version "6.5.5" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.5.5.tgz#cf97cdade71c6399a92c6d6c4177381291b781a1" + integrity sha512-7q7gtRQDJSyuEHjuVgHoUa2VuemFiCMrfQc9Tc08XTAc4Zj/5U1buQJ0HU6i7fKjXU09SVgSmxa4sLvuvS8Iyg== + dependencies: + fast-deep-equal "^2.0.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + +ansi-escapes@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.1.0.tgz#f73207bb81207d75fd6c83f125af26eea378ca30" + integrity sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw== + +ansi-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= + +ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + dependencies: + color-convert "^1.9.0" + +argparse@^1.0.7: + version "1.0.10" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== + dependencies: + sprintf-js "~1.0.2" + +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +browser-stdout@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" + integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== + +caller-path@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" + integrity sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8= + dependencies: + callsites "^0.2.0" + +callsites@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" + integrity sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo= + +chalk@^2.0.0, chalk@^2.1.0: + version "2.4.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e" + integrity sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ== + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + +chardet@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" + integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== + +circular-json@^0.3.1: + version "0.3.3" + resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" + integrity sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A== + +cli-cursor@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" + integrity sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU= + dependencies: + restore-cursor "^2.0.0" + +cli-width@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" + integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk= + +color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + dependencies: + color-name "1.1.3" + +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= + +commander@2.15.1: + version "2.15.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.1.tgz#df46e867d0fc2aec66a34662b406a9ccafff5b0f" + integrity sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag== + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= + +cross-spawn@^6.0.5: + version "6.0.5" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" + integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== + dependencies: + nice-try "^1.0.4" + path-key "^2.0.1" + semver "^5.5.0" + shebang-command "^1.2.0" + which "^1.2.9" + +debug@3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g== + dependencies: + ms "2.0.0" + +debug@^4.0.1: + version "4.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.0.tgz#373687bffa678b38b1cd91f861b63850035ddc87" + integrity sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg== + dependencies: + ms "^2.1.1" + +deep-is@~0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" + integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= + +diff@3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" + integrity sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA== + +doctrine@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" + integrity sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw== + dependencies: + esutils "^2.0.2" + +escape-string-regexp@1.0.5, escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= + +eslint-plugin-prettier@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.0.0.tgz#f6b823e065f8c36529918cdb766d7a0e975ec30c" + integrity sha512-4g11opzhqq/8+AMmo5Vc2Gn7z9alZ4JqrbZ+D4i8KlSyxeQhZHlmIrY8U9Akf514MoEhogPa87Jgkq87aZ2Ohw== + dependencies: + prettier-linter-helpers "^1.0.0" + +eslint-scope@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.0.tgz#50bf3071e9338bcdc43331794a0cb533f0136172" + integrity sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA== + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint-utils@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.3.1.tgz#9a851ba89ee7c460346f97cf8939c7298827e512" + integrity sha512-Z7YjnIldX+2XMcjr7ZkgEsOj/bREONV60qYeB/bjMAqqqZ4zxKyWX+BOUkdmRmA9riiIPVvo5x86m5elviOk0Q== + +eslint-visitor-keys@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" + integrity sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ== + +eslint@^5.9.0: + version "5.9.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.9.0.tgz#b234b6d15ef84b5849c6de2af43195a2d59d408e" + integrity sha512-g4KWpPdqN0nth+goDNICNXGfJF7nNnepthp46CAlJoJtC5K/cLu3NgCM3AHu1CkJ5Hzt9V0Y0PBAO6Ay/gGb+w== + dependencies: + "@babel/code-frame" "^7.0.0" + ajv "^6.5.3" + chalk "^2.1.0" + cross-spawn "^6.0.5" + debug "^4.0.1" + doctrine "^2.1.0" + eslint-scope "^4.0.0" + eslint-utils "^1.3.1" + eslint-visitor-keys "^1.0.0" + espree "^4.0.0" + esquery "^1.0.1" + esutils "^2.0.2" + file-entry-cache "^2.0.0" + functional-red-black-tree "^1.0.1" + glob "^7.1.2" + globals "^11.7.0" + ignore "^4.0.6" + imurmurhash "^0.1.4" + inquirer "^6.1.0" + is-resolvable "^1.1.0" + js-yaml "^3.12.0" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.3.0" + lodash "^4.17.5" + minimatch "^3.0.4" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + optionator "^0.8.2" + path-is-inside "^1.0.2" + pluralize "^7.0.0" + progress "^2.0.0" + regexpp "^2.0.1" + require-uncached "^1.0.3" + semver "^5.5.1" + strip-ansi "^4.0.0" + strip-json-comments "^2.0.1" + table "^5.0.2" + text-table "^0.2.0" + +espree@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-4.1.0.tgz#728d5451e0fd156c04384a7ad89ed51ff54eb25f" + integrity sha512-I5BycZW6FCVIub93TeVY1s7vjhP9CY6cXCznIRfiig7nRviKZYdRnj/sHEWC6A7WE9RDWOFq9+7OsWSYz8qv2w== + dependencies: + acorn "^6.0.2" + acorn-jsx "^5.0.0" + eslint-visitor-keys "^1.0.0" + +esprima@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== + +esquery@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708" + integrity sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA== + dependencies: + estraverse "^4.0.0" + +esrecurse@^4.1.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" + integrity sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ== + dependencies: + estraverse "^4.1.0" + +estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1: + version "4.2.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" + integrity sha1-De4/7TH81GlhjOc0IJn8GvoL2xM= + +esutils@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" + integrity sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs= + +external-editor@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.0.3.tgz#5866db29a97826dbe4bf3afd24070ead9ea43a27" + integrity sha512-bn71H9+qWoOQKyZDo25mOMVpSmXROAsTJVVVYzrrtol3d4y+AsKjf4Iwl2Q+IuT0kFSQ1qo166UuIwqYq7mGnA== + dependencies: + chardet "^0.7.0" + iconv-lite "^0.4.24" + tmp "^0.0.33" + +fast-deep-equal@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" + integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= + +fast-diff@^1.1.2: + version "1.2.0" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" + integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== + +fast-json-stable-stringify@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" + integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I= + +fast-levenshtein@~2.0.4: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= + +figures@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" + integrity sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI= + dependencies: + escape-string-regexp "^1.0.5" + +file-entry-cache@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" + integrity sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E= + dependencies: + flat-cache "^1.2.1" + object-assign "^4.0.1" + +flat-cache@^1.2.1: + version "1.3.4" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.4.tgz#2c2ef77525cc2929007dfffa1dd314aa9c9dee6f" + integrity sha512-VwyB3Lkgacfik2vhqR4uv2rvebqmDvFu4jlN/C1RzWoJEo8I7z4Q404oiqYCkq41mni8EzQnm95emU9seckwtg== + dependencies: + circular-json "^0.3.1" + graceful-fs "^4.1.2" + rimraf "~2.6.2" + write "^0.2.1" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= + +functional-red-black-tree@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" + integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= + +glob@7.1.2: + version "7.1.2" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" + integrity sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +glob@^7.0.5, glob@^7.1.2: + version "7.1.3" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1" + integrity sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +globals@^11.7.0: + version "11.9.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.9.0.tgz#bde236808e987f290768a93d065060d78e6ab249" + integrity sha512-5cJVtyXWH8PiJPVLZzzoIizXx944O4OmRro5MWKx5fT4MgcN7OfaMutPeaTdJCCURwbWdhhcCWcKIffPnmTzBg== + +graceful-fs@^4.1.2: + version "4.1.15" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.15.tgz#ffb703e1066e8a0eeaa4c8b80ba9253eeefbfb00" + integrity sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA== + +growl@1.10.5: + version "1.10.5" + resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e" + integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA== + +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= + +he@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" + integrity sha1-k0EP0hsAlzUVH4howvJx80J+I/0= + +iconv-lite@^0.4.24: + version "0.4.24" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" + integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== + dependencies: + safer-buffer ">= 2.1.2 < 3" + +ignore@^4.0.6: + version "4.0.6" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" + integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= + +inquirer@^6.1.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.2.0.tgz#51adcd776f661369dc1e894859c2560a224abdd8" + integrity sha512-QIEQG4YyQ2UYZGDC4srMZ7BjHOmNk1lR2JQj5UknBapklm6WHA+VVH7N+sUdX3A7NeCfGF8o4X1S3Ao7nAcIeg== + dependencies: + ansi-escapes "^3.0.0" + chalk "^2.0.0" + cli-cursor "^2.1.0" + cli-width "^2.0.0" + external-editor "^3.0.0" + figures "^2.0.0" + lodash "^4.17.10" + mute-stream "0.0.7" + run-async "^2.2.0" + rxjs "^6.1.0" + string-width "^2.1.0" + strip-ansi "^4.0.0" + through "^2.3.6" + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= + +is-promise@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" + integrity sha1-eaKp7OfwlugPNtKy87wWwf9L8/o= + +is-resolvable@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88" + integrity sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg== + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= + +js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +js-yaml@^3.12.0: + version "3.12.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1" + integrity sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= + +levn@^0.3.0, levn@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" + integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= + dependencies: + prelude-ls "~1.1.2" + type-check "~0.3.2" + +lodash@^4.17.10, lodash@^4.17.5: + version "4.17.11" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" + integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg== + +mimic-fn@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" + integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== + +minimatch@3.0.4, minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== + dependencies: + brace-expansion "^1.1.7" + +minimist@0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= + +mkdirp@0.5.1, mkdirp@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= + dependencies: + minimist "0.0.8" + +mocha@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-5.2.0.tgz#6d8ae508f59167f940f2b5b3c4a612ae50c90ae6" + integrity sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ== + dependencies: + browser-stdout "1.3.1" + commander "2.15.1" + debug "3.1.0" + diff "3.5.0" + escape-string-regexp "1.0.5" + glob "7.1.2" + growl "1.10.5" + he "1.1.1" + minimatch "3.0.4" + mkdirp "0.5.1" + supports-color "5.4.0" + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= + +ms@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" + integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== + +mute-stream@0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" + integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s= + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= + +nice-try@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" + integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== + +object-assign@^4.0.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= + +once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= + dependencies: + wrappy "1" + +onetime@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" + integrity sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ= + dependencies: + mimic-fn "^1.0.0" + +optionator@^0.8.2: + version "0.8.2" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" + integrity sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q= + dependencies: + deep-is "~0.1.3" + fast-levenshtein "~2.0.4" + levn "~0.3.0" + prelude-ls "~1.1.2" + type-check "~0.3.2" + wordwrap "~1.0.0" + +os-tmpdir@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= + +path-is-inside@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" + integrity sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM= + +path-key@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= + +pluralize@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" + integrity sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow== + +prelude-ls@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" + integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= + +prettier-linter-helpers@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" + integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== + dependencies: + fast-diff "^1.1.2" + +prettier@^1.15.2: + version "1.15.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.15.2.tgz#d31abe22afa4351efa14c7f8b94b58bb7452205e" + integrity sha512-YgPLFFA0CdKL4Eg2IHtUSjzj/BWgszDHiNQAe0VAIBse34148whfdzLagRL+QiKS+YfK5ftB6X4v/MBw8yCoug== + +progress@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.1.tgz#c9242169342b1c29d275889c95734621b1952e31" + integrity sha512-OE+a6vzqazc+K6LxJrX5UPyKFvGnL5CYmq2jFGNIBWHpc4QyE49/YOumcrpQFJpfejmvRtbJzgO1zPmMCqlbBg== + +punycode@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== + +regexpp@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" + integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== + +require-uncached@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" + integrity sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM= + dependencies: + caller-path "^0.1.0" + resolve-from "^1.0.0" + +resolve-from@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" + integrity sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY= + +restore-cursor@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" + integrity sha1-n37ih/gv0ybU/RYpI9YhKe7g368= + dependencies: + onetime "^2.0.0" + signal-exit "^3.0.2" + +rimraf@~2.6.2: + version "2.6.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" + integrity sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w== + dependencies: + glob "^7.0.5" + +run-async@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" + integrity sha1-A3GrSuC91yDUFm19/aZP96RFpsA= + dependencies: + is-promise "^2.1.0" + +rxjs@^6.1.0: + version "6.3.3" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.3.3.tgz#3c6a7fa420e844a81390fb1158a9ec614f4bad55" + integrity sha512-JTWmoY9tWCs7zvIk/CvRjhjGaOd+OVBM987mxFo+OW66cGpdKjZcpmc74ES1sB//7Kl/PAe8+wEakuhG4pcgOw== + dependencies: + tslib "^1.9.0" + +"safer-buffer@>= 2.1.2 < 3": + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + +semver@^5.5.0, semver@^5.5.1: + version "5.6.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" + integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg== + +shebang-command@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo= + dependencies: + shebang-regex "^1.0.0" + +shebang-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= + +signal-exit@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= + +slice-ansi@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d" + integrity sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg== + dependencies: + is-fullwidth-code-point "^2.0.0" + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= + +string-width@^2.1.0, string-width@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^4.0.0" + +strip-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= + dependencies: + ansi-regex "^3.0.0" + +strip-json-comments@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= + +supports-color@5.4.0: + version "5.4.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.4.0.tgz#1c6b337402c2137605efe19f10fec390f6faab54" + integrity sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w== + dependencies: + has-flag "^3.0.0" + +supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + dependencies: + has-flag "^3.0.0" + +table@^5.0.2: + version "5.1.0" + resolved "https://registry.yarnpkg.com/table/-/table-5.1.0.tgz#69a54644f6f01ad1628f8178715b408dc6bf11f7" + integrity sha512-e542in22ZLhD/fOIuXs/8yDZ9W61ltF8daM88rkRNtgTIct+vI2fTnAyu/Db2TCfEcI8i7mjZz6meLq0nW7TYg== + dependencies: + ajv "^6.5.3" + lodash "^4.17.10" + slice-ansi "1.0.0" + string-width "^2.1.1" + +text-table@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= + +through@^2.3.6: + version "2.3.8" + resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= + +tmp@^0.0.33: + version "0.0.33" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" + integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== + dependencies: + os-tmpdir "~1.0.2" + +tslib@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" + integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ== + +type-check@~0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" + integrity sha1-WITKtRLPHTVeP7eE8wgEsrUg23I= + dependencies: + prelude-ls "~1.1.2" + +uri-js@^4.2.2: + version "4.2.2" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" + integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ== + dependencies: + punycode "^2.1.0" + +which@^1.2.9: + version "1.3.1" + resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" + integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== + dependencies: + isexe "^2.0.0" + +wordwrap@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus= + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= + +write@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" + integrity sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c= + dependencies: + mkdirp "^0.5.1" From 6285cb9b64032bbcb13be4cfe891589299e0f99c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Mon, 19 Nov 2018 00:53:17 +0100 Subject: [PATCH 552/569] Add no-deprecated-clone rule --- .../package.json | 2 +- .../src/index.js | 4 +- .../src/rules/no-deprecated-clone.js | 91 +++++++++++ .../src/utils/get-export-name.js | 24 +++ .../src/utils/get-reference-origin.js | 142 ++++++++++++++++++ .../tests/rules/no-deprecated-clone.js | 138 +++++++++++++++++ 6 files changed, 399 insertions(+), 2 deletions(-) create mode 100644 eslint/babel-eslint-plugin-development/src/rules/no-deprecated-clone.js create mode 100644 eslint/babel-eslint-plugin-development/src/utils/get-export-name.js create mode 100644 eslint/babel-eslint-plugin-development/src/utils/get-reference-origin.js create mode 100644 eslint/babel-eslint-plugin-development/tests/rules/no-deprecated-clone.js diff --git a/eslint/babel-eslint-plugin-development/package.json b/eslint/babel-eslint-plugin-development/package.json index ce7a934753c3..428b9bbe0adf 100644 --- a/eslint/babel-eslint-plugin-development/package.json +++ b/eslint/babel-eslint-plugin-development/package.json @@ -15,7 +15,7 @@ "main": "index.js", "scripts": { "test": "mocha tests --recursive", - "lint": "eslint src" + "lint": "eslint src tests" }, "devDependencies": { "eslint": "^5.9.0", diff --git a/eslint/babel-eslint-plugin-development/src/index.js b/eslint/babel-eslint-plugin-development/src/index.js index 84d69fb8226d..3c401bd1b695 100644 --- a/eslint/babel-eslint-plugin-development/src/index.js +++ b/eslint/babel-eslint-plugin-development/src/index.js @@ -1,5 +1,7 @@ "use strict"; module.exports = { - rules: {}, + rules: { + "no-deprecated-clone": require("./rules/no-deprecated-clone"), + }, }; diff --git a/eslint/babel-eslint-plugin-development/src/rules/no-deprecated-clone.js b/eslint/babel-eslint-plugin-development/src/rules/no-deprecated-clone.js new file mode 100644 index 000000000000..0d7cda0bc5e6 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/src/rules/no-deprecated-clone.js @@ -0,0 +1,91 @@ +// @flow + +"use strict"; + +const getReferenceOrigin = require("../utils/get-reference-origin"); +const getExportName = require("../utils/get-export-name"); + +function reportError(context, node, name) { + const isMemberExpression = node.type === "MemberExpression"; + const id = isMemberExpression ? node.property : node; + context.report({ + node: id, + message: `t.${name}() is deprecated. Use t.cloneNode() instead.`, + fix(fixer) { + if (isMemberExpression) { + return fixer.replaceText(id, "cloneNode"); + } + }, + }); +} + +module.exports = { + meta: { + schema: [], + fixable: "code", + }, + create(context) { + return { + CallExpression(node) { + const scope = context.getScope(); + const origin = getReferenceOrigin(node.callee, scope); + + const report = () => reportError(context, node.callee, origin.name); + + if (!origin) return; + + if ( + origin.kind === "import" && + (origin.name === "clone" || origin.name === "cloneDeep") && + origin.source === "@babel/types" + ) { + // imported from @babel/types + return report(); + } + + if ( + origin.kind === "property" && + (origin.path === "clone" || origin.path === "cloneDeep") && + origin.base.kind === "import" && + origin.base.name === "types" && + origin.base.source === "@babel/core" + ) { + // imported from @babel/core + return report(); + } + + if ( + origin.kind === "property" && + (origin.path === "types.clone" || + origin.path === "types.cloneDeep") && + origin.base.kind === "param" && + origin.base.index === 0 + ) { + const { functionNode } = origin.base; + const { parent } = functionNode; + + if (parent.type === "CallExpression") { + const calleeOrigin = getReferenceOrigin(parent.callee, scope); + if ( + calleeOrigin && + calleeOrigin.kind === "import" && + calleeOrigin.name === "declare" && + calleeOrigin.source === "@babel/helper-plugin-utils" + ) { + // Using "declare" from "@babel/helper-plugin-utils" + return report(); + } + } else { + const exportName = getExportName(functionNode); + + if (exportName === "default" || exportName === "module.exports") { + // export default function ({ types: t }) {} + // module.exports = function ({ types: t }) {} + return report(); + } + } + } + }, + }; + }, +}; diff --git a/eslint/babel-eslint-plugin-development/src/utils/get-export-name.js b/eslint/babel-eslint-plugin-development/src/utils/get-export-name.js new file mode 100644 index 000000000000..8c6e2c5e4086 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/src/utils/get-export-name.js @@ -0,0 +1,24 @@ +"use strict"; + +module.exports = function getExportName(node) { + const { parent } = node; + + if (parent.type === "ExportDefaultDeclaration") { + return "default"; + } + + if (parent.type === "ExportNamedDeclaration") { + return node.id.name; + } + + if ( + parent.type === "AssignmentExpression" && + parent.left.type === "MemberExpression" && + parent.left.object.type === "Identifier" && + parent.left.object.name === "module" && + parent.left.property.type === "Identifier" && + parent.left.property.name === "exports" + ) { + return "module.exports"; + } +}; diff --git a/eslint/babel-eslint-plugin-development/src/utils/get-reference-origin.js b/eslint/babel-eslint-plugin-development/src/utils/get-reference-origin.js new file mode 100644 index 000000000000..44cebc4edc0b --- /dev/null +++ b/eslint/babel-eslint-plugin-development/src/utils/get-reference-origin.js @@ -0,0 +1,142 @@ +"use strict"; + +module.exports = getReferenceOrigin; + +/*:: +type ReferenceOriginImport = { kind: "import", source: string, name: string }; +type ReferenceOriginParam = { + kind: "param", + index: number, + functionNode: Node, +}; + +type ReferenceOrigin = + | ReferenceOriginImport + | ReferenceOriginParam + | { kind: "import *", source: string } + | { + kind: "property", + base: ReferenceOriginImport | ReferenceOriginParam, + path: string, + name: string, + }; +*/ + +// Given a node and a context, returns a description of where its value comes +// from. +// It resolves imports, parameters of exported functions and property accesses. +// See the ReferenceOrigin type for more informations. +function getReferenceOrigin(node, scope) /*: ?ReferenceOrigin */ { + if (node.type === "Identifier") { + const variable = getVariableDefinition(node.name, scope); + if (!variable) return null; + + const definition = variable.definition; + const defNode = definition.node; + + if (definition.type === "ImportBinding") { + if (defNode.type === "ImportSpecifier") { + return { + kind: "import", + source: definition.parent.source.value, + name: defNode.imported.name, + }; + } + if (defNode.type === "ImportNamespaceSpecifier") { + return { + kind: "import *", + source: definition.parent.source.value, + }; + } + } + + if (definition.type === "Variable" && defNode.init) { + const origin = getReferenceOrigin(defNode.init, variable.scope); + return origin && patternToProperty(definition.name, origin); + } + + if (definition.type === "Parameter") { + return patternToProperty(definition.name, { + kind: "param", + index: definition.index, + functionNode: definition.node, + }); + } + } + + if (node.type === "MemberExpression" && !node.computed) { + const origin = getReferenceOrigin(node.object, scope); + return origin && addProperty(origin, node.property.name); + } + + return null; +} + +function getVariableDefinition(name, scope) { + let currentScope = scope; + do { + const variable = currentScope.set.get(name); + if (variable && variable.defs[0]) { + return { scope: currentScope, definition: variable.defs[0] }; + } + } while ((currentScope = currentScope.upper)); +} + +function patternToProperty(id, base) { + const path = getPatternPath(id); + return path && path.reduce(addProperty, base); +} + +// Adds a property to a given origin. If it was a namespace import it becomes +// a named import, so that `import * as x from "foo"; x.bar` and +// `import { bar } from "foo"` have the same origin. +function addProperty(origin, name) { + if (origin.kind === "import *") { + return { + kind: "import", + source: origin.source, + name, + }; + } + if (origin.kind === "property") { + return { + kind: "property", + base: origin.base, + path: origin.path + "." + name, + name, + }; + } + return { + kind: "property", + base: origin, + path: name, + name, + }; +} + +// if "node" is c of { a: { b: c } }, the result is ["a","b"] +function getPatternPath(node) { + let current = node; + const path = []; + + // Unshift keys to path while going up + do { + const property = current.parent; + if ( + property.type === "ArrayPattern" || + property.type === "AssignmentPattern" || + property.computed + ) { + // These nodes are not supported. + return null; + } + if (property.type === "Property") { + path.unshift(property.key.name); + } else { + // The destructuring pattern is finished + break; + } + } while ((current = current.parent.parent)); + + return path; +} diff --git a/eslint/babel-eslint-plugin-development/tests/rules/no-deprecated-clone.js b/eslint/babel-eslint-plugin-development/tests/rules/no-deprecated-clone.js new file mode 100644 index 000000000000..473a3a32b21a --- /dev/null +++ b/eslint/babel-eslint-plugin-development/tests/rules/no-deprecated-clone.js @@ -0,0 +1,138 @@ +"use strict"; + +const rule = require("../../src/rules/no-deprecated-clone"); +const { RuleTester } = require("eslint"); + +const cloneError = "t.clone() is deprecated. Use t.cloneNode() instead."; +const cloneDeepError = + "t.cloneDeep() is deprecated. Use t.cloneNode() instead."; + +const ruleTester = new RuleTester({ + parserOptions: { sourceType: "module" }, +}); + +ruleTester.run("no-deprecated-clone", rule, { + valid: [ + `_.clone(obj)`, + `_.cloneDeep(obj)`, + `import * as t from "lib"; t.clone();`, + `import * as t from "lib"; t.cloneDeep();`, + `function f(_) { _.types.clone(); }`, + `function f(_) { _.types.cloneDeep(); }`, + `import * as t from "@babel/types"; t.cloneNode();`, + ], + invalid: [ + { + code: `import { clone } from "@babel/types"; clone();`, + errors: [cloneError], + }, + { + code: `import { cloneDeep } from "@babel/types"; cloneDeep();`, + errors: [cloneDeepError], + }, + { + code: `import { clone } from "@babel/types"; var clone2 = clone; clone2();`, + errors: [cloneError], + }, + { + code: `import { cloneDeep } from "@babel/types"; var cloneDeep2 = cloneDeep; cloneDeep2();`, + errors: [cloneDeepError], + }, + { + code: `import * as t from "@babel/types"; t.clone();`, + errors: [cloneError], + }, + { + code: `import * as t from "@babel/types"; t.cloneDeep();`, + errors: [cloneDeepError], + }, + { + code: `import * as t from "@babel/types"; var { clone } = t; clone();`, + errors: [cloneError], + }, + { + code: `import * as t from "@babel/types"; var { cloneDeep } = t; cloneDeep();`, + errors: [cloneDeepError], + }, + { + code: `import { clone as c } from "@babel/types"; c();`, + errors: [cloneError], + }, + { + code: `import { cloneDeep as cD } from "@babel/types"; cD();`, + errors: [cloneDeepError], + }, + { + code: `import * as babel from "@babel/core"; babel.types.clone();`, + errors: [cloneError], + }, + { + code: `import * as babel from "@babel/core"; babel.types.cloneDeep();`, + errors: [cloneDeepError], + }, + { + code: `import { types } from "@babel/core"; types.clone();`, + errors: [cloneError], + }, + { + code: `import { types } from "@babel/core"; types.cloneDeep();`, + errors: [cloneDeepError], + }, + { + code: `import { types as t } from "@babel/core"; t.clone();`, + errors: [cloneError], + }, + { + code: `import { types as t } from "@babel/core"; t.cloneDeep();`, + errors: [cloneDeepError], + }, + { + code: `export default function plugin(babel) { babel.types.clone() }`, + errors: [cloneError], + }, + { + code: `export default function plugin(babel) { babel.types.cloneDeep() }`, + errors: [cloneDeepError], + }, + { + code: `export default function plugin({ types }) { types.clone() }`, + errors: [cloneError], + }, + { + code: `export default function plugin({ types }) { types.cloneDeep() }`, + errors: [cloneDeepError], + }, + { + code: `export default function plugin({ types: t }) { t.clone() }`, + errors: [cloneError], + }, + { + code: `export default function plugin({ types: t }) { t.cloneDeep() }`, + errors: [cloneDeepError], + }, + { + code: `export default ({ types }) => { types.clone() }`, + errors: [cloneError], + }, + { + code: `export default ({ types }) => { types.cloneDeep() }`, + errors: [cloneDeepError], + }, + { + code: `module.exports = function plugin({ types }) { types.clone() }`, + errors: [cloneError], + }, + { + code: `module.exports = function plugin({ types }) { types.cloneDeep() }`, + errors: [cloneDeepError], + }, + { + code: `import { declare } from "@babel/helper-plugin-utils"; declare(({ types }) => { types.clone() });`, + errors: [cloneError], + }, + { + code: `import { declare } from "@babel/helper-plugin-utils"; declare(({ types }) => { types.cloneDeep() });`, + errors: [cloneDeepError], + }, + ], +}); From 1f7197ec164ade83f4d0a7b1d7b64ffb4959bd09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 20 Nov 2018 18:02:40 +0100 Subject: [PATCH 553/569] Extract isFromBabelTypes helper --- .../src/rules/no-deprecated-clone.js | 84 ++++--------------- .../src/utils/is-from-babel-types.js | 56 +++++++++++++ 2 files changed, 74 insertions(+), 66 deletions(-) create mode 100644 eslint/babel-eslint-plugin-development/src/utils/is-from-babel-types.js diff --git a/eslint/babel-eslint-plugin-development/src/rules/no-deprecated-clone.js b/eslint/babel-eslint-plugin-development/src/rules/no-deprecated-clone.js index 0d7cda0bc5e6..08bfef8c9be5 100644 --- a/eslint/babel-eslint-plugin-development/src/rules/no-deprecated-clone.js +++ b/eslint/babel-eslint-plugin-development/src/rules/no-deprecated-clone.js @@ -3,21 +3,7 @@ "use strict"; const getReferenceOrigin = require("../utils/get-reference-origin"); -const getExportName = require("../utils/get-export-name"); - -function reportError(context, node, name) { - const isMemberExpression = node.type === "MemberExpression"; - const id = isMemberExpression ? node.property : node; - context.report({ - node: id, - message: `t.${name}() is deprecated. Use t.cloneNode() instead.`, - fix(fixer) { - if (isMemberExpression) { - return fixer.replaceText(id, "cloneNode"); - } - }, - }); -} +const isFromBabelTypes = require("../utils/is-from-babel-types"); module.exports = { meta: { @@ -27,63 +13,29 @@ module.exports = { create(context) { return { CallExpression(node) { + const { callee } = node; const scope = context.getScope(); - const origin = getReferenceOrigin(node.callee, scope); - - const report = () => reportError(context, node.callee, origin.name); + const origin = getReferenceOrigin(callee, scope); if (!origin) return; + const { name } = origin; if ( - origin.kind === "import" && - (origin.name === "clone" || origin.name === "cloneDeep") && - origin.source === "@babel/types" - ) { - // imported from @babel/types - return report(); - } - - if ( - origin.kind === "property" && - (origin.path === "clone" || origin.path === "cloneDeep") && - origin.base.kind === "import" && - origin.base.name === "types" && - origin.base.source === "@babel/core" + (name === "clone" || name === "cloneDeep") && + isFromBabelTypes(origin, scope) ) { - // imported from @babel/core - return report(); - } - - if ( - origin.kind === "property" && - (origin.path === "types.clone" || - origin.path === "types.cloneDeep") && - origin.base.kind === "param" && - origin.base.index === 0 - ) { - const { functionNode } = origin.base; - const { parent } = functionNode; - - if (parent.type === "CallExpression") { - const calleeOrigin = getReferenceOrigin(parent.callee, scope); - if ( - calleeOrigin && - calleeOrigin.kind === "import" && - calleeOrigin.name === "declare" && - calleeOrigin.source === "@babel/helper-plugin-utils" - ) { - // Using "declare" from "@babel/helper-plugin-utils" - return report(); - } - } else { - const exportName = getExportName(functionNode); - - if (exportName === "default" || exportName === "module.exports") { - // export default function ({ types: t }) {} - // module.exports = function ({ types: t }) {} - return report(); - } - } + const isMemberExpression = callee.type === "MemberExpression"; + const id = isMemberExpression ? callee.property : callee; + + context.report({ + node: id, + message: `t.${name}() is deprecated. Use t.cloneNode() instead.`, + fix(fixer) { + if (isMemberExpression) { + return fixer.replaceText(id, "cloneNode"); + } + }, + }); } }, }; diff --git a/eslint/babel-eslint-plugin-development/src/utils/is-from-babel-types.js b/eslint/babel-eslint-plugin-development/src/utils/is-from-babel-types.js new file mode 100644 index 000000000000..097fb4582cf7 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/src/utils/is-from-babel-types.js @@ -0,0 +1,56 @@ +"use strict"; + +const getReferenceOrigin = require("./get-reference-origin"); +const getExportName = require("./get-export-name"); + +// Check if a ReferenceOrigin (returned by ./get-reference-origin.js) +// is a reference to a @babel/types export. +module.exports = function isFromBabelTypes( + origin /*: ReferenceOrigin */, + scope /*: Scope */, +) { + if (origin.kind === "import" && origin.source === "@babel/types") { + // imported from @babel/types + return true; + } + + if ( + origin.kind === "property" && + origin.base.kind === "import" && + origin.base.name === "types" && + origin.base.source === "@babel/core" + ) { + // imported from @babel/core + return true; + } + + if ( + origin.kind !== "property" || + origin.base.kind !== "param" || + origin.base.index !== 0 + ) { + // Not a parameter of the plugin factory function + return false; + } + + const { functionNode } = origin.base; + const { parent } = functionNode; + + if (parent.type === "CallExpression") { + const calleeOrigin = getReferenceOrigin(parent.callee, scope); + + // Using "declare" from "@babel/helper-plugin-utils" + return !!( + calleeOrigin && + calleeOrigin.kind === "import" && + calleeOrigin.name === "declare" && + calleeOrigin.source === "@babel/helper-plugin-utils" + ); + } + + const exportName = getExportName(functionNode); + + // export default function ({ types: t }) {} + // module.exports = function ({ types: t }) {} + return exportName === "default" || exportName === "module.exports"; +}; From 2be54111c09c555500559f91c0b373fcde4bcb5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 20 Nov 2018 18:13:37 +0100 Subject: [PATCH 554/569] Add no-undefined-identifier rule --- .../src/rules/no-undefined-identifier.js | 41 ++++++++++ .../tests/rules/no-undefined-identifier.js | 80 +++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 eslint/babel-eslint-plugin-development/src/rules/no-undefined-identifier.js create mode 100644 eslint/babel-eslint-plugin-development/tests/rules/no-undefined-identifier.js diff --git a/eslint/babel-eslint-plugin-development/src/rules/no-undefined-identifier.js b/eslint/babel-eslint-plugin-development/src/rules/no-undefined-identifier.js new file mode 100644 index 000000000000..c1b4b8a99382 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/src/rules/no-undefined-identifier.js @@ -0,0 +1,41 @@ +"use strict"; + +const getReferenceOrigin = require("../utils/get-reference-origin"); +const isFromBabelTypes = require("../utils/is-from-babel-types"); + +function firstArgumentIsUndefinedString(argumentsArray) { + return ( + argumentsArray.length > 0 && + argumentsArray[0].type === "Literal" && + argumentsArray[0].value === "undefined" + ); +} + +module.exports = { + meta: { + schema: [], + }, + create(context) { + return { + CallExpression(node) { + const { callee } = node; + const scope = context.getScope(); + + const origin = getReferenceOrigin(callee, scope); + if (!origin) return; + + const { name } = origin; + if ( + (name === "identifier" || name === "Identifier") && + firstArgumentIsUndefinedString(node.arguments) && + isFromBabelTypes(origin, scope) + ) { + context.report( + node, + "Use path.scope.buildUndefinedNode() to create an undefined identifier directly.", + ); + } + }, + }; + }, +}; diff --git a/eslint/babel-eslint-plugin-development/tests/rules/no-undefined-identifier.js b/eslint/babel-eslint-plugin-development/tests/rules/no-undefined-identifier.js new file mode 100644 index 000000000000..c77516b177a4 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/tests/rules/no-undefined-identifier.js @@ -0,0 +1,80 @@ +"use strict"; + +const rule = require("../../src/rules/no-undefined-identifier"); +const { RuleTester } = require("eslint"); + +const error = + "Use path.scope.buildUndefinedNode() to create an undefined identifier directly."; + +const ruleTester = new RuleTester({ + parserOptions: { sourceType: "module" }, +}); + +ruleTester.run("no-undefined-identifier", rule, { + valid: [ + `_.identifier("undefined")`, + `_.Identifier("undefined")`, + `import * as t from "lib"; t.identifier("undefined");`, + `function f(_) { _.types.identifier("undefined"); }`, + `import * as t from "@babel/types"; t.identifier("not_undefined");`, + `path.scope.buildUndefinedNode();`, + ], + invalid: [ + { + code: `import { identifier } from "@babel/types"; identifier("undefined");`, + errors: [error], + }, + { + code: `import { Identifier } from "@babel/types"; Identifier("undefined");`, + errors: [error], + }, + { + code: `import * as t from "@babel/types"; t.identifier("undefined");`, + errors: [error], + }, + { + code: `import * as t from "@babel/types"; var { identifier } = t; identifier("undefined");`, + errors: [error], + }, + { + code: `import { identifier as id } from "@babel/types"; id("undefined");`, + errors: [error], + }, + { + code: `import * as babel from "@babel/core"; babel.types.identifier("undefined");`, + errors: [error], + }, + { + code: `import { types } from "@babel/core"; types.identifier("undefined");`, + errors: [error], + }, + { + code: `import { types as t } from "@babel/core"; t.identifier("undefined");`, + errors: [error], + }, + { + code: `export default function plugin(babel) { babel.types.identifier("undefined") }`, + errors: [error], + }, + { + code: `export default function plugin({ types }) { types.identifier("undefined") }`, + errors: [error], + }, + { + code: `export default function plugin({ types: t }) { t.identifier("undefined") }`, + errors: [error], + }, + { + code: `export default ({ types }) => { types.identifier("undefined") }`, + errors: [error], + }, + { + code: `module.exports = function plugin({ types }) { types.identifier("undefined") }`, + errors: [error], + }, + { + code: `import { declare } from "@babel/helper-plugin-utils"; declare(({ types }) => { types.identifier("undefined") });`, + errors: [error], + }, + ], +}); From c59db5295497363531837ebb6d7ce4f282bbb99a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 20 Nov 2018 20:30:02 +0100 Subject: [PATCH 555/569] Extract isBabelPluginFactory helper --- .../src/utils/is-babel-plugin-factory.js | 26 +++++++++++++++ .../src/utils/is-from-babel-types.js | 33 ++++--------------- 2 files changed, 32 insertions(+), 27 deletions(-) create mode 100644 eslint/babel-eslint-plugin-development/src/utils/is-babel-plugin-factory.js diff --git a/eslint/babel-eslint-plugin-development/src/utils/is-babel-plugin-factory.js b/eslint/babel-eslint-plugin-development/src/utils/is-babel-plugin-factory.js new file mode 100644 index 000000000000..287124e22809 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/src/utils/is-babel-plugin-factory.js @@ -0,0 +1,26 @@ +"use strict"; + +const getReferenceOrigin = require("./get-reference-origin"); +const getExportName = require("./get-export-name"); + +module.exports = function isBabelPluginFactory(node, scope) { + const { parent } = node; + + if (parent.type === "CallExpression") { + const calleeOrigin = getReferenceOrigin(parent.callee, scope); + + // Using "declare" from "@babel/helper-plugin-utils" + return !!( + calleeOrigin && + calleeOrigin.kind === "import" && + calleeOrigin.name === "declare" && + calleeOrigin.source === "@babel/helper-plugin-utils" + ); + } + + const exportName = getExportName(node); + + // export default function ({ types: t }) {} + // module.exports = function ({ types: t }) {} + return exportName === "default" || exportName === "module.exports"; +}; diff --git a/eslint/babel-eslint-plugin-development/src/utils/is-from-babel-types.js b/eslint/babel-eslint-plugin-development/src/utils/is-from-babel-types.js index 097fb4582cf7..36ab618817d6 100644 --- a/eslint/babel-eslint-plugin-development/src/utils/is-from-babel-types.js +++ b/eslint/babel-eslint-plugin-development/src/utils/is-from-babel-types.js @@ -1,7 +1,6 @@ "use strict"; -const getReferenceOrigin = require("./get-reference-origin"); -const getExportName = require("./get-export-name"); +const isBabelPluginFactory = require("./is-babel-plugin-factory"); // Check if a ReferenceOrigin (returned by ./get-reference-origin.js) // is a reference to a @babel/types export. @@ -25,32 +24,12 @@ module.exports = function isFromBabelTypes( } if ( - origin.kind !== "property" || - origin.base.kind !== "param" || - origin.base.index !== 0 + origin.kind === "property" && + origin.base.kind === "param" && + origin.base.index === 0 ) { - // Not a parameter of the plugin factory function - return false; - } - - const { functionNode } = origin.base; - const { parent } = functionNode; - - if (parent.type === "CallExpression") { - const calleeOrigin = getReferenceOrigin(parent.callee, scope); - - // Using "declare" from "@babel/helper-plugin-utils" - return !!( - calleeOrigin && - calleeOrigin.kind === "import" && - calleeOrigin.name === "declare" && - calleeOrigin.source === "@babel/helper-plugin-utils" - ); + return isBabelPluginFactory(origin.base.functionNode, scope); } - const exportName = getExportName(functionNode); - - // export default function ({ types: t }) {} - // module.exports = function ({ types: t }) {} - return exportName === "default" || exportName === "module.exports"; + return false; }; From 110191d81eaf326749a2436adfec7d6e4a678fac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 20 Nov 2018 20:30:08 +0100 Subject: [PATCH 556/569] Add plugin-name rule --- .../src/rules/plugin-name.js | 52 ++++++++++++++++++ .../tests/rules/plugin-name.js | 54 +++++++++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 eslint/babel-eslint-plugin-development/src/rules/plugin-name.js create mode 100644 eslint/babel-eslint-plugin-development/tests/rules/plugin-name.js diff --git a/eslint/babel-eslint-plugin-development/src/rules/plugin-name.js b/eslint/babel-eslint-plugin-development/src/rules/plugin-name.js new file mode 100644 index 000000000000..58a4bc9f6337 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/src/rules/plugin-name.js @@ -0,0 +1,52 @@ +"use strict"; + +const isBabelPluginFactory = require("../utils/is-babel-plugin-factory"); + +function getReturnValue(node) { + const { body } = node; + + if (body.type === "BlockStatement") { + const returnNode = body.body.find(n => n.type === "ReturnStatement"); + return returnNode && returnNode.argument; + } + + // Arrow functions with implicit return + return body; +} + +module.exports = { + meta: { + schema: [], + }, + create(context /*: Context */) { + let pluginFound = false; + + return { + FunctionDeclaration: functionVisitor, + FunctionExpression: functionVisitor, + ArrowFunctionExpression: functionVisitor, + + "Program:exit"(node) { + if (!pluginFound) { + context.report(node, "This file does not export a Babel plugin."); + } + }, + }; + + function functionVisitor(node) { + if (!isBabelPluginFactory(node, context.getScope())) return; + + const returnValue = getReturnValue(node); + if (!returnValue || returnValue.type !== "ObjectExpression") return; + + pluginFound = true; + + if (!returnValue.properties.some(p => p.key.name === "name")) { + context.report( + returnValue, + "This Babel plugin doesn't have a 'name' property.", + ); + } + } + }, +}; diff --git a/eslint/babel-eslint-plugin-development/tests/rules/plugin-name.js b/eslint/babel-eslint-plugin-development/tests/rules/plugin-name.js new file mode 100644 index 000000000000..670ced512279 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/tests/rules/plugin-name.js @@ -0,0 +1,54 @@ +"use strict"; + +const rule = require("../../src/rules/plugin-name"); +const { RuleTester } = require("eslint"); + +const missingPluginError = "This file does not export a Babel plugin."; +const missingNameError = "This Babel plugin doesn't have a 'name' property."; + +const ruleTester = new RuleTester({ + parserOptions: { sourceType: "module" }, +}); + +ruleTester.run("plugin-name", rule, { + valid: [ + `export default function () { return { name: "test-plugin" } }`, + `import { declare } from "@babel/helper-plugin-utils"; declare(() => { return { name: "test-plugin" } })`, + `import { declare } from "@babel/helper-plugin-utils"; declare(() => ({ name: "test-plugin" }))`, + `module.exports = function () { return { name: "foo" }; }`, + ], + invalid: [ + { + code: `function fn() { return { name: "foo" } }`, + errors: [missingPluginError], + }, + { + code: `export function fn() { return { name: "foo" } }`, + errors: [missingPluginError], + }, + { + code: `(function fn() { return { name: "foo" } })`, + errors: [missingPluginError], + }, + { + code: `() => { return { name: "foo" } }`, + errors: [missingPluginError], + }, + { + code: `export default function fn() {}`, + errors: [missingPluginError], + }, + { + code: `export default function fn() { return {} }`, + errors: [missingNameError], + }, + { + code: `import { declare } from "@babel/helper-plugin-utils"; declare(() => ({}))`, + errors: [missingNameError], + }, + { + code: `module.exports = function () { return {} }`, + errors: [missingNameError], + }, + ], +}); From 69cc2c30c5a504cd2276e8225bacb958eba9a8c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 20 Nov 2018 21:11:47 +0100 Subject: [PATCH 557/569] Docs --- eslint/babel-eslint-plugin-development/README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin-development/README.md b/eslint/babel-eslint-plugin-development/README.md index c18f4801d90b..524706c592d2 100644 --- a/eslint/babel-eslint-plugin-development/README.md +++ b/eslint/babel-eslint-plugin-development/README.md @@ -26,4 +26,13 @@ Then, load the plugin in your `.eslintrc` configuration file. You can omit the ` ## Supported Rules -* Fill in provided rules here +> Note: Rules marked with :wrench: are autofixable. + +* `babel-plugin/no-deprecated-clone` (:wrench:): Disallows using the deprecated + `t.clone(node)` and `t.cloneDeep(node)` methods from `@babel/types`. Those + calls are replaced with `t.cloneNode(node)` when using `eslint --fix`. +* `babel-plugin/no-undefined-identifier`: Disallows using + `t.identifier("undefined")` to create a node which represents an `undefined` + value, since it might cause problem if `undefined` is redeclared. +* `babel-plugin/plugin-name`: Requires plugins to have a `name` property, which + can be useful for debugging purposes. From b615efba8787ce1f3e8f447917eb62cfe6e8545c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 20 Nov 2018 21:20:58 +0100 Subject: [PATCH 558/569] Export rules --- eslint/babel-eslint-plugin-development/src/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eslint/babel-eslint-plugin-development/src/index.js b/eslint/babel-eslint-plugin-development/src/index.js index 3c401bd1b695..3965315c844b 100644 --- a/eslint/babel-eslint-plugin-development/src/index.js +++ b/eslint/babel-eslint-plugin-development/src/index.js @@ -3,5 +3,7 @@ module.exports = { rules: { "no-deprecated-clone": require("./rules/no-deprecated-clone"), + "no-undefined-identifier": require("./rules/no-undefined-identifier"), + "plugin-name": require("./rules/plugin-name"), }, }; From ed1cee365f8c66e9b8b32fefe87c72f78ae695a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Mon, 17 Dec 2018 20:13:53 +0100 Subject: [PATCH 559/569] Update package.json#main --- eslint/babel-eslint-plugin-development/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin-development/package.json b/eslint/babel-eslint-plugin-development/package.json index 428b9bbe0adf..c023b59fb813 100644 --- a/eslint/babel-eslint-plugin-development/package.json +++ b/eslint/babel-eslint-plugin-development/package.json @@ -12,7 +12,7 @@ "email": "nicolo.ribaudo@gmail.com", "url": "https://github.com/nicolo-ribaudo" }, - "main": "index.js", + "main": "src/index.js", "scripts": { "test": "mocha tests --recursive", "lint": "eslint src tests" From e146ae748ec9f9a284367fe836fb69e6b568b99e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Mon, 17 Dec 2018 21:15:50 +0100 Subject: [PATCH 560/569] Create Test workflow --- .../.github/main.workflow | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 eslint/babel-eslint-plugin-development/.github/main.workflow diff --git a/eslint/babel-eslint-plugin-development/.github/main.workflow b/eslint/babel-eslint-plugin-development/.github/main.workflow new file mode 100644 index 000000000000..6bad3e10057e --- /dev/null +++ b/eslint/babel-eslint-plugin-development/.github/main.workflow @@ -0,0 +1,23 @@ +workflow "Build, Lint and Test" { + resolves = ["Test", "Lint"] + on = "push" +} + +action "Build" { + uses = "docker://node:10" + runs = "yarn" +} + +action "Test" { + needs = "Build" + uses = "docker://node:10" + runs = "yarn" + args = "test" +} + +action "Lint" { + needs = "Build" + uses = "docker://node:10" + runs = "yarn" + args = "lint" +} From ef29bf53ff64e64816ff0a7f8bf8e575b12c6b6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 18 Dec 2018 19:59:26 +0100 Subject: [PATCH 561/569] Rename to @babel/eslint-plugin-developement. Fixes babel/eslint-plugin-babel-plugin#1 --- eslint/babel-eslint-plugin-development/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin-development/package.json b/eslint/babel-eslint-plugin-development/package.json index c023b59fb813..92ce30128715 100644 --- a/eslint/babel-eslint-plugin-development/package.json +++ b/eslint/babel-eslint-plugin-development/package.json @@ -1,5 +1,5 @@ { - "name": "eslint-plugin-babel-plugin", + "name": "@babel/eslint-plugin-developement", "version": "0.0.0", "description": "A set of eslint rules to enforce best practices in the development of Babel plugins.", "keywords": [ From 76ece4576ecf629a793f06272f5f59381e86dcf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 18 Dec 2018 21:04:36 +0100 Subject: [PATCH 562/569] Add publishConfig to package.json --- eslint/babel-eslint-plugin-development/package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eslint/babel-eslint-plugin-development/package.json b/eslint/babel-eslint-plugin-development/package.json index 92ce30128715..654a883b5323 100644 --- a/eslint/babel-eslint-plugin-development/package.json +++ b/eslint/babel-eslint-plugin-development/package.json @@ -26,5 +26,8 @@ "engines": { "node": ">=8.0.0" }, + "publishConfig": { + "access": "public" + }, "license": "MIT" } From cc2d73834309c6bbae73e2d3b242b38b02e37520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 18 Dec 2018 21:23:50 +0100 Subject: [PATCH 563/569] Update readme with the new package name --- eslint/babel-eslint-plugin-development/README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/eslint/babel-eslint-plugin-development/README.md b/eslint/babel-eslint-plugin-development/README.md index 524706c592d2..a5c3d82712e9 100644 --- a/eslint/babel-eslint-plugin-development/README.md +++ b/eslint/babel-eslint-plugin-development/README.md @@ -1,4 +1,4 @@ -# eslint-plugin-babel-plugin +# @babel/eslint-plugin-developement A set of eslint rules to enforce best practices in the development of Babel plugins. @@ -10,17 +10,17 @@ You'll first need to install [ESLint](http://eslint.org): $ npm install --save-dev eslint ``` -Next, install `eslint-plugin-babel-plugin`: +Next, install `@babel/eslint-plugin-developement`: ``` -$ npm install --save-dev eslint-plugin-babel-plugin +$ npm install --save-dev @babel/eslint-plugin-developement ``` Then, load the plugin in your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix: ```json { - "plugins": ["babel-plugin"] + "plugins": ["@babel/developement"] } ``` @@ -28,11 +28,11 @@ Then, load the plugin in your `.eslintrc` configuration file. You can omit the ` > Note: Rules marked with :wrench: are autofixable. -* `babel-plugin/no-deprecated-clone` (:wrench:): Disallows using the deprecated +* `@babel/developement/no-deprecated-clone` (:wrench:): Disallows using the deprecated `t.clone(node)` and `t.cloneDeep(node)` methods from `@babel/types`. Those calls are replaced with `t.cloneNode(node)` when using `eslint --fix`. -* `babel-plugin/no-undefined-identifier`: Disallows using +* `@babel/developement/no-undefined-identifier`: Disallows using `t.identifier("undefined")` to create a node which represents an `undefined` value, since it might cause problem if `undefined` is redeclared. -* `babel-plugin/plugin-name`: Requires plugins to have a `name` property, which +* `@babel/developement/plugin-name`: Requires plugins to have a `name` property, which can be useful for debugging purposes. From 1bd82dd6c1fca1b0d16ef265ffa5a1626233dc6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 18 Dec 2018 21:24:54 +0100 Subject: [PATCH 564/569] 1.0.0 --- eslint/babel-eslint-plugin-development/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin-development/package.json b/eslint/babel-eslint-plugin-development/package.json index 654a883b5323..226dc5cd9234 100644 --- a/eslint/babel-eslint-plugin-development/package.json +++ b/eslint/babel-eslint-plugin-development/package.json @@ -1,6 +1,6 @@ { "name": "@babel/eslint-plugin-developement", - "version": "0.0.0", + "version": "1.0.0", "description": "A set of eslint rules to enforce best practices in the development of Babel plugins.", "keywords": [ "eslint", From cc78743ac82d3bff9912cefafded1c8b835cb754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 18 Dec 2018 22:09:51 +0100 Subject: [PATCH 565/569] Add .npmignore --- eslint/babel-eslint-plugin-development/.npmignore | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 eslint/babel-eslint-plugin-development/.npmignore diff --git a/eslint/babel-eslint-plugin-development/.npmignore b/eslint/babel-eslint-plugin-development/.npmignore new file mode 100644 index 000000000000..5e0f958edde7 --- /dev/null +++ b/eslint/babel-eslint-plugin-development/.npmignore @@ -0,0 +1,3 @@ +tests/ +.github/ +.* \ No newline at end of file From 31c3de6bfadc863a2944d41e23349da41a8b9c9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 18 Dec 2018 22:33:27 +0100 Subject: [PATCH 566/569] Typo :facepalm: --- eslint/babel-eslint-plugin-development/README.md | 14 +++++++------- .../babel-eslint-plugin-development/package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/eslint/babel-eslint-plugin-development/README.md b/eslint/babel-eslint-plugin-development/README.md index a5c3d82712e9..12cc354b7470 100644 --- a/eslint/babel-eslint-plugin-development/README.md +++ b/eslint/babel-eslint-plugin-development/README.md @@ -1,4 +1,4 @@ -# @babel/eslint-plugin-developement +# @babel/eslint-plugin-development A set of eslint rules to enforce best practices in the development of Babel plugins. @@ -10,17 +10,17 @@ You'll first need to install [ESLint](http://eslint.org): $ npm install --save-dev eslint ``` -Next, install `@babel/eslint-plugin-developement`: +Next, install `@babel/eslint-plugin-development`: ``` -$ npm install --save-dev @babel/eslint-plugin-developement +$ npm install --save-dev @babel/eslint-plugin-development ``` Then, load the plugin in your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix: ```json { - "plugins": ["@babel/developement"] + "plugins": ["@babel/development"] } ``` @@ -28,11 +28,11 @@ Then, load the plugin in your `.eslintrc` configuration file. You can omit the ` > Note: Rules marked with :wrench: are autofixable. -* `@babel/developement/no-deprecated-clone` (:wrench:): Disallows using the deprecated +* `@babel/development/no-deprecated-clone` (:wrench:): Disallows using the deprecated `t.clone(node)` and `t.cloneDeep(node)` methods from `@babel/types`. Those calls are replaced with `t.cloneNode(node)` when using `eslint --fix`. -* `@babel/developement/no-undefined-identifier`: Disallows using +* `@babel/development/no-undefined-identifier`: Disallows using `t.identifier("undefined")` to create a node which represents an `undefined` value, since it might cause problem if `undefined` is redeclared. -* `@babel/developement/plugin-name`: Requires plugins to have a `name` property, which +* `@babel/development/plugin-name`: Requires plugins to have a `name` property, which can be useful for debugging purposes. diff --git a/eslint/babel-eslint-plugin-development/package.json b/eslint/babel-eslint-plugin-development/package.json index 226dc5cd9234..5021f8d7ba7b 100644 --- a/eslint/babel-eslint-plugin-development/package.json +++ b/eslint/babel-eslint-plugin-development/package.json @@ -1,5 +1,5 @@ { - "name": "@babel/eslint-plugin-developement", + "name": "@babel/eslint-plugin-development", "version": "1.0.0", "description": "A set of eslint rules to enforce best practices in the development of Babel plugins.", "keywords": [ From f5e482d3f65a7570c6b68d96e4c591af25c3d4f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 18 Dec 2018 22:35:25 +0100 Subject: [PATCH 567/569] Add repo url --- eslint/babel-eslint-plugin-development/package.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin-development/package.json b/eslint/babel-eslint-plugin-development/package.json index 5021f8d7ba7b..a459c582cfb3 100644 --- a/eslint/babel-eslint-plugin-development/package.json +++ b/eslint/babel-eslint-plugin-development/package.json @@ -29,5 +29,9 @@ "publishConfig": { "access": "public" }, - "license": "MIT" + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/babel/eslint-plugin-babel-plugin.git" + } } From f7c3d0717a8b17f296e173a6ccc4c78d44aea904 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Tue, 18 Dec 2018 22:35:38 +0100 Subject: [PATCH 568/569] 1.0.1 --- eslint/babel-eslint-plugin-development/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint/babel-eslint-plugin-development/package.json b/eslint/babel-eslint-plugin-development/package.json index a459c582cfb3..9a8810acea83 100644 --- a/eslint/babel-eslint-plugin-development/package.json +++ b/eslint/babel-eslint-plugin-development/package.json @@ -1,6 +1,6 @@ { "name": "@babel/eslint-plugin-development", - "version": "1.0.0", + "version": "1.0.1", "description": "A set of eslint rules to enforce best practices in the development of Babel plugins.", "keywords": [ "eslint", From ec18c30ce79562999a37cabd07652543dfb0033c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Jul 2019 21:05:37 +0200 Subject: [PATCH 569/569] Bump js-yaml from 3.12.0 to 3.13.1 (babel/eslint-plugin-babel-plugin#2) Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.12.0 to 3.13.1. - [Release notes](https://github.com/nodeca/js-yaml/releases) - [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md) - [Commits](https://github.com/nodeca/js-yaml/compare/3.12.0...3.13.1) Signed-off-by: dependabot[bot] --- eslint/babel-eslint-plugin-development/yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eslint/babel-eslint-plugin-development/yarn.lock b/eslint/babel-eslint-plugin-development/yarn.lock index 7532a9eae183..1124540b3f7b 100644 --- a/eslint/babel-eslint-plugin-development/yarn.lock +++ b/eslint/babel-eslint-plugin-development/yarn.lock @@ -487,9 +487,9 @@ js-tokens@^4.0.0: integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== js-yaml@^3.12.0: - version "3.12.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1" - integrity sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A== + version "3.13.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" + integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== dependencies: argparse "^1.0.7" esprima "^4.0.0"